Skip to content

Instantly share code, notes, and snippets.

@nvg
Created July 4, 2017 14:30
Show Gist options
  • Select an option

  • Save nvg/111e2e13f037da013ba5d7a39a8a65f0 to your computer and use it in GitHub Desktop.

Select an option

Save nvg/111e2e13f037da013ba5d7a39a8a65f0 to your computer and use it in GitHub Desktop.
peoplecode: field sort order
/**
Ensures that dropdown field ordering is maintained, overriding the default alpha order
in PeopleSoft.
*/
class FieldSorter
/**
Reloads XLATS for the specified and and sets them in the load order
*/
method sortXlats(&field As Field);
end-class;
method sortXlats
/+ &field as Field +/
Local number &i;
Local number &j;
Local string &Value;
Local string &Descr;
&field.ClearDropDownList();
Local Rowset &Xlat;
&Xlat = CreateRowset(Record.PSXLATITEM);
&Xlat.Flush();
&Xlat.Fill("WHERE FILL.FIELDNAME = :1 and EFFDT <= %CurrentDateIn and EFF_STATUS = 'A' ORDER BY FILL.FIELDVALUE desc", &field.Name);
&j = &Xlat.ActiveRowCount + 1;
&field.AddDropDownItem("", Rept(Char(9), &j));
For &i = 1 To &Xlat.ActiveRowCount
&Value = &Xlat.GetRow(&i).PSXLATITEM.FIELDVALUE.Value;
&Descr = &Xlat.GetRow(&i).PSXLATITEM.XLATLONGNAME.Value;
&field.AddDropDownItem(&Value, Rept(Char(9), &j - &i) | &Descr);
End-For;
end-method;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment