Wednesday, December 31, 2014

Debug/Test SSRS report in AX 2012

People came across issues like report is not showing data on report or data is not per their expectation. It is really hard to judge where it goes wrong and what needs to be correct in which class RDP, Contract, UI or Controller.

Following sample job can be used to debug SSRS report processing data and lead to find what goes unexpected. For more information about classes and table used in this example please read my previous post

static void FF_ReportDPTest(Args _args)
{
    // temp table declaration
    FF_ReportTmpTable       ffReportTmp;
    // RDP class binded with FF_Report
    FF_ReportDP             dataProvider = new FF_ReportDP();
    // Contract class for report parameters
    FF_ReportContract       contract = new FF_ReportContract();
   
    // Parameters for reports   
    FreeText                companyName;
    CustAccount             customerAccount;
   
    // set parameters to contract class
    contract.parmCompany(companyName);
    contract.parmCustomerAccount(customerAccount);

    // set contract parameters to RDP class
    dataProvider.parmDataContract(contract);
   
    // call Data provider class to process report.
    dataProvider.processReport();
   
    // retrieve data from RDP class into temp table
    ffReportTmp = dataProvider.getFF_ReportReportTmp();

    // select data from temp table for testing purpose.   
    while select ffReportTmp
    {
        info(ffReportTmp.AccountNum);
    }

}