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?
You need to use refreshQuery method.
Refer to the below thread.
Thanks,
Girish S.
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.
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.
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.
André Arnaud de Cal...
292,031
Super User 2025 Season 1
Martin Dráb
230,868
Most Valuable Professional
nmaenpaa
101,156