Create Simple Display method in Ax 2012

I have two tables that are

Jkrish1TablewithDispMethodBillTable

AX developers always come across a requirement of showing data from different datasources on the same control though these datasources should be related to each other. The solution to this requirement is to define display methods on the table which you choose to be the control datasource. Display methods are very handy for showing data from related tables.

Consider for example the following tables:

1.Johnkrish1

2.Bill_TableMethod

If we need to show Bill_TableMethod.ItemName field on the same control let’s say a grid control then we need to define the following display methods on Johnkrish1 Table if we have chosen Johnkrish1 as the grid’s datasource.

To retrieve Bill_TableMethod.ItemName write this code in Johnkrish1 Table Methods Node

CODE:

DispMethodCode

Now on the grid control, add  two StringEdit controls to bind them with the display methods just defined above. Make sure to specify Johnkrish1 Table as the grid’s datasource. Also you must be setting DataMethod property of the StringEdit controls to the name of the respective display methods.

DispMethodFormDispMethodProperties

Run the form now you can see the Corresponding Item Name from the Bill Table will be available in your Grid

DispMethodOutput