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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

The value 0 is not found in map

(0) ShareShare
ReportReport
Posted on by

while select  dirpartylocation
        where dirpartylocation.Party == this.OMOperatingUnitID
    notExists join inventLocationLogisticsLocation
        where inventLocationLogisticsLocation.InventLocation == sInventLocation.RecId
    notExists join _logisticspostaladdress
            where inventLocationLogisticsLocation.Location == _logisticspostaladdress.Location
    {
        rolesCon = _rolesMap.lookup(_logisticspostaladdress.Location);
        //Create new location
        newLogisticsLocation = LogisticsLocation::create(LogisticsLocation::find(_logisticspostaladdress.Location).Description);

 

        //Create address
        newPostalAddress.clear();
        newPostalAddress.data(logisticsPostalAddress::findByLocation(_logisticspostaladdress.Location));
        newPostalAddress.Location = newLogisticsLocation.RecId;
        newPostalAddress.insert();

getting the error like "the value 0 is not found in map" in Line 8.

  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Hi mahiims18,

    this error means that your map doesn't contain a value that would correspond to _logisticsPostalAddress.Location key.

    You can use exist method to check whether a value exists in a map, and only call lookup if the value exists. This way you can avoid the error.

    You should also be aware that your code will always result in _logisticsPostalAddress.Location being 0 on line 8, since you don't select any LogisticsPostalAddress. Instead _logisticsPostalAddress is used for notexist join.

    We don't know how you populate _rolesMap, and your code also doesn't show what you do with rolesCon. But based on all the information that you shared, you could just remove line 8 completely. It would not impact how the rest of the (shared) code works.

    docs.microsoft.com/.../gg911868(v=ax.60)

  • Community Member Profile Picture
    on at

    Hi Nikolaos

    I have one more statement in my code after line 18.

    i.e newInventLocationLogisticsLocation.addEntityLocation(rolesCon, true);

    so I can't remove line 8.

  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Hi mahiims18,

    then you need to fix your code. I have explained why you get the error. Please note that I also updated my previous comment, pointing out that your _logisticsPostalAddress.Location will always be 0 once your code reaches line 8.

    Right now it's not possible to suggest exact fix to your code, there's simply not enough information available.

  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    notExists join _logisticspostaladdress means you dont have that table record so why you are using a field from that table

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#2
CU10121822-0 Profile Picture

CU10121822-0 366

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 360 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans