1. Lookup method we can write at table level, form Data source level and Form control level.
Now writing at Data source level(Form: Organization hierarchy, Table: Organization hierarchy)
public void lookup(FormControl _formControl, str _filterStr)
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(DivisionTable), _formControl);
Query query = new Query();
QueryBuildDataSource qbds,qbds1;
sysTableLookup.parmQuery(query);
sysTableLookup.addLookupField(fieldNum(DivisionTable, DivisionCode));
sysTableLookup.addLookupField(fieldNum(DivisionTable, DivisionName));
qbds = Query.addDataSource(tableNum(DivisionTable));
qbds1 = qbds.addDataSource(tableNum(DivisionCompanyLine));
qbds1.relations(true);
qbds1.addRange(fieldNum(DivisionCompanyLine, DataArea)).value(OrganizationHierarchy.Company);
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
2. Writing jumpref() at Form DS level
public void jumpRef()
{
Args args;
MenuFunction menuFunction;
;
args = new Args();
menuFunction = new MenuFunction(menuitemDisplayStr(MenuItemName), MenuItemType::Display);
args = new Args(menuFunction.object());
args.caller(element);
menuFunction.run(args);
}
Now writing at Data source level(Form: Organization hierarchy, Table: Organization hierarchy)
public void lookup(FormControl _formControl, str _filterStr)
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(DivisionTable), _formControl);
Query query = new Query();
QueryBuildDataSource qbds,qbds1;
sysTableLookup.parmQuery(query);
sysTableLookup.addLookupField(fieldNum(DivisionTable, DivisionCode));
sysTableLookup.addLookupField(fieldNum(DivisionTable, DivisionName));
qbds = Query.addDataSource(tableNum(DivisionTable));
qbds1 = qbds.addDataSource(tableNum(DivisionCompanyLine));
qbds1.relations(true);
qbds1.addRange(fieldNum(DivisionCompanyLine, DataArea)).value(OrganizationHierarchy.Company);
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
2. Writing jumpref() at Form DS level
public void jumpRef()
{
Args args;
MenuFunction menuFunction;
;
args = new Args();
menuFunction = new MenuFunction(menuitemDisplayStr(MenuItemName), MenuItemType::Display);
args = new Args(menuFunction.object());
args.caller(element);
menuFunction.run(args);
}
No comments:
Post a Comment