how to sum field value using query in dynamic ax 2012

how to sum field value using query in dynamic ax 2012

Hi,

This is the query to sum the field value.

QueryBuildDataSource.addSelectionField(fieldNum(TableName,Field),SelectionField::Sum);

In general, use sum() aggregate method.

If you want an example, are you going to use an AOT query, the X++ query framework (QueryBuildDataSource and such classes) or queries integrated to X++ (select statement)?

Hi

Your requirement can be achieved in this way…

qbds.addSelectionField(fieldNum(InventTrans,Qty),SelectionField::Sum);