Hello,
I'm working on a query result that i-m adding conditions and joins in the view delegate and it's working, but I would like to append group by statements on the query, Is there a way to achieve this in the view delegate?
Hello,
I'm working on a query result that i-m adding conditions and joins in the view delegate and it's working, but I would like to append group by statements on the query, Is there a way to achieve this in the view delegate?
Best answer by Zoltan Febert
Try this:
// Get BQL command from your view
var bqlCommand = [yourview].View.BqlSelect;
// Add Group by
var newCommand = bqlCommand.AggregateNew<
Aggregate<
GroupBy<[Field]>>>();
// Create your new select / view
var select = new PXView(Base, true, newCommand);
// Get your result as usual
var result = select.Select(PXView.Currents, PXView.Parameters,
PXView.Searches, PXView.SortColumns, PXView.Descendings,
PXView.Filters, ref startRow, 0, ref totalRows)
.RowCast<[DAC]>()
.ToList();
You can find a more complex example of AggregateNew in APDocumentEnq graph.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.