Form as field look up in another form
A new field is added and that should show a already created form as its lookup.
Create a new form with datasources and design.
In design properties give window type-content page, style- lookup
public void lookup()
{
SysTableLookup sysTableLookup ;
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
DimensionValue value;
Args args;
FormRun formRun;
;
args = new Args();
args.name("HcmWorkerEligibleLookup");
args.record(PurchReqTable);
args.parmEnum(NoYes::Yes); //
args.caller(this); //
formRun = classFactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.detach();
this.performFormLookup(formRun);
}
In the created form init method give
public void init()
{
super();
this.selectmode(formname_field from datasource to be shown in the lookup
eg: this.selectMode(HcmWorkerEligibleTable_EmplName);
}
//////////////////////////////////////
USe this method for the lookup field.
For the new field methods take a new lookup override method and give the following code.
public void lookup()
{
//super();
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(custTable),this);
sysTableLookup.addLookupfield(fieldNum(CustTable, AccountNum));
//sysTableLookup.addLookupfield(fieldNum(CustTable, AccountStatement));
queryBuildDataSource = query.addDataSource(tableNum(CustTable));
queryBuildRange = queryBuildDataSource.addRange(fieldNum(CustTable, AccountNum));
queryBuildRange.value('');
sysTableLookup.parmquery(query);
sysTableLookup.performFormLookup();
}
Comments
Post a Comment