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)

How to join InventTrans table with InventJournalTrans table?

(0) ShareShare
ReportReport
Posted on by

Hello,I'm trying to get inventjournaltable.description field from inventtrans table, how can i join these tables? SO far I have tried the following query but with no luck...

select sum(qty)
from invTrans


join invDim
join inventtransorigin


where invTrans.InventDimId == invDim.InventDimId &&
invTrans.InventTransOrigin == inventtransorigin.RecId &&
//inventtransorigin.ReferenceCategory != InventTransType::InventTransfer &&
inventjournaltrans.InventTransId == inventtransorigin.InventTransId &&
inventjournaltable.JournalId == inventjournaltrans.JournalId &&

invDim.InventLocationId == "100" &&
invTrans.ItemId == this.ItemId &&
invTrans.qty < 0 &&
invTrans.DatePhysical > str2Date("01/01/2014", 123) &&
invTrans.PackingSlipReturned == false

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Ivan (Vanya) Kashperuk Profile Picture
    Microsoft Employee on at

    What is it exactly you are trying to achieve? In the question you say you want to pull out the Description field from the InventJournalTable (inventory journal header), but in the query you are trying to could the quantity of goods processed..

    InventJournalTrans::findInventTrans(inventTrans.inventTransOrigin().InventTransId).inventJournalTable().Description would get you the fist thing based on an inventTrans record.

    You should be able to figure out the relationship between InventTrans/InventTransOrigin/InventJournalTrans/InventJournalTable from the above methods.

  • Verified answer
    Community Member Profile Picture
    on at

    Hi,

    Try this,

    static void Job33(Args _args)

    {

       InventTrans invTrans;  

       InventJournalTrans inventjournaltrans;

       InventJournalTable inventjournaltable;

       InventTable invtbl;

       select invTrans  

       join invtbl

       join inventjournaltrans

       join inventjournaltable

       where inventjournaltrans.ItemId == invTrans.ItemId &&

       inventjournaltable.JournalId == inventjournaltrans.JournalId &&

       invtbl.ItemId == invTrans.ItemId && invTrans.ItemId == "YourItemID";

        info(strFmt("%1",inventjournaltable.Description));

    }

    Thanks,

    Selvam

  • Community Member Profile Picture
    on at

    I was intending to exclude some records based on InventJournalTable's description field,but I have found out that, inventtransorigin table's referenceid field also does the job for me.Thanks for the help :)

  • Verified answer
    Ivan (Vanya) Kashperuk Profile Picture
    Microsoft Employee on at

    Note that Selvam's reply misses a very important join condition, making it incorrect. Right now it selects all transactions with that item, not only those related to the specific journal.

  • Josan_ec Profile Picture
    45 on at

    Ivan, What join condition must be considered to show the item transactions associated with the inventjournaltrans?

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 21

#2
dserp Profile Picture

dserp 4

#2
dekion Profile Picture

dekion 4

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans