web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

The value "" is not in the map

(0) ShareShare
ReportReport
Posted on by 1,402

I have created a report using RDP class. I want to open it from the form LedgerJournalTable by selecting one line from grid and clicking the menu item. I have also written the controller class to achieve this, but when I click on the menu item, it gives the error that the value "" is not in the map.
After debugging, I found that this line this.setRanges(this.parmReportContract().parmQueryContracts().lookup(this.getFirstQueryContractKey())); in the function protected void prePromptModifyContract() gives the error. Please help. I have not created query and I don't want to use it.

*This post is locked for comments

I have the same question (0)
  • Fedir Kryvyi Profile Picture
    1,026 on at

    Can you please show your DP and Controller class signatures and attributes?

  • Moeen Ahmed Sultan Profile Picture
    1,402 on at

    When menu item is clicked, I want to send the argument(i.e. selected row) from controller class to the processReport() function of RDP class.
    Contract class:

    [DataContractAttribute]

    public class MCS_PaymentVoucherContract

    {

       str id;

       [DataMemberAttribute("id")]

       public str parmId(str _id = id)

       {

           id = _id;

           return id;

       }

    }

    Controller class:

    public class MCS_PaymentVoucherController extends SrsReportRunController
    {
        protected void prePromptModifyContract()
        {
            LedgerJournalTable    dataTable;
            MCS_PaymentVoucherContract contract;
            if (this.parmArgs() && this.parmArgs().record())
            {
                contract = this.parmReportContract().parmRdpContract() as MCS_PaymentVoucherContract;
                dataTable = this.parmArgs().record();
                contract.parmId(dataTable.JournalNum);
              //  info(strFmt("%1",dataTable.JournalNum));

            }

    public static void main(Args _args)
            {
                MCS_PaymentVoucherController controller = new MCS_PaymentVoucherController();
       controller.parmReportName(ssrsReportStr(MCS_PaymentVoucherReport,PaymentVoucherReportDesign));
                controller.parmArgs(_args);
                controller.parmShowDialog(false);
                controller.startOperation();
            }

    }

     

     

     

     

     

  • Fedir Kryvyi Profile Picture
    1,026 on at

    Moeen,

    I don't see the call of this line in your prePromptModifyContract() method:

    this.setRanges(this.parmReportContract().parmQueryContracts().lookup(this.getFirstQueryContractKey()));

    And also there is no super() that might be the reason for this, so I don't see the reason for this line to be called.

    Are you sure that your menu item calls you controller?

    Also, there is a missing } closing bracket but I think that this is typo

  • Verified answer
    Moeen Ahmed Sultan Profile Picture
    1,402 on at

    I am not using query that is why the setRanges could not be called. Moreover, my controller is called when Action Menu Item is clicked. So, I found a way around.

    Follow these steps to pass data between controller and RDP classes:

    1. Create a temporary table
    2. Add fields (which you want to pass between controller and RDP classes)
    3. In Controller class, get the selected line from grid using this.parmArgs().record() and fill into the temporary table.
    4. In processReport() method of RDP class, get the fields from temporary table and use it.

    If you found my answer good, mark it as verified.

  • Fedir Kryvyi Profile Picture
    1,026 on at

    How exactly are you going to pass temporary table from controller class to DP class? You will need to pack data somehow inside of DataContract class to pass it to DP, so maybe it is easier to get specific values and pack them instead of storing data inside of TMP table? You can add additional fields and parm methods to your DataContract class, set them as "Invisible" or set "ShowOnDialog" to false, and then use them in your DP. Creating a new instance of TMP table seems to be an overkill.

  • Moeen Ahmed Sultan Profile Picture
    1,402 on at

    I am not passing the whole table. I am inserting data into temp table in Controller class and when RDP class is called, it will get the data from temporary table.

    Contract Class was also not working. So, I worked around like this.

  • Fedir Kryvyi Profile Picture
    1,026 on at

    Well technically that trick with TMP table should work, but that is not a good idea to use it:

    1. TNP tables are not fast, and to create a new instance just to pass data between DP and Controller is not ideal

    2. If packed incorrectly, you parameters might be missed if SSRS is run in Batch

    Something is definitely wrong if DataContract is not working.

    I would suggest you to check this example of DP base SSRS, but skipp everything related to queries

    technet.microsoft.com/.../gg724119.aspx

    And here you can check valid way to use preRunModifyContract method to populate your values

    Hope this can help you.

  • Moeen Ahmed Sultan Profile Picture
    1,402 on at

    I have tried every method but unfortunately AX 365 have many issues yet. So, I created my own logic. :)

    Your links are very much knowledgable. I already tried many of these solutions.

    Sharing my logic to make it working is just to solve the problem if anyone having. I know this is not the best solution technically, but it is best if developers are having problems.

    Thanks for your help.

  • Fedir Kryvyi Profile Picture
    1,026 on at

    D365 have a lot of issues indeed, but SSRS engine and classes are being intact from AX2012 version, and should work as expected. That is why I am sceptic about your solution

  • Moeen Ahmed Sultan Profile Picture
    1,402 on at

    Oh! If I found something better, I will share.

    Thankyou so much :)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans