Hi All,
These objects are fully customized not standard,
Initially the lookup sort out based on Rating scale,
Requirement is to change sort based on Rating,
I tried using custom code , but first time when we click on lookup its coming properly,
After selecting any value and again click on lookup, its showing sorting based on rating scale
[FormControlEventHandler(formControlStr(LTPMSJournalDetailsYrEnd, BusinessProcesses_SelfAppraisalRating), FormControlEventType::Lookup)] public static void BusinessProcesses_SelfAppraisalRating_OnLookup(FormControl sender, FormControlEventArgs e) { Query query = new Query(); QueryBuildDataSource queryBuildDataSource; QueryBuildRange queryBuildRange; SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(LTRatingMasterCompetency), sender); queryBuildDataSource = query.addDataSource(tableNum(LTRatingMasterCompetency)); // // queryBuildDataSource.clearSortIndex(); // queryBuildDataSource.sortClear(); queryBuildDataSource.addSortField(fieldnum(LTRatingMasterCompetency,Rating),sortOrder::Ascending); // queryBuildDataSource.removeOrderByField(fieldnum(LTRatingMasterCompetency, RatingScale)); // queryBuildDataSource.applyFilter(fieldnum(LTRatingMasterCompetency,Rating)); sysTableLookup.addLookupField(fieldNum(LTRatingMasterCompetency, RatingScale)); sysTableLookup.addLookupField(fieldNum(LTRatingMasterCompetency, Rating)); sysTableLookup.parmQuery(query); sysTableLookup.performFormLookup(); FormControlCancelableSuperEventArgs cancelableSuperEventArgs = e as FormControlCancelableSuperEventArgs; cancelableSuperEventArgs.CancelSuperCall(); }
The base table for this lookup is RatingTable.
In that table also i changed the clusterIndex property as based on rating index.
What i need to do to fix this issue, kindly advise me, thanks in advance.
Thanks Girish for your suggestion, i created one tmp table and inserted value in tmp table whenever lookup control cliked and added tmp table in syslookup now its working fine.
Sorry, this is final workaround you have.
So, the reason may be as soon as you type in some value in the lookup field - sort order added will get cleared and order gets changes based on the entered data.
I don't think there is no fix available as you have tried some suggestions as mentioned.
Thanks,
Girish S.
Hi Girish,
I tried as you mentioned, now the number(rating - ex: 4) like that its getting inserted in the control after that if i click again the lookup its sort based on rating scale , same issue.
Thanks
I think this is because there is a value given in the rating scale field. It gets filtered based on the rating scale field, and it omits sort order added in the rating field.
Try adding the Rating as a first field in the lookup field and check. If the Rating field as added first check if it works in that case.
sysTableLookup.addLookupField(fieldNum(LTRatingMasterCompetency, Rating)); sysTableLookup.addLookupField(fieldNum(LTRatingMasterCompetency, RatingScale));
Thanks,
Girish S.
Hi Girish,
Thanks for your reply , using query and views also its not working facing same issue.
Hi Pj John,
Try creating query and set the order by field on the query for Rating field - Create a view from the query and use that view in the lookup instead of custom tables.
Thanks,
Girish S.
André Arnaud de Cal...
292,074
Super User 2025 Season 1
Martin Dráb
230,900
Most Valuable Professional
nmaenpaa
101,156