Hi guys, To day we see How to create lookup in AX 2012 X++
Lookup created in multiple ways
1.Table Relations
2.EDT Relations.
3.Override Lookup method(using SysTableLookup Class).
To day we see Override Lookup method
Write the Below code in Lookup Method:
Without Adding Dynamic Query (no filtering):
Public void lookup()
{
SysTableLookup syslookup;//class
syslookup= SysTableLookup::newParameters(tableNum(CustTable),this);
syslookup.addLookupfield(fieldNum(CustTable,AccountNum));
syslookup.performFormLookup();
}
With dynamic Query:
Public void lookup()
{
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
SysTableLookup syslookup;//class
syslookup= SysTableLookup::newParameters(tableNum(CustTable),this);
syslookup.addLookupfield(fieldNum(CustTable,AccountNum));
syslookup.addLookupfield(fieldNum(CustTable,CustGroup));
qbds=query.addDataSource(tableNum(CustTable));
qbr=qbds.addRange(fieldNum(CustTable,custgroup));
qbr.value('10');
//qbr.value(SysQuery::value());// Enum type
syslookup.parmQuery(query);
syslookup.performFormLookup();
}
OUPUT:
Keep Daxing !!
No comments:
Post a Comment