Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / not able to get the va...
Finance forum
Answered

not able to get the values from financial dimension

Posted on by 1,457
hi ,
everyone ,
i have created a lookup on finnancial dimension /buisness Unit /   , i am getting values for region ,city and location but this lookup is empty , can anyone help me on this , below is my code 
 
 
thanks,
Regards,
Dinesh
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 228,135 Most Valuable Professional on at
    not able to get the values from financial dimension
    It's great that your problem is resolved. Please don't forget to verify the answer.
     
    You can use the same approach for the other dimensions as well. You can utilize filters in Application Explorer to find what you need. For example, this gives all views prefixed with DimAttribute: type:view ^DimAttribute. And this gives you only the two you asked about: type:view ^DimAttribute.*(Department|Worker).
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,457 on at
    not able to get the values from financial dimension
    hi,
    Martin ,
    Thanks for Reply,
    i got desired out put , can you tell me how can i get the same for "worker" and "Department" , is there any entity for this .
     /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        [FormControlEventHandler(formControlStr(DTWorkerDimensionForm, DTWorkerDimTbl_DTBuisnessUnit), FormControlEventType::Lookup)]
        public static void DTWorkerDimTbl_DTBuisnessUnit_OnLookup(FormControl sender, FormControlEventArgs e)
        {
            Query query = new Query();
            QueryBuildDataSource queryBuildDataSource;
            QueryBuildRange queryBuildRange;
     
            SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(DimAttributeOMBusinessUnit),sender,true);
    
            sysTableLookup.addLookupField(fieldNum(DimAttributeOMBusinessUnit,Value));
            sysTableLookup.addLookupField(fieldNum(DimAttributeOMBusinessUnit,Name));
     
            queryBuildDataSource = query.addDataSource(tableNum(DimAttributeOMBusinessUnit));
     
            //queryBuildRange = queryBuildDataSource.addRange(fieldNum(DefaultDimensionView,Name));
            //queryBuildRange.value('BusinessUnit');
     
            sysTableLookup.parmQuery(query);
            sysTableLookup.performFormLookup();
    
            FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs;
            //cancel super() to prevent error.
            ce.CancelSuperCall();
        }
    thanks ,
    Regards ,
    Dinesh
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 228,135 Most Valuable Professional on at
    not able to get the values from financial dimension
    First of all, let me simplify your code (e.g. throw away unused variables), so it's easier to read:
    [FormControlEventHandler(formControlStr(DTWorkerDimensionForm, DTWorkerDimTbl_DTBuisnessUnit), FormControlEventType::Lookup)]
    public static void DTWorkerDimTbl_DTBuisnessUnit_OnLookup(FormControl sender, FormControlEventArgs e)
    {
        Name name = "BusinessUnit";
    
        Query query = new Query();
        QueryBuildDataSource qbdsDimensionFinancialTag = query.addDataSource(tableNum(DimensionFinancialTag));
        QueryBuildRange qbrFinancialTagCategory = qbdsDimensionFinancialTag.addRange(fieldNum(DimensionFinancialTag, FinancialTagCategory));
        qbrFinancialTagCategory.value(queryValue(DimensionAttribute::findByName(name).financialTagCategory()));
    
        SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(DimensionFinancialTag), sender);
        sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Value), true);
        sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Description));
        sysTableLookup.addSelectionField(fieldNum(DimensionFinancialTag, FinancialTagCategory));
        sysTableLookup.parmQuery(query);
    
        sysTableLookup.performFormLookup();
    
        FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs;
        ce.cancelSuperCall();
    }
    
    Normally, business units are taken from OMOperatingUnit table; they aren't defined manually DimensionFinancialTag table. Isn't this the key problem?
    I wonder why you need to write the lookup on your own instead of using standard logic for dimensions, but you surely can do it. Utilizing DimAttributeOMBusinessUnit view may be the best approach.
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,457 on at
    not able to get the values from financial dimension
      /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        [FormControlEventHandler(formControlStr(DTWorkerDimensionForm, DTWorkerDimTbl_DTBuisnessUnit), FormControlEventType::Lookup)]
        public static void DTWorkerDimTbl_DTBuisnessUnit_OnLookup(FormControl sender, FormControlEventArgs e)
        {
            SysTableLookup sysTableLookup;
            Query query;
            QueryBuildDataSource qbdsDimensionFinancialTag;
            QueryBuildRange qbrFinancialTagCategory;
            String20 LC;
            RecId _recid;
            DimensionAttribute _attribute;
            Name _name= "BusinessUnit";
    
            query = new Query();
            qbdsDimensionFinancialTag = query.addDataSource(tableNum(DimensionFinancialTag));
            qbrFinancialTagCategory = qbdsDimensionFinancialTag.addRange(fieldNum(DimensionFinancialTag, FinancialTagCategory));
            qbrFinancialTagCategory.value(strFmt("%1", DimensionAttribute::findByName(_name, false).financialTagCategory()));
    
            sysTableLookup = sysTableLookup::newParameters(tableNum(DimensionFinancialTag), sender,true);
            sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Value), true);
            sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Description));
            sysTableLookup.addSelectionField(fieldNum(DimensionFinancialTag, FinancialTagCategory));
            sysTableLookup.parmQuery(query);
    
            sysTableLookup.performFormLookup();
    
            FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs;
            //cancel super() to prevent error.
            ce.CancelSuperCall();
        }
     

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,277 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,135 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans