web
You’re offline. This is a read only version of the page.
close
Skip to main content
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

I have the same question (0)
  • Crispin John Augustine Profile Picture
    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..

  • angelicalaurene Profile Picture
    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.

  • Verified answer
    Crispin John Augustine Profile Picture
    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

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
Community Member Profile Picture

Community Member 2

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans