Tuesday, 29 March 2016

Add Multiple table lookup in Ax 2012

1. Firstly create a View.
AOT>DataDictionary>View>Create View
2. Drag n drop Multiple tables
AOT>DataDictionary>View>Create View > sample View > dataSource> Sample Table1 > DataSource > Sample Table2
3. Drag Fileds from Both Table in Field Node.
AOT > Data Dictionary > View > sample View > Field Node > Drang n drop fileds
4. now save it.
5. Create Form.
6. In design node, create String Edit Control.
7. Write below code in lookup method of that control.
Public Void lookup()
{
Query query = new Query();
Systablelookup systablelookup;
QueryBuildDataSource Qbds;
systablelookup = Systablelookup::newParameters(tablenum(sampleView),Form_Control_name);
Qbds= query.addDataSource(tablenum(sampleView));
systablelookup.addLookupField(fieldNum(sampleView, field1));
systablelookup.addLookupField(fieldNum(sampleView, field2));
systablelookup.addLookupField(fieldNum(sampleView, field3));
systablelookup.parmquery(query);
systablelookup.performFormLookup();
}

2 comments:

  1. Its is a prefect example for what you want from a single table but if you want to show field from multiple tables you can do it. for example please refer to: https://360dynamics.blogspot.com/2017/10/multi-table-lookup-display-fields-from.html

    ReplyDelete
  2. Thank You and I have a neat provide: planning a kitchen remodel

    ReplyDelete