Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

How to validate if a license plate is already existing and existing in other locations in X++ code?

Posted on by 20

Hi,

What I'm trying to achieve is to validate a license plate ID generated by a user, if it is already existing and existing in other locations. If it is not, I will insert the license plate ID in the WorkTable.

How can I validate this or are there standard methods / code I can follow to validate?

Thank you.

*This post is locked for comments

  • Verified answer
    Crispin John Augustine Profile Picture
    Crispin John Augustine 37,081 on at
    RE: How to validate if a license plate is already existing and existing in other locations in X++ code?

    Your query is correct, but the assumption is wrong.

    it should be inventSum.AvailPhysical (instead of RecId)  I am sure, you will spot the difference immediately

  • angelicalaurene Profile Picture
    angelicalaurene 20 on at
    RE: How to validate if a license plate is already existing and existing in other locations in X++ code?

    [quote user=""Crispin"][/quote]

    I don't know of a standard method.

    But a simple code to look at InventSum joined with InventDim should do the job..

    Hi Crispin,

    Thanks for the suggestion!

    I tried doing this:

    inventDim       = InventDim::find(_workLine.InventDimId);
    inventStatusId  = _workLine.inventDim().InventStatusId;
    
    select firstonly RecId from inventSum
    join inventDimLoc
    join inventDim
    where inventDimLoc.inventDimId == inventDim.inventDimId
    && inventDim.inventDimId == inventSum.InventDimId
    && inventDim.InventLocationId == inventDimLoc.InventLocationId
    && inventDim.InventSiteId == inventDimLoc.InventSiteId
    && inventDim.LicensePlateId == targetLicensePlateId
    && inventDim.wmsLocationId == inventDimLoc.wMSLocationId
    && (inventDim.InventStatusId == inventStatusId);
    
    if (inventSum.RecId == 0)
    {
        WHSWorkTable::addTargetLicensePlate(_workLine.WorkId, targetLicensePlateId);
    }

    I checked if the RecId of InventSum is blank or has a value. If it's blank, it means the license plate is not existing yet, but if there is a value, it means it exists.

  • Crispin John Augustine Profile Picture
    Crispin John Augustine 37,081 on at
    RE: How to validate if a license plate is already existing and existing in other locations in X++ code?

    I don't know of a standard method.

    But a simple code to look at InventSum joined with InventDim should do the job..

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans