While creating enum multi- select lookup, there will be one temp table used for the temporary storage and below mentioned code will be added to UI Builder class:
class FRE_SyncCESalesOrderUIBuilder extends SysOperationAutomaticUIBuilder
{
DialogField salesorderid, salesstatus;
container consalesorderid, conSalesStatus;
FRE_SyncCESalesOrderContract contract;
public void postRun()
{
//super();
contract = this.dataContractObject() as FRE_SyncCESalesOrderContract;
salesorderid = this.bindInfo().getDialogField(
contract,methodStr(FRE_SyncCESalesOrderContract,parmsalesid));
salesstatus = this.bindInfo().getDialogField(
contract,methodStr(FRE_SyncCESalesOrderContract,parmsalesstatus));
salesorderid.registerOverrideMethod(
methodStr(FormStringControl, lookup),
methodStr(FRE_SyncCESalesOrderUIBuilder, salesorderidlookup),
this);
salesstatus.registerOverrideMethod(
methodStr(FormStringControl, lookup),
methodStr(FRE_SyncCESalesOrderUIBuilder, salesstatuslookup),
this);
if (salesorderid)
{
salesorderid.lookupButton(2);
}
if (salesstatus)
{
salesstatus.lookupButton(2);
}
}
private void salesorderidlookup (FormStringControl _control)
{
Query query= new Query();
QueryBuildDataSource qbds;
qbds = query.addDataSource(tableNum(SalesTable));
qbds.addSelectionField(fieldNum(SalesTable, SalesId));
SysLookupMultiSelectGrid::lookup(
query,
_control,
_control,
_control,
consalesorderid);
}
private void salesstatuslookup (FormStringControl _control)
{
Query query= new Query();
QueryBuildDataSource qbds;
FRESalesStatusTmp tmpEnumValues;
TableId multiSelectTableNum = tableNum(FRESalesStatusTmp);
container selectedFields = [multiSelectTableNum, fieldName2id(multiSelectTableNum, fieldStr(FRESalesStatusTmp, StatusLabel))];
tmpEnumValues.setTmpData(this.fillEnumTable());
qbds = query.addDataSource(tableNum(FRESalesStatusTmp));
qbds.addSelectionField(fieldNum(FRESalesStatusTmp, StatusLabel));
SysLookupMultiSelectGrid::lookup(query, _control, _control,_control, selectedFields);
}
private FRESalesStatusTmp fillEnumTable()
{
FRESalesStatusTmp enumTmp;
SysDictEnum dictEnum = new SysDictEnum(enumNum(SalesStatus));
int idx;
delete_from enumTmp;
for(idx = 1; idx < dictEnum.values(); idx++)
{
enumTmp.clear();
enumTmp.initValue();
enumTmp.StatusId = dictEnum.index2Value(idx);
enumTmp.StatusLabel = dictEnum.index2Label(idx);
enumTmp.insert();
}
return enumTmp;
}
}
HEY HEY HEY!!! HACK OF THE DAY!!
If temp table doesnt work, then try to use regular table
Comments
Post a Comment