Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

not able to pass two design in controller

(0) ShareShare
ReportReport
Posted on by 1,479
i want to pass two design in controller but not able to pass i am using if statement but when i declare contract it gives me error plz suggest me how can i get this done
  • Martin Dráb Profile Picture
    Martin Dráb 230,962 Most Valuable Professional on at
    not able to pass two design in controller
    Good! Please don't forget to verify the answer.
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,479 on at
    not able to pass two design in controller
    hi martin,
    i will definately follow the steps you mention below ,new code is working
     
    thanks ,
    regards,
    dinesh
  • Martin Dráb Profile Picture
    Martin Dráb 230,962 Most Valuable Professional on at
    not able to pass two design in controller
    Regarding your new code, does it work now or do you have a problem with it that you forgot to mention?
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,962 Most Valuable Professional on at
    not able to pass two design in controller
    Please do a few things before asking others:
     
    1) Compile your code. If it fails to compile, don't both trying to run it. Read the error message and fix the problem. If you don't know how to do it, tell us what are you getting and where. In your case, you're setting reportName variable which you never declared.
     
    2) Run your code. If you get an exception, look at the error message and the place where it occurred. If you can't solve it, share both pieces of information with us.
    If the error is "Object reference not set to an instance of an object", as you'd get if your code run at all, you probably made your common mistake - you didn't assign any value to the variable. That's the case of your contract variable. You shouldn't need us pointing to this bug every time.
     
    3) Review your code. For example, ask yourself what your code does with the value of reportName variable. If you just put a value and never use it for anything, it's not surprising that it doesn't have any effect.
     
    4) Debug your code to see where it fails. When you see that, you may be able to resolve the problem by yourself, and if you need someone's help, you'll have more detailed information to share.
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,479 on at
    not able to pass two design in controller
    thanks girish ,
    i have written like this
       protected void preRunModifyContract()
        {
            super();
            DTCustTransOpenPerDateContract contract = this.parmReportContract().parmRdpContract() as DTCustTransOpenPerDateContract;
    
            if(contract.parmSummarizeBy() == DTSummerizeBy::Worker)
            {
                if(contract.parmDetailsReport() == NoYes::yes)
                {
                    this.parmReportContract().parmReportName(ssrsReportStr(DTCustTransOpenPerDate,ReportByWorker));
                }
                else
                {
                    this.parmReportContract().parmReportName(ssrsReportStr(DTCustTransOpenPerDate,SummerizeByWorker ));
                }
            }
            else if(contract.parmSummarizeBy() == DTSummerizeBy::Customer)
            {
                if(contract.parmDetailsReport() == NoYes::yes)
                {
                    this.parmReportContract().parmReportName(ssrsReportStr(DTCustTransOpenPerDate,ReportByCustomer ));
                }
                else
                {
                    this.parmReportContract().parmReportName(ssrsReportStr(DTCustTransOpenPerDate,SummerizeByCustomer ));
                }
            }
        }
     
  • Verified answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    not able to pass two design in controller
    Code seems to be wrong - You need to add the code in the preRunModifyContract method.
    Refer to the below blog.
     
    Thanks,
    Girish S.
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,479 on at
    not able to pass two design in controller
    i was trying to pass two design in controller using if condition my code is below but when i run the report iget object refrence is not set to instance of object
     
     public static DTCustVendTransOpenPerDateController construct(Args _args)
        {
            DTCustVendTransOpenPerDateController controller = new DTCustVendTransOpenPerDateController();
           DTCustVendTransOpenPerDateContract   contract ;
            controller.parmReportName(ssrsReportStr(DTCustTransOpenPerDate, ReportByCustomer));
            
            if( contract.parmDetailReport() == NoYes::yes)
            {
                reportName = ssrsReportStr(DTCustTransOpenPerDate, ReportByCustomer);
            }
            else
            {
            //    reportName = ssrsReportStr(DTCustTransOpenPerDate, SummerizeByCustomer);
            }
            controller.parmArgs(_args);
    
            return controller;
        }
     
     
  • Martin Dráb Profile Picture
    Martin Dráb 230,962 Most Valuable Professional on at
    not able to pass two design in controller
    Please tell us what you're trying to achieve, what error you get and where and show us your code.
  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    not able to pass two design in controller
    Hi Dinesh,
     
    What error you got?
    Can you share the code with us?
     
    Thanks,
    Girish S.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,162 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans