Tutorial :LLblgen: Select distinct?


I can't seem to figure out how I can select only distinct entries in Llblgen 2.6 self-service model

I essentially want this query.

select distinct City  from peopleTable  where *predicates*  

I've got my PeopleCollection and I'm not sure if there's a distinct method I can call or argument I can pass to GetMulti().


Entities by definition cannot be distinct - even if they have the same value they are different rows in the same table.

You could use a TypedList or DynamicList to get a distinct list of city values - one of the parameters on the Fetch call is to get distinct items.

Or if you are using LINQ you could do

List<string> cities = PeopleCollection.Select(x=>x.City).Distinct();  


Adding a diff't answer to compliment Matt's, since I ended up here, but couldn't find a simple answer of how to do this anywhere, and you can't format code in a comment

ResultsetFields fields = new ResultsetFields(1);  fields.DefineField(PeopleFields.City, 0);    DataTable dynamicList = new DataTable();  adapter.FetchTypedList(fields, dynamicList, null, false);    foreach (DataRow row in dynamicList.Rows)     Cities.Add(row[0] as string);  

This gives a distinct list of all cities, filtering is done with an IRelationPredicateBucket instead of null to FetchTypedList.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »