Group By in LLBLGEN

Posts   
 
    
Buzzy
User
Posts: 1
Joined: 22-Jul-2009
# Posted on: 22-Jul-2009 08:25:36   

Hello,

I was wondering how to do a group by clause in LLBLGEN.. I have looked around and cant see how to add a group by clause to how we are getting EntityCollections.

Sample code here :


RelationPredicateBucket filter = new RelationPredicateBucket();

        filter.PredicateExpression.Add( SuggestionsAndBugsFields.Show == true );
        filter.PredicateExpression.Add( SuggestionsAndBugsFields.SuggestionStatusId == SuggestionStatusTypes.Fixed );
        filter.PredicateExpression.Add( SuggestionsAndBugsFields.SuggestionTypeId == SuggestionTypes.Bug );

        EntityCollection<SuggestionsAndBugsEntity> suggestions = new EntityCollection<SuggestionsAndBugsEntity>( new SuggestionsAndBugsEntityFactory() );

        SortExpression sorter = new SortExpression( SuggestionsAndBugsFields.DateCreated | SortOperator.Descending );

        return SuggestionsAndBugsManager.FetchCollection( suggestions, filter, 0, sorter );

Is there an easy way to Group By a field doing it the way we are doing it ?

Thanks in advance..

rdhatch
User
Posts: 198
Joined: 03-Nov-2007
# Posted on: 22-Jul-2009 08:39:07   

Hi Buzzy,

You probably want to be looking at TypedLists when doing Aggregates / GroupBy's. The help (found in the LLBLGen Pro Designer) has some excellent examples for you.

Hope this helps!

Ryan

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 22-Jul-2009 10:52:50   

rdhatch is correct. You can't use GroupBy with entityCollections, rather you should use a TypedList or a DynamicList.