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.