Home Ask Login Register

Developers Planet

Your answer is one click away!

codemann8 February 2016

Get dialog result of SSRS parameter form

From a report controller object, I'm trying to figure out how to find out if the user has canceled the SSRS report dialog screen or if they hit OK.

In AX, I'm trying to write a controller that will execute two different designs of the same report object, both will use the same contract (parameters). So far I have this code:

cusController controller;
cusContract   contract;

//Run Format 1
controller = new cusController();
controller.initController(_args);
controller.parmReportName(ssrsReportStr(cusReport, Format1));
controller.parmShowDialog(true);
controller.startOperation();

//Run Format 2
contract = controller.parmReportContract().parmRdpContract() as cusContract;
contract.parmFormat(cusReportFormat::Format2);
controller = new cusController();

controller.initController(_args);
controller.parmReportName(ssrsReportStr(cusReport, Format2));
controller.parmShowDialog(false);
controller.parmReportContract().parmRdpContract(contract);
controller.startOperation();

The above works perfect when the user enters in parameters and hits OK. However, when the user hits Cancel the first report cancels, but since the second report has parmShowDialog(false), it doesn't know the first report was canceled. Any ideas on how to capture the Cancel from the first report?

Answers


Alex Kwitny February 2016

Depending on what your controller class extends, I think you would do something like this. I've seen it done a ton of different ways:

    SysOperationStartResult         result;

    // Method 1
    result = controller.startOperation();
    if (result == SysOperationStartResult::Started ||
        result == SysOperationStartResult::AddedToBatchQueue)
    {
        info("They clicked ok");
    }

    // Method 2
    if (controller.prompt())
    {
        controller.run();
        info("They clicked ok");
    }

Post Status

Asked in February 2016
Viewed 2,564 times
Voted 10
Answered 1 times

Search




Leave an answer


Quote of the day: live life