Dear All,
I did lookup in dialog in AX 2009. It's working properly.
![]()
Class declaration :
class TM_Deduction extends RunBase
{
Dialog dlg;
DialogField dialogDeductionCode;
ACXPay_AllowanceDeductionNo deductionCode;
}
Dialog :
protected Object dialog(DialogRunbase dialog, boolean forceOnClient)
{
;
dlg = super(dialog, forceOnClient);
dlg.caption('List of deduction');
dialogDeductionCode = dlg.addField(typeid(ACXPay_AllowanceDeductionNo), "Deduction code");
return dlg;
}
dialogPostRun() :
public void dialogPostRun(DialogRunbase dialog)
{
;
super(dialog);
dialog.dialogForm().formRun().controlMethodOverload(true);
dialog.dialogForm().formRun().controlMethodOverloadObject(this);
}
void Fld1_1_lookup()
{
FormStringControl control = dlg.formRun().controlCallingMethod();
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
SysTableLookup sysTableLookup =
SysTableLookup::newParameters(tableNum(ACXPay_AllowanceDeduction), control);
;
qbds = query.addDataSource(tablenum(ACXPay_AllowanceDeduction));
sysTableLookup.addLookupField(fieldNum(ACXPay_AllowanceDeduction, AllowanceDeductionNo));
sysTableLookup.addLookupField(fieldNum(ACXPay_AllowanceDeduction, Name));
qbr = qbds.addRange(fieldnum(ACXPay_AllowanceDeduction, AllowanceDeductionType));
qbr.value(enum2str(ACXPayAllowanceDeduction::Deduction));
qbr = qbds.addRange(fieldnum(ACXPay_AllowanceDeduction, Priority));
qbr.value('2');
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
Pack() :
container pack()
{
return [deductionCode];
}
UnPack() :
boolean unpack(container _packedValues)
{
[deductionCode] = _packedValues;
return true;
}
main() :
static void main(Args args)
{
TM_Deduction deduction;
;
deduction = new TM_Deduction();
if(deduction.prompt())
{
deduction.run();
}
}
Note : I searched in google and build this lookup for dialog.
I have 3 queries :
1. How Fld1_1 is identify by dialog? Where i am getting Fld1_1 value for dialog field?
If i have 3 dialog fields then it will be Fld1_2,Fld1_3... . Is't correct?
2. in AX 2012 R3 is there any replacement for Fld1_1?
3. What is role of dialogPostRun() ?
Please give me more shed on this.
Thanks!
Arpan Sen