This should do the trick, of course you have to change the name of the typedlist class:
First create a derived class from your TypedList class. Make sure the constructor gets called OK from the constructor of the derived class.
Then, override BuildResultset() (in the derived typed list class)
public override IEntityFields BuildResultset()
{
IEntityFields fields = base.BuildResultset();
// now set the aggregate on the quantity column.
fields["Quantity"].AggregateFunctionToApply = AggregateFunction.Sum;
return fields;
}
Before calling Fill, you have to produce a groupby collection. MyTypedList is the derived class from the typed list.
MyTypedList tl = new MyTypedList();
// set obey weak relations, as you need leftjoins:
tl.ObeyWeakRelations = true;
// grab the fields for the groupby clauses:
IEntityFields fields = tl.BuildResultset();
// build the groupbycollection:
IGroupByCollection groupBy = new GroupByCollection();
groupBy.Add(fields["ID"]);
groupBy.Add(fields["Sent"]);
groupBy.Add(fields["Firstname"]);
groupBy.Add(fields["Lastname"]);
groupBy.Add(fields["Email"]);
groupBy.Add(fields["Code"]);
groupBy.Add(fields["Sent"]);
groupBy.Add(fields["Cancelled"]);
groupBy.Add(fields["DataCreated"]);
groupBy.Add(fields["GrandTotal"]);
groupBy.Add(fields["HowPaid"]);
groupBy.HavingClause = new PredicateExpression(
new FieldCompareValuePredicate(
fields["Quantity"], ComparisonOperator.GreaterThan, _quantityValue));
tl.Fill(0, null, true, null, null, groupBy);