To filter second datasource on enum value in execute query method of first data source
Hi all ,
We have a requirement to filter the data source on execute query on the bses of enum value.
[ExtensionOf(formDataSourceStr(HcmWorkerActionDetail,HcmActionState))]
Final class NGHcmWorkerActionDetailFrm_HcmActionStateDS_Extension
{
public void executeQuery()
{
QueryBuildDataSource qbds;
QueryRun queryRun;
HcmActionTypeSetup HcmActionTypeSetuploc;
if(element.args().menuItemName() == menuItemDisplayStr(NGHcmWorkerActionListTransferWorker))
{
query q = new Query();
qbds = q.addDataSource(tableNum(HcmActionTypeSetup));
qbds.addRange(fieldnum(HcmActionTypeSetup,ActionType)).value(enum2Str(HcmActionType::Transfer));
queryRun = new QueryRun(q);
// Retrieves the next record from the query.
while(queryRun.next())
{
// Get Result
HcmActionTypeSetuploc = queryRun.get(tableNum(HcmActionTypeSetup));
// Flter the main data source on the bases of the refernce recid
this.query().dataSourceTable(tableNum(HcmActionState)).addRange(fieldnum(HcmActionState,ActionTypeSetup)).value(SysQuery::value(HcmActionTypeSetuploc.RecId));
}
}
next executeQuery();
}
}
Comments
Post a Comment