Vakhtang
Vakhtang

Reputation: 51

How to make a relation between the tables Axapta

I have a one Grid with Company's names (MyCompanyTable with fields companyName, companyId) and another Grid with itemId, ItemName and companyId (MyProductTable). So, I need when I select a record (company) in first Grid to show the selected company's Items in the second Grid. How is it possible? thanks.

Upvotes: 0

Views: 1536

Answers (1)

Klaas Deforche
Klaas Deforche

Reputation: 1151

You just need to add a relation on the MyProductTable that points the companyId field to the companyId of the MyCompanyTable. Then on the form, add the two datasources and set the joinsource of the MyProductTable data source to the MyCompanyTable datasource. Set the datasource of one grid to the header datasource and the data source of the second to the line datasource. Ax should automatically filter the records in the second grid based on the selection in the first.

When working with AX 2012, it is better to create a relation using the refrecid type. Create a data type that extends refrecid. Set the reference table to MyCompanyTable, then add a relation on the data type to MyCompany.recid. Next, add this field to the MyProductTable table. Ax should automatically ask if a relation should be added, choose yes. Then the steps are the same.

Upvotes: 1

Related Questions