Hi ,
Today i would like to share you how to group the field value in Lookup in Ax 2009
Example:
In Customer Table each Customer belongs to at-least one Customer Group.
For an example , Customer Group : India has three customer (Cust-001,cust-002 and cust-003)
Here is a piece of code , how to group the CustGroup Field from CustTable
Coding:
public void lookup()
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(CustTable), this);
;
sysTableLookup.addLookupfield(fieldNum(CustTable, CustGroup));
queryBuildDataSource = query.addDataSource(tableNum(CustTable));
queryBuildDataSource.addSortField(fieldnum(CustTable, CustGroup));
queryBuildDataSource.addOrderByField(fieldnum(CustTable, CustGroup));
queryBuildDataSource.orderMode(OrderMode::GroupBy);//Used to Group the Field Value
sysTableLookup.parmQuery(query);
SysTableLookup.parmUseLookupValue(false);
sysTableLookup.performFormLookup();
}
Before Using Lookup Method
After using Lookup Method
Happy Daxing.......
Today i would like to share you how to group the field value in Lookup in Ax 2009
Example:
In Customer Table each Customer belongs to at-least one Customer Group.
For an example , Customer Group : India has three customer (Cust-001,cust-002 and cust-003)
Here is a piece of code , how to group the CustGroup Field from CustTable
Coding:
public void lookup()
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(CustTable), this);
;
sysTableLookup.addLookupfield(fieldNum(CustTable, CustGroup));
queryBuildDataSource = query.addDataSource(tableNum(CustTable));
queryBuildDataSource.addSortField(fieldnum(CustTable, CustGroup));
queryBuildDataSource.addOrderByField(fieldnum(CustTable, CustGroup));
queryBuildDataSource.orderMode(OrderMode::GroupBy);//Used to Group the Field Value
sysTableLookup.parmQuery(query);
SysTableLookup.parmUseLookupValue(false);
sysTableLookup.performFormLookup();
}
Before Using Lookup Method
After using Lookup Method
Happy Daxing.......
No comments:
Post a Comment