Friday, 23 January 2015

How to add date range filter on Morphx Report in Ax 2009/12


Classdeclaration:
public class ReportRun extends ObjectRun
{
DialogField salesstatus;
DialogFIeld fromDate,toDate;
SalesTable _salesTable;
TransDate _fromDate, _toDate;
}
public Object dialog(Object _dialog)
{
Dialog dialog = _dialog ;
;
// dialog = super();
// Set a title for dialog
dialog.caption( ‘Simple Dialog’);
// Add a new field to Dialog
fromDate = dialog.addField(extendedTypeStr(TransDate), ‘From Date’ );
toDate = dialog.addField(extendedTypeStr(TransDate), ‘To Date’ );
return dialog;
————————————–
public boolean getFromDialog()
{
// Retrieve values from Dialog
_fromdate = fromdate.value();
_toDate = toDate.value();
return true;
}
————————————–
public container pack()
{
return connull();
}
————————————–
public boolean unpack(container packedClass)
{
Version version = RunBase::getVersion(packedClass);
return true;
}
———————————————
public boolean fetch()
{
boolean ret = true;
// ret = super();
while select _salesTable
where _salesTable.DeliveryDate >= _fromDate
&& _salesTable.DeliveryDate <= _toDate
element.send(_salesTable);
return ret;
}
——————————————————–

No comments:

Post a Comment