get last saved dialog of values
below as X++ Code remark by the Class and report.
write down : Jimmy on September 07th 2010
1)Class
class QVS_SalesMarginReportNew extends RunBaseReport { DialogField dlg_FromDate; DialogField dlg_ToDate; FromDate FromDate; ToDate ToDate; #DEFINE.CurrentVersion(1) #LOCALMACRO.CurrentList FromDate,ToDate #ENDMACRO } public Object dialog() { DialogRunbase dialog; ; dialog = super(); dialog.addGroup("@SDL1404"); dlg_FromDate = dialog.addFieldValue(TypeId(FromDate),FromDate); dlg_ToDate = dialog.addFieldValue(TypeId(ToDate),ToDate); return dialog; } public boolean getFromDialog() { ; FromDate = dlg_FromDate.value(); ToDate = dlg_ToDate.value(); return true; } public container pack() { ; return [#CurrentVersion, #CurrentList]+[super()]; } public boolean unpack(container packedClass) { container base; boolean ret = false; Integer version = conPeek(packedClass,1); switch (version) { case #CurrentVersion: [version, #CurrentList, base] = packedClass; ret = super(base); break; } return ret; }
2)Report
public class ReportRun extends ObjectRun { DialogField dlgFromDate; DialogField dlgToDate; FromDate FromDate; ToDate ToDate; #define.CurrentVersion(1) #localmacro.CurrentList FromDate, ToDate #endmacro } public Object dialog(Object _dialog) { DialogRunbase dialog = _dialog; ; dialog.addGroup("Period Date"); dlgFromDate = dialog.addFieldValue(TypeId(FromDate),FromDate); dlgToDate = dialog.addFieldValue(TypeId(ToDate),ToDate); return dialog; } public boolean getFromDialog() { ; FromDate = dlgFromDate.value(); ToDate = dlgToDate.value(); return true; } public container pack() { ; return [#CurrentVersion, #CurrentList]; } public boolean unpack(container packedClass) { boolean ret; Integer version = RunBase::getVersion(packedClass); switch (version) { case #CurrentVersion: [version, #CurrentList] = packedClass; ret = true; break; default: ret = false; } return ret; }