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 :
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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sagar Suman Profile Picture

Sagar Suman 2 Super User 2026 Season 1

#1
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#1
Pratik Bhosle Profile Picture

Pratik Bhosle 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans