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)

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

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
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans