1.Create a Form and add three fields in design node (Cust_acc , SalesId ,Itemid with their respective EDT)
Important Note: Form without datasource (it is possible)
2.Declare the multiselect buffer in class declaration
public class FormRun extends ObjectRun
{
SysLookupMultiSelectCtrl sysLookupMultiSelectCtrl;
}
3.Create init method in form method
public void init()
{
Query query = new Query();
QueryBuildDataSource qbds; //SysLookupMultiSelectCtrl msCtrlCust;
super();
qbds = query.addDataSource(tableNum(CustTable)); //qbds = query.addDataSource(tableNum(SalesLine));
qbds.fields().addField(fieldNum(CustTable,AccountNum));
sysLookupMultiSelectCtrl = SysLookupMultiSelectCtrl::constructWithQuery(element, Cust_Account, query);
}
4.create modified method in custaccount field in design node
public boolean modified()
{
boolean ret;
ret = super();
Sales_Id.lookup();
return ret;
}
5.Next in SalesId field create lookup method
public void lookup()
{
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
str txt;
//
qbds = query.addDataSource(tableNum(SalesTable)); qbds.fields().addField(fieldNum(SalesTable, SalesId)); qbds.fields().addField(fieldNum(SalesTable, CustAccount));
qbds.fields().dynamic(NoYes::No);
qbr = qbds.addRange(fieldNum(SalesTable, CustAccount));
qbr.value(Cust_Account.valueStr());
txt = strReplace(Cust_Account.valueStr(),";",",");
qbr.value(txt);
SysLookupMultiSelectCtrl::constructWithQuery(element, Sales_Id, query);
}
6.Create lookup method in ItemId field
public void lookup()
{
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
str txt;
qbds = query.addDataSource(tableNum(SalesLine));
qbds.fields().addField(fieldNum(SalesLine, ItemId));
qbds.fields().addField(fieldNum(SalesLine, SalesId));
qbds.fields().dynamic(NoYes::No);
qbr = qbds.addRange(fieldNum(SalesLine, SalesId));
qbr.value(Sales_Id.valueStr());
txt = strReplace(Sales_Id.valueStr(),";",",");
qbr.value(txt);
SysLookupMultiSelectCtrl::constructWithQuery(element, Item_Id, query);
}
7.Add modified method in same SalesId field
public boolean modified()
{
boolean ret;
ret = super();
Item_Id.lookup();
return ret;
}
It will be filtered according to the custaccount next salesid and item id
Important Note: Form without datasource (it is possible)
2.Declare the multiselect buffer in class declaration
public class FormRun extends ObjectRun
{
SysLookupMultiSelectCtrl sysLookupMultiSelectCtrl;
}
public void init()
{
Query query = new Query();
QueryBuildDataSource qbds; //SysLookupMultiSelectCtrl msCtrlCust;
super();
qbds = query.addDataSource(tableNum(CustTable)); //qbds = query.addDataSource(tableNum(SalesLine));
qbds.fields().addField(fieldNum(CustTable,AccountNum));
sysLookupMultiSelectCtrl = SysLookupMultiSelectCtrl::constructWithQuery(element, Cust_Account, query);
}
4.create modified method in custaccount field in design node
public boolean modified()
{
boolean ret;
ret = super();
Sales_Id.lookup();
return ret;
}
5.Next in SalesId field create lookup method
public void lookup()
{
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
str txt;
//
qbds = query.addDataSource(tableNum(SalesTable)); qbds.fields().addField(fieldNum(SalesTable, SalesId)); qbds.fields().addField(fieldNum(SalesTable, CustAccount));
qbds.fields().dynamic(NoYes::No);
qbr = qbds.addRange(fieldNum(SalesTable, CustAccount));
qbr.value(Cust_Account.valueStr());
txt = strReplace(Cust_Account.valueStr(),";",",");
qbr.value(txt);
SysLookupMultiSelectCtrl::constructWithQuery(element, Sales_Id, query);
}
6.Create lookup method in ItemId field
public void lookup()
{
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
str txt;
qbds = query.addDataSource(tableNum(SalesLine));
qbds.fields().addField(fieldNum(SalesLine, ItemId));
qbds.fields().addField(fieldNum(SalesLine, SalesId));
qbds.fields().dynamic(NoYes::No);
qbr = qbds.addRange(fieldNum(SalesLine, SalesId));
qbr.value(Sales_Id.valueStr());
txt = strReplace(Sales_Id.valueStr(),";",",");
qbr.value(txt);
SysLookupMultiSelectCtrl::constructWithQuery(element, Item_Id, query);
}
7.Add modified method in same SalesId field
public boolean modified()
{
boolean ret;
ret = super();
Item_Id.lookup();
return ret;
}
It will be filtered according to the custaccount next salesid and item id