Wednesday 20 February 2013

Display Methods in Ax 2012


Display Methods :


These methods are commonly used while performing a calculation or to lookup fields from another table. The
Display modifier is added before the method name that shows that the methods return value is to be displayed on forms and reports.






Please note that the return type of a display method should be of type EDT.

Usage:


The Display modifier can be used on .


  • Table methods.
  • Form methods.
  • Form datasource methods.
  • Report methods.
  • Report design methods.
Avoid complex calculations on display methods because they are called each time a form is redrawn.

I will be demonstrating the usage of display methods  by a quick example.

  • Add a display method to lookup fields from another table on a form datasource.





  • This is how the method looks.

















As , you can see the methods lookup WorkItemType from another table that is'nt available under the datasource node of this form.


  • Add the display method to a form control.


















  • Change the Data source and Data method properties of the control as follows.










It's better to write Display methods on the table level so that the same method can be used on multiple forms and reports where the table is used as a Datasource.

If the value returned is to be shown in a grid then the Display method must be written on the form datasource level as shown in our example above.

I believe it was useful ..



2 comments:

Juan Ringgit said...

I will try this first if it is working. I am new in AX Dynamics. :)

Naresh said...

If the value returned is to be shown in a grid then the Display method must be written on the Table Level,other wise it will display same value for all the records in the grid

Post a Comment