How to pass parameter to SSRS report from Dynamics AX

The below code for Passing parameters to SSRS using X++ code.

 

    MenuFunction SSRS_MyReport;

    Args Args;

    str parmId ="";

    ;

   // create reference to menu item “OverTime” which is in AOT
    SSRS_MyReport = new MenuFunction(menuItemOutputStr(OverTime),MenuItemType::Output);

    Args = new Args();

    // Set parameters and parameter value
    // I have 3 Parameters Nationality, EmplGroup, PeriodID

    parmId = "Nationality=KSA&EmplGroup=HERD&PeriodID=2014_05";

    // Assign parameters to report
    Args.parm(parmId);

    // Run the report
    SSRS_MyReport.run(Args);

 

 

Notes:

1- Parameters name is case sensitive, so it should set name as predefined in report.

2- You can pass more than one parameters by add “&”   between each parameter.

3- Not add space between parameters, it cause an error

No comments:

Post a Comment