Testing and Debugging an SSRS Report Data Provider

Thursday, 22 October 2015

Most of the more complex AX2012 reports are built using a report data provider, but these can be pretty hard to debug, as they run in a separate session via the report server. To work out why your report doesn’t contain any data, or doesn’t have the data you expect, its nice to be able to run through it in the debugger.

A simple job can help you out here. You just need the contract and data provider, and you can fill in the contract objects like you might do in a controller.

static void FdyGoodsInwardAdviceReportTestJob(Args _args)
    FdyGoodsInwardAdviceContract    contract    = new FdyGoodsInwardAdviceContract();
    FdyGoodsInwardAdviceDP          dp          = new FdyGoodsInwardAdviceDP();
    FdyGoodsInwardAdviceTmp         tempTable;

    // set required parameters on the contract

    // pass the contract to the data provider and run

    // get the data (using the appropriate dataset method!)
    tempTable   = dp.getReportData();

    while select tempTable
        info(strFmt("%1", tempTable.RecId)); // or something more useful!

In this data provider, I’m looking at a combination of different data sources - rather than everything coming in through a VendPackingSlipTrans record - so there is a data provider to link the stock transactions to the various different entities.