Group by without TypedList

Posts   
 
    
Posts: 19
Joined: 03-Feb-2006
# Posted on: 24-Feb-2006 15:34:02   

Hi,

Following code returns collection of user entities. I would like to use UserCollection class in order to get result of the query but I don't see how I can apply group by clause(GroupByCollection ). I would like to avoid using TypedList.



Select * from [User]
Where UserId
IN
(

select UserRole.userid 

from UserRole 

where UserRole.roleid in (8, 10)

group by UserRole.userid having count(*) = 2
)


Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 24-Feb-2006 15:52:13   

check the following FieldCompareSetPredicate overload for SelfServicing

public FieldCompareSetPredicate(
   IEntityField field,
   IEntityField setField,
   SetOperator operatorToUse,
   IPredicate filter,
   IRelationCollection relations,
   string objectAlias,
   long maxNumberOfItemsToReturn,
   ISortExpression sorter,
   bool negate,
   IGroupByCollection groupByClause
);

And for the Adapter:

public FieldCompareSetPredicate(
   IEntityFieldCore field,
   IFieldPersistenceInfo persistenceInfoField,
   IEntityFieldCore setField,
   IFieldPersistenceInfo persistenceInfoSetField,
   SetOperator operatorToUse,
   IPredicate filter,
   IRelationCollection relations,
   string objectAlias,
   long maxNumberOfItemsToReturn,
   ISortExpression sorter,
   bool negate,
   IGroupByCollection groupByClause
);
Posts: 19
Joined: 03-Feb-2006
# Posted on: 27-Feb-2006 13:57:08   

[quotenick="Walaa"]check the following FieldCompareSetPredicate overload for SelfServicing

public FieldCompareSetPredicate(
   IEntityField field,
   IEntityField setField,
   SetOperator operatorToUse,

);

Thanks for your tip but there's still one problem, I have to set operatorToUse to some value although I don't need to use it in my query. It means that every time I have to execute some fake query because operatorToUse is mandatory field.

Do you see any other workaround?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 27-Feb-2006 14:55:46   

The operatorToUse is SetOperator.In