Close
Microsoft Dynamics AX 4 - Report Calculated Field

Microsoft Dynamics AX 4 – Report Calculated Field

As a “retired” AX developer I got tasked to implement a calculated field on an existing report.

Now – by retired I mean I probably spend 4 hours part time copying AX code.
So given this background you can understand the challenge presented to me…

But hey – I must admit.
It took a while but once I recovered all the lost information from my memory things started to make sense.
Although I still believe it is impossible for the MorphX language to ever make sense.

So back to the job at hand.

Requirement was very simple:
On a report I had to add another column that was calculated from two other columns on the same report.

So the two fields we had:

  1. VendPackingSlipTrans.ValueMST
  2. VendPackingSlipTrans.InventQty

and I need to create the 3rd column based on:

  1. Unit Price = VendPackingSlipTrans.ValueMST / VendPackingSlipTrans.InventQty.

So here is what  I did:

1. In your Data Dictionary -> under your VendPackingSlipTrans table you create a new display method:
(BTW: Remember a Display Method name should always start with identifier: “display” – not “private” or “public”)

display real unitPrice()
{

if (this.InventQty == 0) {

return 0;

}else{

return this.ValueMST / this.InventQty;

}

}

Once I have the display method created and saved directly under the table definitions then I head over to my Report.

Under the “design” of your report you create a new “real” form control.

Now set your form control properties as follow:

  • Table = “VendPackingSlipTrans”
  • DataMethod = “unitPrice”

Finally you hit Save & Compile and there you go!

 

You can come back from retirement tooooo

Share the joy
  • 7
  • 15
  •  
  •  
  •  

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2026 Tubbergh.com | WordPress Theme: Annina Free by CrestaProject.
css.php