Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

The value "" is not in the map

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

  • Siddharth mujumdar Profile Picture
    Siddharth mujumdar 132 on at
    RE: The value "" is not in the map

    Hey bro i have also same issue how you resolve this then tell me.

  • Moeen Ahmed Sultan Profile Picture
    Moeen Ahmed Sultan 1,402 on at
    RE: The value "" is not in the map

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

    Thankyou so much :)

  • Fedir Kryvyi Profile Picture
    Fedir Kryvyi 1,026 on at
    RE: The value "" is not in the map

    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
    Moeen Ahmed Sultan 1,402 on at
    RE: The value "" is not in the map

    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
    Fedir Kryvyi 1,026 on at
    RE: The value "" is not in the map

    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
    Moeen Ahmed Sultan 1,402 on at
    RE: The value "" is not in the map

    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
    Fedir Kryvyi 1,026 on at
    RE: The value "" is not in the map

    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.

  • Verified answer
    Moeen Ahmed Sultan Profile Picture
    Moeen Ahmed Sultan 1,402 on at
    RE: The value "" is not in the map

    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
    Fedir Kryvyi 1,026 on at
    RE: The value "" is not in the map

    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

  • Moeen Ahmed Sultan Profile Picture
    Moeen Ahmed Sultan 1,402 on at
    RE: The value "" is not in the map

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

    }

     

     

     

     

     

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans