Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Unanswered

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..

  • 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(); }

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,986 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,588 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans