Lookup method with filter
Class NGHcmWorkerTransferFrm_ReasonCodeCtrlEventhandler
{
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormControlEventHandler(formControlStr(HcmWorkerTransfer, NewReasonCode), FormControlEventType::Lookup)]
public static void NewReasonCode_OnLookup(FormControl sender, FormControlEventArgs e)
{
SysReferenceTableLookup sysTableLookup = SysReferenceTableLookup::newParameters(tableNum(HcmReasonCode), sender);
Query query;
QueryBuildDataSource qbds;
QueryBuildRange qbrTerminate,qbrResignation;
FormReferenceGroupControl actionState = sender.formRun().design(0).controlName(formControlStr(HcmWorkerTransfer,HcmActionState_ActionTypeSetup));
FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs;
sysTableLookup.addLookupfield(fieldNum(HcmReasonCode, ReasonCodeId));
sysTableLookup.addLookupfield(fieldNum(HcmReasonCode, Description));
query = new Query();
qbds = query.addDataSource(tableNum(HcmReasonCode));
qbrTerminate = qbds.addRange(fieldNum(HcmReasonCode, IsTerminationApplicable));
qbrResignation = qbds.addRange(fieldNum(HcmReasonCode, IsResignationApplicable));
if(HcmActionTypeSetup::find(actionState.value()).ActionType == HcmActionType::NGEmployeeFFDemise)
{
qbrTerminate.value(queryValue(NoYes::Yes));
}
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
if(ce)
{
ce.CancelSuperCall();
}
}
Comments
Post a Comment