Notifications
Announcements
No record found.
I have a lookup in which I am inserting values on run time, all things are going fine. Requirement is to avoid replicating values if case sensitive. Like ABCD and abcd should not be there in lookup at a time.
Below is my code that I've tried so far.
public void lookup() { Query query = new Query(); QueryBuildDataSource queryBuildDataSource; QueryBuildRange queryBuildRange; SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(InventJournalTrans), this); sysTableLookup.addLookupField(fieldNum(InventJournalTrans,vehicleNo)); queryBuildDataSource = query.addDataSource(tableNum(InventJournalTrans)); queryBuildDataSource.addSortField(fieldNum(InventJournalTrans,vehicleNo),SortOrder::Descending); queryBuildDataSource.addRange(fieldNum(InventJournalTrans, vehicleNo)).value(SysQuery::valueNotEmptyString()); sysTableLookup.parmQuery(query); QueryBuildDataSource.orderMode(OrderMode::GroupBy); sysTableLookup.performFormLookup(); this.replaceOnLookup(); }
Here is the image of lookup.
*This post is locked for comments
AX database collation must be set as Case Insensitive, which means if you are grouping by that field, then you will get a single value back if the field contents are the same, but with different case. You will only get a different value, if there are special characters stored in the field such as line break, which is not visible, but would result in 2 entries on a group by due to the different field contents.
By the way you are missing addGroupByField in your code.
sohailnedian.blogspot.hu/.../add-group-by-and-fields-selection-in.html
If you say that both ABCD and abcd shouldn't be displayed at a time, doesn't it mean that the case doesn't matter (= case-insensitive)? If so, it's easy, because the database should already be configured as case-insensitive.
The problem seems to be that you want to group by vehicleNo, but you don't. Use addGroupByField(fieldNum(InventJournalTrans, VehicleNo)) to do it.
Thanks Martin Dráb my code is running well
thank you soo much :)
thanks
and thank u Vilmos Kintera :)
Please mark helpful answers as Verified to set the topic as resolved.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 4 Most Valuable Professional
Priya_K 4
MyDynamicsNAV 2