Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

How to get Parameter report use class Controller?

Posted on by 3,803

Hi master..

I have custom report with SSRS Report use class Contract, UI Builder and Data Provider.

in class Contract, i have parameter with enum type.

in ssrs report, i create 2 design with name 'TransDesign01' and 'TransDesign02'.

i want, if i run this report and in parameter i choose 'Buy' in enum type, report will run with output 'TransDesign01'.

and if i choose 'Sell' in enum type, report will run with output 'TransDesign02'.

Can i do it use class Controller? and How?

Thanks all..

*This post is locked for comments

  • Shahil Profile Picture
    Shahil 635 on at
    RE: How to get Parameter report use class Controller?

    Hi try this out:

    public static void main(Args _args)
    {
        PIL_ReksaDana_Controller controller = new PIL_ReksaDanaTransaction_Controller();
        PIL_ReksaDana_Contract  contract;
    
        controller.parmArgs(_args);
        //this sets your default report - it can be either be your Design_PIL_Reksadana1
         //or Design_PIL_Reksadana2
        controller.parmReportName(ssrsReportStr(PIL_Report, Design_PIL_Reksadana1));
    
        contract = controller.parmReportContract().parmRdpContract();
    
        if (contract.paramTransType())
        {
            controller.parmReportName(ssrsReportStr(PIL_Report, Design_PIL_Reksadana1));
        }
        else
        {
            controller.parmReportName(ssrsReportStr(PIL_Report,Design_PIL_Reksadana2));
        }
    
        controller.startOperation();
    }


  • fajar Profile Picture
    fajar 3,803 on at
    RE: How to get Parameter report use class Controller?

    Thanks Tatiana,

    But, i don't understand your code.

    Can you explain to me?

  • fajar Profile Picture
    fajar 3,803 on at
    RE: How to get Parameter report use class Controller?

    Sorry for late respond.

    i try your code like this in main method class controller :

    public static void main(Args _args)
    {
        PIL_ReksaDana_Controller     controller = new PIL_ReksaDanaTransaction_Controller();
        PIL_ReksaDana_Contract       contract;
        controller.parmArgs(_args);

        contract = controller.parmReportContract().parmRdpContract();

            if (contract.paramTransType())
            {
              controller.parmReportName(ssrsReportStr(PIL_Report, Design_PIL_Reksadana1));
            }
            else
            {
                controller.parmReportName(ssrsReportStr(PIL_Report,Design_PIL_Reksadana2));
            }

        controller.startOperation();
    }

    and then i create menu item for Object Type 'Class' and Object 'PIL_ReksaDana_Controller'

    And then i open this menu item, But i get error 'Report name is not set. Please set report name using parmReportName method.'.

     

    Please help, Thanks.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to get Parameter report use class Controller?

    you need to do it in the main method in the controller:

    Create a switch:

    Use the _args to get your enum value.

     switch (_args.dataset())

       {

           case tableNum(InventTransferTable):

               SalesConfirmController::ccc_mainTransfer(_args);

               break;

           default:

               SalesConfirmController::ccc_mainSales(_args);

    IN the CCC_MainTransfer method call the report design

       if(curext() == #ccc)

           {

               controller.parmReportName(ssrsReportStr(SalesOrderAcknowledgementReport, Report));

           }

           else if (curext() == #cce)

           {

               controller.parmReportName(ssrsReportStr(SalesOrderAcknowledgementReport, CCE_TransferReport));

           }

    And that it.

    If you need more help let me know.

  • Shahil Profile Picture
    Shahil 635 on at
    RE: How to get Parameter report use class Controller?

    You can try this in the main method of your controller

    public static void main(Args _args)
    {
            yourController = new yourController();
    
            yourController.parmArgs(_args);
            yourDPContract contract = yourController.parmReportContract().parmRdpContract();
    if (contract.parmBuyEnum()) { yourController.parmReportName(ssrsReportStr(ReportName, TransDesign01)); } else { yourController.parmReportName(ssrsReportStr(ReportName, TransDesign02)); } yourController.startOperation(); }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans