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)

Add values in a ledger dimension segmented Entry in X++

(0) ShareShare
ReportReport
Posted on by

hi

I have a segmented entry field for ledger dimensions. In this field one of the segments is projectId. I want to retrieve all the other dimensions in to their places based on the entered projectId.

The ProjectId is number 3 in the row.

8228.Screenshot_5F00_15.png

*This post is locked for comments

I have the same question (0)
  • Dick Wenning Profile Picture
    8,705 Moderator on at
  • Community Member Profile Picture
    on at

    Hi Dick

    thanks for your reply,

    I want to insert values in the segments that are already in the fields, based on the projectId we enter :)

  • Dick Wenning Profile Picture
    8,705 Moderator on at

    ok something like this

    dynamicsaxspace.com/.../set-financial-dimension-values-through-code-in-ax-2012

  • Community Member Profile Picture
    on at

    It could be the solution I want, but I cant see anywhere that he retrieves the default dimensions based on the ProjId. Its a little hard to see what he is doing.

  • Community Member Profile Picture
    on at

    Just to make sure that I have described my question well :)

    In the below image I have entered a projectId in this segmented entry field. What I want is, when I leave the field, the rest of the default dimensions which are "Department" and so on, gets populated. I really dont know how to solve this :)

    3122.Screenshot_5F00_16.png

  • Community Member Profile Picture
    on at

    Update:

    I have had a little progress in the process. Now I can get the entered ProjectID from the Segmented Entry. But My question is how I can select the default Dimensions of the project and insert them in the Segmented entry. Here is my code that I have placed in the Leave() of the AccountNum control on the LedgerJournalTransDaily form. 

    I can select the default dimensions for a project. But I dont know how to insert the values in the segmented entry field. 

    public boolean leave()
    {
        str 100 projIdLocal;
        boolean ret;
        DimensionAttributeValueCombination  ledgerdim;
        DimensionStorage                    dimStorage;
        DimensionAttributeValueCombination  dimAttrValueComb;
        ProjTable                           projTableLocal;
    
    
    
    
        ret = super();
    
    
    
    
        if(ledgerJournalTable.JournalName == "HEN")
        {
            dimStorage = DimensionStorage::findById(LedgerJournalTrans.LedgerDimension);
    
            projIdLocal = element.getProjIdDimension(LedgerJournalTrans.LedgerDimension);
    
    
            select projTableLocal
                where projTableLocal.ProjId == projIdLocal;
    
            LedgerJournalTrans.Txt = "Hensat - " + projTableLocal.Name;
    
            while select * from projTable
               where ProjTable.ProjId == projIdLocal    //  Det skal være det indtastede projektId
             join RecId from dimensionattributeValueset
                   where  dimensionattributeValueset.RecId == projTable.DefaultDimension
             join RecId, DisplayValue from dimensionAttributeValueSetItem
                   where dimensionAttributeValueSetItem.DimensionAttributeValueSet == dimensionattributeValueset.RecId
             join RecId from dimensionAttributeValue
                   where dimensionAttributeValue.RecId == dimensionAttributeValueSetItem.DimensionAttributeValue
             join RecId, Name from dimensionAttribute
                   where dimensionAttribute.RecId == dimensionAttributeValue.DimensionAttribute
             {
                 info(dimensionAttribute.Name+"----"+ dimensionAttributeValueSetItem.DisplayValue);
                    //I guess it will be here that I must merge in to the Segmented Entry. 
             }
         }
    
    
    
        return ret;
    }


  • Verified answer
    Community Member Profile Picture
    on at

    here is how I solved the problem.

    public boolean leave()
    {
        str 100 projIdLocal;
        boolean ret;
        DimensionAttributeValueCombination  ledgerdim;
        DimensionStorage                    dimStorage;
        DimensionAttributeValueCombination  dimAttrValueComb;
        ProjTable                           projTableLocal;
        DimensionDefault                    dimensionDefault;
    
    
    
        ret = super();
    
        if(ledgerJournalTable.JournalName == "HEN")
        {
            dimStorage = DimensionStorage::findById(LedgerJournalTrans.LedgerDimension);
    
            projIdLocal = element.getProjIdDimension(LedgerJournalTrans.LedgerDimension);
    
            projTableLocal  = ProjTable::find(projIdLocal);
    
            if(projTableLocal.Name)
            {
                LedgerJournalTrans.Txt = "Hensat - " +  projTableLocal.Name;
            }
    
            dimensionDefault = projTableLocal.DefaultDimension;
            if (dimensionDefault)
            {
                LedgerJournalTrans.LedgerDimension = DimensionDefaultingService::serviceCreateLedgerDimension(LedgerJournalTrans.LedgerDimension, dimensionDefault);
                LedgerJournalTrans.OffsetLedgerDimension = DimensionDefaultingService::serviceCreateLedgerDimension(LedgerJournalTrans.OffsetLedgerDimension, dimensionDefault);
            }
         }
    
    
    
        return ret;
    }


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