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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Which table to look/join for to see each segments in an account number into separate fields?

(0) ShareShare
ReportReport
Posted on by 46

I want to create a query from GeneralJournalAccountEntry table but I need each segments into fields.

From:

pastedimage1611616219021v2.png

To:

pastedimage1611616189335v1.png

Image taken from Trial Balance set to display account number segments in separate columns

Fields GeneralJournalAccountEntry.LedgerAccount & DimensionAttributeValueCombination.DisplayValue are not separated.

I really appreciate if you can help me find the other table/s which I can join to GeneralJournalAccountEntry to get each separate segment.

As much as possible, I would like to avoid using string runtime functions to separate the segments.

Thank you so much.

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    236,320 Most Valuable Professional on at
    RE: Which table to look/join for to see each segments in an account number into separate fields?

    Look at DimensionAttributeLevelValueAllView. It has a relation to DimensionAttributeValueCombination.RecId.

  • Kashiru Kito Profile Picture
    46 on at
    RE: Which table to look/join for to see each segments in an account number into separate fields?

    Thanks Martin! Found it and was able to write the appropriate query. Thanks alot!

    static void testGetGLSeparateAccountSegments(Args _args){
        GeneralJournalEntry                     generalJournalEntry;
        GeneralJournalAccountEntry              generalJournalAccountEntry;
        DimensionAttributeValueCombination      dimensionAttributeValueCombination;
        DimensionAttributeLevelValueAllView     dimensionAttributeMainAccount
                                               ,dimensionAttributeCostCenter
                                               ,dimensionAttributeSubsidiaryCode;
        ;
    
        while select 
            JournalNumber
           ,SubledgerVoucher
        from generalJournalEntry
        join LedgerDimension from generalJournalAccountEntry
            where generalJournalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId
        join DisplayValue from dimensionAttributeValueCombination
            where dimensionAttributeValueCombination.RecId == generalJournalAccountEntry.LedgerDimension
        join DisplayValue from dimensionAttributeMainAccount
            where dimensionAttributeMainAccount.ValueCombinationRecId == dimensionAttributeValueCombination.RecId
               && dimensionAttributeMainAccount.GroupOrdinal == 1 /*MainAccount*/
        join DisplayValue from dimensionAttributeCostCenter
            where dimensionAttributeCostCenter.ValueCombinationRecId == dimensionAttributeValueCombination.RecId
               && dimensionAttributeCostCenter.GroupOrdinal == 2 /*CostCenter*/
        join DisplayValue from dimensionAttributeSubsidiaryCode
            where dimensionAttributeSubsidiaryCode.ValueCombinationRecId == dimensionAttributeValueCombination.RecId
               && dimensionAttributeSubsidiaryCode.GroupOrdinal == 3 /*SubsidiaryCode*/
         && generalJournalEntry.JournalNumber == 'GJT-00305101' 
         && dimensionAttributeValueCombination.DisplayValue == '33000-120-HE-001'
        {
            info(strFmt('%1 | %2 | %3 | %4 | %5 | %6 | %7'
                ,generalJournalEntry.JournalNumber
                ,generalJournalEntry.SubledgerVoucher
                ,generalJournalAccountEntry.LedgerDimension
                ,dimensionAttributeValueCombination.DisplayValue
                ,dimensionAttributeMainAccount.DisplayValue
                ,dimensionAttributeCostCenter.DisplayValue
                ,dimensionAttributeSubsidiaryCode.DisplayValue));
    
        } /*...outputs "GJT-00305101 | YE_2019 | 5637370392 | 33000-120-HE-001 | 33000 | 120 | HE-001"*/
    }

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,122

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 918 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 646 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans