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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

Not getting values in dimension description when using using lookup .

(0) ShareShare
ReportReport
Posted on by 1,836
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
I have the same question (0)
  • Dineshkarlekar Profile Picture
    1,836 on at
     [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();
        }
     
  • Verified answer
    Martin Dráb Profile Picture
    240,492 Most Valuable Professional on at
    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
    1,836 on at
    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

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
SajeedMullaji Profile Picture

SajeedMullaji 698

#2
Martin Dráb Profile Picture

Martin Dráb 327 Most Valuable Professional

#3
CU10121822-0 Profile Picture

CU10121822-0 320

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans