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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Relation of InventTrans and InventTransOrigin in a select statement

(0) ShareShare
ReportReport
Posted on by 272

I am using this select statement:

select * from inventTrans where inventTrans.InventTransOrigin == inventTransOrigin.RecId

however it doesn't return anything, where in fact the relation of InventTrans and InventTransOrigin is that.

I looked at the table inventTrans (via table browser) and saw that the inventTrans.InventTransOrigin is a TransId. So I did this:

select * from inventTrans where inventTrans.InventTransOrigin == str2Int64(inventTransOrigin.InventTransId)

however it still doesn't return anything.

What am I missing?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    How did you come to the conclusion about the relation for your second statement, and why are you trying to do a value conversion?

    The first syntax looks correct to me as per the relations (though screenshot is from AX 2012):

    inventtransrel.png

    If you do not get back anything, that means you are possibly in the wrong company which has no transactions, or you do not have data in your environment at all.

  • Miguel Zuniga Profile Picture
    272 on at

    Hi Vilmos,

    I tried the second statement because the column InventTransOrigin in the table itself InventTrans is displayed as the InventTransId.  So when I equate that to the InventTransOrigin.InventTransId, the compiler said:

    "Operator '==' cannot be applied to operands of type 'int64' to 'str'." So I did conversion.

    Their relation is indeed InventTrans.InventTransOrigin == InventTransOrigin.RecId, however it can't return something because the table is displaying the InventTransOrigin as an InventTransId.

    InventTrans.InventTransOrigin.PNG

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    It is possibly a replacement key, so on regular UI it could be showing the replacement value (InventTransId). Check the data in SQL directly, I would be expecting RecId values (for which you would need to write the RecId reference in the statement).

  • Miguel Zuniga Profile Picture
    272 on at

    Hi Vilmos,

    My apologies. Just had an error in my select statements.  But I've understood that inventTrans.InventTransOrigin returns a RecId, not an InventTransId.

    Thanks!

  • Vilmos Kintera Profile Picture
    46,149 on at

    No problem, kindly mark helpful answers next to each post to resolve the thread.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans