GroupBy and PredicateExpression

Posts   
 
    
Bola
User
Posts: 14
Joined: 10-Jun-2005
# Posted on: 08-Sep-2005 13:54:34   

Hi


// create the filter for the search. 
IRelationPredicateBucket bucket = lineas.GetRelationInfo();
bucket.PredicateExpression.Add(PredicateFactory.CompareValue(MovimientoAlmacenFieldIndex.MovPkSalida, ComparisonOperator.Equal, ucpk));

IEntityFields2 fields = lineas.GetFieldsInfo(); 
fields[1].AggregateFunctionToApply = AggregateFunction.Sum;
            
IGroupByCollection groupByClause = new GroupByCollection();
groupByClause.Add(fields[0]);
            
adapter.FetchTypedList(fields, lineas, bucket,0,null, false, groupByClause);


I'm grouping by fields[0] and applicate a function 'Sum' to fields[1]. But also, I'm filtering with the PredicateExpression 'bucket'.

But the result for the Sum of fields[1] doesn't respect this bucket and make the sum for all the registers, including these that are filtered. I need the sum only for the registers respecting the bucket Expression.

Thanks in advance.

Bola
User
Posts: 14
Joined: 10-Jun-2005
# Posted on: 08-Sep-2005 18:21:38   

It was a mistake in Database.

Please ignore this thread. I'm very sorry for start it.