chris_vickerson wrote:
I know this must be dead simple but could someone please put a sample piece of code that does this (in c#):
select sum(englishQuantity), sum(frenchQuantity)
from LineItem
where productid = 12
I've been looking around and haven't found something I could re-use (it's probably right in front of me but I can't see it
).
You can also use a dynamic list for this, based on LineItem entity fields.
ResultsetFields fields = new ResultsetFields(2);
fields.DefineField(LineItemFieldIndex.EnglishQuantity, 0, "EnglishQuantity");
fields.DefineField(LineItemFieldIndex.FrenchQuantity, 1, "FrenchQuantity");
fields[0].AggregateFunctionToApply = AggregateFunction.Sum;
fields[1].AggregateFunctionToApply = AggregateFunction.Sum;
and then you use the dynamic list fetch logic for the template group you're using (so either adapter or selfservicing). See the documentation about details on dynamic lists.