Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

Not getting values in dimension description when using using lookup .

(0) ShareShare
ReportReport
Posted on by 1,457
hi , 
every one , 
I have made lookup to get the /Department/ values and description on form but all i am getting is display values , description is not there , can anyone one please guide me on this , below is my code .
 
thanks ,
Regards,
Dinesh
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,457 on at
    Not getting values in dimension description when using using lookup .
    hi , martin 
    thanks for reply ,
     
    I have done the lookup using another view ,the lokup is working fine, but i will definately try your the steps you suggested, 
    below is my code for lookup .
     [FormControlEventHandler(formControlStr(DTWorkerDimensionForm, DTWorkerDimTbl_DTDepartment), FormControlEventType::Lookup)]
        public static void DTWorkerDimTbl_DTDepartment_OnLookup(FormControl sender, FormControlEventArgs e)
        {
            Query query = new Query();
            QueryBuildDataSource queryBuildDataSource;
            QueryBuildRange queryBuildRange;
     
            SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(FinancialDimensionValueEntityView),sender,true);
    
            sysTableLookup.addLookupField(fieldNum(FinancialDimensionValueEntityView,DimensionValue));
            sysTableLookup.addLookupField(fieldNum(FinancialDimensionValueEntityView,Description));
     
            queryBuildDataSource = query.addDataSource(tableNum(FinancialDimensionValueEntityView));
     
            queryBuildRange = queryBuildDataSource.addRange(fieldNum(FinancialDimensionValueEntityView,DimensionAttribute));
            queryBuildRange.value('Department');
     
            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 230,379 Most Valuable Professional on at
    Not getting values in dimension description when using using lookup .
    There is a tool that can help you find what's going on in code at runtime: the debugger. Put a breakpoint to DefaultDimensionView.dimensionDiscription(), make sure you've enabled debugging of Dimensions module, attach debugger to the web server and run your lookup again.
     
    If there is no other problem, you'll see that you have no value in BackingEntityType field. Then you should think about why is that and realize that you're a group by clause in your query without either aggregating or grouping by BackingEntityType field, therefore it's value isn't ever defined.
     
    You could, and should, do all these things on your own. You see that you can't really perform your job without knowing how to debug code, therefore it's critical for you to learn it. Please try the steps I describe above, so you know how to do it next time.
     
    Regarding the fix, I think you shouldn't be grouping by DisplayValue.
  • Dineshkarlekar Profile Picture
    Dineshkarlekar 1,457 on at
    Not getting values in dimension description when using using lookup .
     [FormControlEventHandler(formControlStr(DTWorkerDimensionForm, DTWorkerDimTbl_DTDepartment), FormControlEventType::Lookup)]
        public static void DTWorkerDimTbl_DTDepartment_OnLookup(FormControl sender, FormControlEventArgs e)
        {
            Query query = new Query();
            QueryBuildDataSource queryBuildDataSource;
            QueryBuildRange queryBuildRange;
     
            SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(DefaultDimensionView),sender,true);
    
            sysTableLookup.addLookupField(fieldNum(DefaultDimensionView,DisplayValue));
            sysTableLookup.addLookupMethod(tableMethodStr(DefaultDimensionView, dimensionDiscription));
     
            queryBuildDataSource = query.addDataSource(tableNum(DefaultDimensionView));
            QueryBuildDataSource.orderMode(OrderMode::GroupBy);
            QueryBuildDataSource.addGroupByField(fieldNum(DefaultDimensionView,DisplayValue));
     
            queryBuildRange = queryBuildDataSource.addRange(fieldNum(DefaultDimensionView,Name));
            queryBuildRange.value('Department');
     
            sysTableLookup.parmQuery(query);
            sysTableLookup.performFormLookup();
    
            FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs;
            //cancel super() to prevent error.
            ce.CancelSuperCall();
        }
     

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

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,379 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans