Query to display interval data (sales order, customer, etc.)

Hi all,

I’m newbie in AX. I’m confused how to make report to display interval data. for example, report to display sales order between Jan 1st and Jan 15th.

Please help me what I have to do with report, query or whatever… thanks a lot…

Bing Lie

i think you don’t need this, because user can do this filter by click Select Button on the report query.

In case you want to learn how to pass special parameters to report, you can take a look at Tutorial_Report in AOT or tutorial_RunBaseReport project.

Hope this help.

Hi Bing

Basically this is what you do!

owerwrite the dialog method like this

public Object dialog(Object _dialog)
DialogRunBase dialog;
TransDate tmpFromDate, tmpToDate;

dialog = super(_dialog);
tmpFromDate= prevMth(today());
tmpToDate = today();

dialog.addGroup(“Trans date”);

dialogFromDate = dialog.addFieldValue(typeid(fromDate),tmpFromDate,“From Date”);
dialogToDate = dialog.addFieldValue(typeid(toDate), tmpToDate, “To Date”);

return dialog;

create a new method to take care of the selected values from the user:

public boolean getFromDialog()
boolean ret;

fromDate = dialogFromDate.value();
toDate = dialogToDate.value();

ret = true;
return ret;

Owervrite the fetch() method to reflect the data selection on what the user entered:

public boolean fetch()
boolean ret = true;
QueryRun qr;

qr = new QueryRun(element);

if(qr.prompt() && element.prompt())
inventTable = qr.get(tablenum(InventTable));
salesOrderEntryStatistics = qr.get(tablenum(SalesOrderEntryStatistics));

if(salesOrderEntryStatistics.TransDate >= fromDate
&& salesOrderEntryStatistics.TransDate <= toDate)

ret = false;

return ret;

Thats in a nutshell how you do it, no sweet! offcoarse it can be varied endless.