Get the underlying SSRS Report Query, reset query , add your own ranges and execute report [Dynamics AX 2012, X++]


Below is the small code snippet to get the underlying query of the SSRS report, reset query, prompt the parameters form, add our own ranges and execute the report. You can customize the job as per your requirements. Below I have used CustBaseData.Report report and added my own range on customer group.

static void SR_ResetQueries_executeReport(Args _args)


    #define.reportName(‘CustBaseData.Report’) // report Name

    QueryBuildRange queryBuildRange;

    QueryBuildDatasource queryBuildDatasource;

    SRSReportRun srsReportRun;

    Query reportRunQuery;

    srsReportRun = new SRSReportRun(#reportName);


    srsReportRun.resetQueries(); // reset the query

    reportRunQuery = srsReportRun.reportQueries().lookup(srsReportRun.currentQueryKey());

    if (srsReportRun.isInitialized() && srsReportRun.prompt()) // prompt the parameters form


        queryBuildDatasource = SysQuery::findOrCreateDataSource(reportRunQuery, tablenum(CustTable));

queryBuildRange = SysQuery::findOrCreateRange(queryBuildDatasource,  fieldnum(CustTable, CustGroup));







Happy Dax6ng,

Sreenath Reddy



3 Responses to “Get the underlying SSRS Report Query, reset query , add your own ranges and execute report [Dynamics AX 2012, X++]”

  1. Hemal Shrimarkar Says:

    Your articles are really excellent. I really admired about attitude of sharing.
    please share new idea with us:-dynamics ax consulting

  2. Hemal Shrimarkar Says:

    Thanks!!! Really you give great hint on Microsoft Dynamics AX Implementation… please share with us… I really like your blog, these information is very useful…

  3. dynamics ax consultancy Says:

    It is good to have the blogs like yours which are meaningful & have some information about the dynamic ax which is a popular stuff in terms of software. I even read your newly written blog about “How to display/show the inventory dimensions as parameters on SSRS reports [Dynamics AX 2012, X++]” which is also very nice & helpful to know about how to display the dimension as parameters. I am always looking forward to your blog so keep it continue so that we can get to know more about dynamic ax.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: