GetScalar with multiple filters

Posts   
 
    
Kris Nobels avatar
Posts: 118
Joined: 02-Apr-2008
# Posted on: 23-Dec-2009 16:56:51   

Hello,

I have a grid with paging on it.

i use this ...

daa.FetchEntityCollection(logging, vBucket, 0, vSort, vPath2, page, resultspage);

(this works great.)

I use multiple filters an add it to my vBucket.

IRelationPredicateBucket vBucket = new RelationPredicateBucket();

 IPredicateExpression filter = new PredicateExpression();

 IPredicateExpression exclfilter = new PredicateExpression();
 exclfilter.Negate = true;

 vBucket.PredicateExpression.Add(filter);
vBucket.PredicateExpression.Add(exclfilter);

But my grid needs to show how many results there are. simple_smile

there i use get scalar.

object o = daa.GetScalar(LogFields.Id, null, AggregateFunction.CountRow, filter);

Now how as you can see i have only 1 filter added. But i have an other filter that is negate.

My question is:

How do you get the count with multiple filters ?

thanks

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Dec-2009 23:05:09   

You should use another PredicateExpression instead of the bucket:


IPredicateExpression finalFilter = new PredicateExpression();
IPredicateExpression filter = new PredicateExpression();
IPredicateExpression exclfilter = new PredicateExpression();
exclfilter.Negate = true;

// ...

finalFilter.Add(filter);
finalFilter.Add(exclfilter);

object o = daa.GetScalar(LogFields.Id, null, AggregateFunction.CountRow, finalFilter);
David Elizondo | LLBLGen Support Team
Kris Nobels avatar
Posts: 118
Joined: 02-Apr-2008
# Posted on: 24-Dec-2009 00:08:39   

Thanks it works simple_smile