BuildResultset

Posts   
 
    
Bola
User
Posts: 14
Joined: 10-Jun-2005
# Posted on: 05-Sep-2005 18:35:06   

Using GroupByCollection and Having Clauses:


OrderTotalsTypedList orderTotals = new OrderTotalsTypedList();
// grab the fields collection. 
IEntityFields fields = orderTotals.BuildResultset();

I can't access BuildResultset because it is a private method. What should I do?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 06-Sep-2005 09:36:11   

Upgrade to 1.0.2004.2, it's been made public in that release.

Frans Bouma | Lead developer LLBLGen Pro
Bola
User
Posts: 14
Joined: 10-Jun-2005
# Posted on: 06-Sep-2005 12:28:43   

ok. Now I'm in Adapter, not SelfServicing, and I have:


ArticuloAlmacenTypedList lineas = new ArticuloAlmacenTypedList();

EntityFields2 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);

This make the sum for fields[1]. But I don't want really this. I want to add the value when another field (field[2]) have a determined value, and subtract it in other case. I mean:

if (field[2].value=1){ sum(field[1]) }else{ subtract(field[1]) }

¿How can I achieve this functionality?

Thanks!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 07-Sep-2005 10:25:03   

That's a CASE construct in SQL and that's not supported. To get the resultset you want, perform the sum on the client, after fetching the data.

Frans Bouma | Lead developer LLBLGen Pro