Search This Blog

Saturday, March 19, 2016

ePerformance: Ability to Control the Display List of Rating Model Description.


In ePerformance rating values are shown in alphabetical order in the dropdown list. This is peopletools default functionality to display the values.

Not always the default rating order matches with the user defined order. Like suppose, users can come up with a rating which is not in alphabetical order.

In such case, we can use below code to display the custom sort order which would match the user defined order.

Below is the code which will help in sorting the rating as per user defined order:

/* Declarations */
Local SQL &SQL;
Local string &type, &descr;
Local string &rating_model;
Local Rowset &Xlat;

/* Field which shows the dropdown list on the page */
&FLD = GetRecord(Record.DERIVED_EP_ADVW).GetField(Field.REVIEW_RATING);
&rating_model = DERIVED_EP_ADVW.RATING_MODEL.Value;

/* Clear the drop down list */
&FLD.ClearDropDownList();

/* Create Rowset that should be filled with Rating values */
&Xlat = CreateRowset(Record.REVW_RATING_TBL);
&Xlat.Flush();

/* Code to fill the rowset */
&Xlat.Fill("WHERE RATING_MODEL = :1 and effdt = (select max(R1.EFFDT) from PS_REVW_RATING_TBL R1 WHERE R1.RATING_MODEL = RATING_MODEL AND R1.EFFDT <= SYSDATE ) order by EP_RATING DESC ", &rating_model);

/* code to fill the dropdown list */
&j = &Xlat.ActiveRowCount + 1;
For &i = 1 To &Xlat.ActiveRowCount
   &Value = &Xlat.GetRow(&i).REVW_RATING_TBL.REVIEW_RATING.Value;
   &descr = &Xlat.GetRow(&i).REVW_RATING_TBL.DESCR.Value;
   DERIVED_EP_ADVW.REVIEW_RATING.AddDropDownItem(&Value, Rept(Char(9), &j - &i) | &descr);
End-For;

No comments: