jeudi 18 novembre 2010

How to diplay the total of a column in a report in Dynamics AX

I. To diplay the total of a column (named ColumnA), you have to :
  1. Click on ColumnA and open its properties (Alt+enter)
  2. Modify the  SumAll to YES
  3. Create a new field (named ColumnASum) typed Sum
  4. In its properties, modify the dataFieldName to ColumnA
That's all, the sum of all lines will be diplayed in the field.

Remark : naturally the ColumnASum must be created outside and after the Body containing the ColumnA
For example, you put the ColumnA in the body of  a section group in a generated design and the sum of this column in the footer of the section group.

II. You can also calculate the sum of a column following another method : 
In the classdeclaration, declare a variable : sumnet   

In the executeSection method of the body you calculate the sum of your column : 


public void executeSection()
{
    sumnet=sumnet+tmpPayrolljournaldata_1.PayrollPaytypeAmount4;

    super();

Then, in the method of your report create a method that displays this variable :

Display Amount _SumNet()
{
    return SumNet;
}


In the Grand Total section : Footer of the generated design for example: 
create a field and set its DataMethod to  _SumNet .
this field calculates the sum of your column.


Resources
https://community.dynamics.com/product/ax/f/33/p/31623/54232.aspx
http://axassociate.blogspot.com/search/label/Report?max-results=3

Happy Daxing!

Aucun commentaire:

Enregistrer un commentaire