Hi Experts,
I have a very similar requirement for a dialog like in class HCMDueCertificateUI builder which extends from SrsReportDataContractUIBuilder, however my dialog is in myCustomClass which extends from Runbase.
So i tried mimicking the code as much as possible.
Requirement are the following.
1.Present user with option to use date range or a specific date in dialog
2.Whnever dialog loads up it initialize with last used values
3.myCustomClass has populateTmpTable method which uses above dates in its query to populate tmp table, the poulate tmp table form at its init level calls this method .
Issue with current code
1. Do not see dialog loading with previous used values.
2. Whenever it goes at forminit level in call stack all dialog values become 0 ,most probably it has to do with me initiating new instance of myCustomClasss at form init level , pls suggest fix for fixing these 2 issues.
Code
Class declaration myCustomClass DialogField dlgFromDate,dlgToDate,dlgPayRollDate; MyTmpTable mytmptable; TransDate fromDate,toDate,payRollDate; DialogGroup mainGroup; DialogGroup dateRange; DialogGroup payRollDateGrp; #DEFINE.CurrentVersion(1) #LOCALMACRO.currentlist fromDate, toDate, payRollDate #ENDMACRO public Object Dialog() { FormButtonControl commandButtonOK, commandButtonCancel; DialogRunbase dialog; #define.Raised3D(3) #define.OKButton('CommandButton') #define.CancelButton('CommandButtonCancel') #define.QueriesGroup('QueriesGroup') ; dialog = super(); dialog.caption( 'Generate '); dialog.allowUpdateOnSelectCtrl(true); commandButtonOK = dialog.dialogForm().form().design().control(#OKButton); if (commandButtonOK) { commandButtonOK.helpText("@SYS57795"); } commandButtonCancel = dialog.dialogForm().form().design().control(#CancelButton); if (commandButtonCancel) { commandButtonCancel.helpText("@SYP4889653"); } mainGroup = dialog.addGroup("Choose date range or payroll date"); dateRange = dialog.addGroup("@SYS41297", mainGroup); dateRange.frameOptionButton(FormFrameOptionButton::Radio); dlgFromDate = dialog.addField(extendedTypeStr(TransDate),"@SYS5209"); dlgToDate = dialog.addField(extendedTypeStr(TransDate),"@SYS35904"); payRollDateGrp = dialog.addGroup("Payroll date", mainGroup); payRollDateGrp.frameOptionButton(FormFrameOptionButton::Radio); dlgPayRollDate = dialog.addField(extendedTypeStr(TransDate),"Payroll date"); return dialog; } public boolean getFromDialog() { boolean ret; MyPeriodType myPeriodType; FormGroupControl PeriodTypeLocal; PeriodTypeLocal = dateRange.control(); if (PeriodTypeLocal.optionValue()) { myPeriodType = MyPeriodType::RangeBased; fromDate = dlgFromDate.value(); toDate = dlgToDate.value(); } else { myPeriodType = MyPeriodType::DateBased; payRollDate = dlgPayRollDate.value(); } this.initializeFields(); ret = super(); return ret; } public void initializeFields() { boolean isRangeBased; dateRange.optionValue(isRangeBased); payRollDateGrp.optionValue(!isRangeBased); if(payRollDateGrp.optionValue()==true) { dlgFromDate.value(dateNull()); dlgToDate.value(dateNull()); } if(dateRange.optionValue()==true) { dlgPayRollDate.value(""); } } public MyTmpTable populatemyTmpTable() { insert_recordset myTmpTable(fie names f1,f2,f3) select sum(amt),f1,f2,f3,f4 from myTmpTable group by f1,f2,f3,f4 where (myTmpTable.PayrollDate == payRollDate ||(myTmpTable.PayrollDate >= fromDate && myTmpTable.PayrollDate <=toDate)) // this is where my dialog date become criteria for inserting data into tmp table & while debugging it shows 0 even after choosing values in dialog } FORM INIT METHOD public void init() { MyCustomClass myCustomClass = new MyCustomClass(); super(); myTmpTable = myCustomClass.populatemyTmpTable(); MYTmpTable.linkPhysicalTableInstance(myTmpTable); }