I'm using LLBLGen 4.2 SelfServicing.
I have a view Pallet with 4 fields: Code, IdSap, Pallennummer and DateTimeCreated.
I want to have a collection that is the outcome of:
select Code, IdSap, count(distinct Palletnummer) where DateTimeCreated between from and to.
The following is working fine:
ResultsetFields fields = new ResultsetFields(3);
fields.DefineField(PalletFields.Palletnummer, 2, "Pallets");
fields.AggregateFunctionToApply = AggregateFunction.CountDistinct;
PredicateExpression filter = new PredicateExpression(new FieldBetweenPredicate(PalletFields.DateTimeCreated, from, to));
SortExpression sorter = new SortExpression(PalletFields.Code | SortOperator.Ascending);
GroupByCollection gbc = new GroupByCollection();
TypedListDAO dao = new TypedListDAO();
DataTable results = new DataTable();
I do not think this is the most elegant way
Isn't it possible to achieve via collection on the view itself, without using the result set?
I also tried QuerySpec but could not get it to work.
How could this be done via QuerySpec?