Feature request :)

Posts   
 
    
Posts: 497
Joined: 08-Apr-2004
# Posted on: 02-Feb-2005 10:16:42   

Hi,

How about this a feature request....

Quite often, I need to get a list of ID's from the database where a certain criteria is met. To do this, I loop through the collection and build a comma-delimitered string.

What would be cool is if I could ask the adaptor to fetch my field back in a comma-seperated string for me....

Is it just me that would find this useful?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39801
Joined: 17-Aug-2003
# Posted on: 02-Feb-2005 10:46:42   

If you're using the fieldcomparerange predicate, you can also add all values to an arraylist and pass that, then the predicate builts the comma separated list for you simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Posts: 497
Joined: 08-Apr-2004
# Posted on: 02-Feb-2005 11:35:19   

True, but I ideally I still want LLBL to give me a comma-seperated string, so I can easily reuse my string where I need to simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39801
Joined: 17-Aug-2003
# Posted on: 02-Feb-2005 12:22:44   

MattWoberts wrote:

True, but I ideally I still want LLBL to give me a comma-seperated string, so I can easily reuse my string where I need to simple_smile

Here ya go:


public static string MakeCSVString(EntityCollectionBase collection, int fieldIndex)
{
    StringBuilder s = new StringBuilder();
    for(int i=0;i<collection.Count;i++)
    {
        if(i>0)
        {
            s.Append(", ");
        }
        s.Append(collection[i].Fields[fieldIndex].CurrentValue.ToString());
    }
    return s.ToString();
}

stuck_out_tongue_winking_eye

Frans Bouma | Lead developer LLBLGen Pro
Posts: 497
Joined: 08-Apr-2004
# Posted on: 02-Feb-2005 15:12:48   

Still not happy - I want the moon on a stick wink

Ok ok, I take the point, I should just create the method myself like you posted sunglasses

...I just wanted to get LLBL to return a string rather than have me loop through the collection!!! wink