Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

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

(0) ShareShare
ReportReport
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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,493 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans