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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Multiselect lookup distinct values- group by doesnt work

(0) ShareShare
ReportReport
Posted on by 8

Hi,

I have multiselect lookup control where I want to show distinct values since in the table that I am using as a query datasource I have multiple records with the same ID and I only want one to be shown.

I use 

qbds = query.addDataSource(tableNum(MyTable));
qbds.orderMode(OrderMode::GroupBy);
 qbds.addGroupByField(fieldnum(MyTable,Typeid));

But then when I want to get the container using 

container selectedRecords;
selectedRecords = msLookupCtrl.get();

I dont get anything in the container.

Note that when I dont use group by function, I get records in the container.

Any help? IS there some other way how I can select distinct? 

  • Suggested answer
    GirishS Profile Picture
    27,845 Moderator on at

    Hi techAx,

    Try to create a view and add the group by in the view itself.

    Use that view in the query.

    Thanks,

    Girish S.

  • techAx Profile Picture
    8 on at

    Hi Girish,

    Thank you for your answer.

    Instead of msLookupCtrl.get(); I tried msLookupCtrl.getSelectedFieldValues(); and it seems like it works, but if I have some more issues I will try your solution.

  • techAx Profile Picture
    8 on at

    P.S. Do you know how I can make multiselect lookup control to refresh everytime I change other field value? Example: I want my multiselect lookup to be filtered by company list that I select in my dialog. But it is only instantiated once and lookup doesnt hit next time when I change company list.

  • GirishS Profile Picture
    27,845 Moderator on at

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

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 266 Super User 2026 Season 2

#2
Aayush Tiwari Profile Picture

Aayush Tiwari 217

#3
Subra Profile Picture

Subra 164 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans