AX 2012: Display methods – Different datasources – Same control

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. CustTable
2. DirPartyTable
3. BankGroup

If we need to show CustTable.AccountNum, DirPartyTable.Name and BankGroup.Name fields on the same control let’s say a grid control then we need to define the following display methods on CustTable if we have chosen CustTable as the grid’s datasource.

To retrieve DirPartyTable.Name

Untitled

To retrieve BankGroup.Name

Untitled

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

Untitled

The result is awesome. You have one grid control showing data from different datasources!

Untitled

Advertisements