Friday, 23 January 2015

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();
}

No comments:

Post a Comment