Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)
Suggested answer

Joining LedgerJournalTrans to GeneralJournalEntry/GeneralJournalAccountEntry (1 to 1)

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Is there a way of joining the LedgerJournalTrans to the GeneralJournalEntry/GeneralJournalAccountEntry on a 1 to 1 level?  Joining through Voucher appears to be a 1 to many relation.

*This post is locked for comments

  • karthi.turaga Profile Picture
    karthi.turaga 15 on at
    RE: Joining LedgerJournalTrans to GeneralJournalEntry/GeneralJournalAccountEntry (1 to 1)

    Hi,

    Please let me know if you have a solution.

    Thanks,

    karthik.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Joining LedgerJournalTrans to GeneralJournalEntry/GeneralJournalAccountEntry (1 to 1)

    I am trying to join the LedgerJournalTrans to the GeneralJournalAccountEntry on a 1 to 1 relationship for a display method.

    I am using LedgerJournalTrans "Txt" field as a way to use description.

  • RE: Joining LedgerJournalTrans to GeneralJournalEntry/GeneralJournalAccountEntry (1 to 1)

    Take a look at this job, I hope it helps you to understant the relations between the tables:

    static void tutorialAccesLedgerJournalTransVoucher(Args _args)
    {
        Ledger                          ledger = ledger::findByLegalEntity(CompanyInfo::find().RecId);
        LedgerJournalTrans              ledgerJournalTrans;
        GeneralJournalEntry             generalJournalEntry;
        GeneralJournalAccountEntry      generalJournalAccountEntry;
        
        DimensionAttributeLevelValueAllView dimensionAttributeLevelValueAllView;
        DimensionAttribute                  dimensionAttribute;
        
        while select ledgerJournalTrans
            join generalJournalEntry
            index hint LedgerAccountingDateIdx
            where generalJournalEntry.Ledger    == ledger.RecId
               && generalJournalEntry.AccountingDate == ledgerJournalTrans.TransDate
               && generalJournalEntry.SubledgerVoucher  == ledgerJournalTrans.Voucher
            join generalJournalAccountEntry
                where generalJournalAccountEntry.GeneralJournalEntry    == generalJournalEntry.RecId
        {
            info(strFmt("%1", generalJournalAccountEntry.AccountingCurrencyAmount));
            
            //financial dimensions related to the voucher line
            
            while select dimensionAttributeLevelValueAllView
                where dimensionAttributeLevelValueAllView.ValueCombinationRecId == generalJournalAccountEntry.LedgerDimension
                join dimensionAttribute
                where dimensionAttribute.RecId  == dimensionAttributeLevelValueAllView.DimensionAttribute 
            {
                info(strFmt("%1 %2", dimensionAttribute.localizedName(), dimensionAttributeLevelValueAllView.DisplayValue));
            }
        }        
    }

  • Suggested answer
    Amir Nazim Profile Picture
    Amir Nazim 5,994 on at
    RE: Joining LedgerJournalTrans to GeneralJournalEntry/GeneralJournalAccountEntry (1 to 1)

    GeneralJournalEntry tables links to SubledgerGeneralJournalEntry table by the "GeneralJournalEntry" field in SubledgerGeneralJournalEntry table.

    and yes it has 1 to many relationship based on voucher, dataareaid and trans date. this is valid.

    can you explain what is your exact requirement is ? and what you are looking to achieve ?

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,820 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,514 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans