- How to sort the Display Order of an MDF picklist?
- How to sort the MDF picklist values Alphabetically?
- How to use the custom sort order for MDF picklist?
NOTE: Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.
- SAP SuccessFactors HXM Suite
- Metadata framework (MDF)
Reproducing the Issue
1) Create an MDF Picklist with few values in it.
2) Create an MDF object and configure a Picklist type field and map your picklist in that field. (using Valid Value Source property)
3) Try to create data for your MDF object and click on picklist field drop-down.
4) You notice that the order of the picklist values is not the way you expected. The values are not in the same order as they appear in Picklist Center page.
You can control the order of Picklist using the Picklist Property called "Display Order". If the Display Order is set to "No Selection" then by default Picklist values are sorted Alphabetically on the basis of Labels. See example below:
Result: The order followed is Alphabetical. i.e Four => One => Three => Two. (see screenshot below)
Notice that the externalCode of the picklist value does not matter here. They are sorted on the basis of Labels.
Now, what if you would not like to sort them Alphabetically and you want the values to be sorted in some other way. We will see what options we have in Property = "Display Order"
We have 3 options here and we will see how we can use them one by one
1) Alphabetical => If Display Order is not explicitly defined and is set to 'No Selection", picklists follow this order by default. So even if you set the Display order = "Alphabetical" explicitly, it won't make much differences to the sorting order because anyway by default the order was Alphabetical before as well. The result will be same as explained above.
2) Numeric => We use Numeric order in case we have Labels of Numeric type. Like Age: which has to be a number. In this our Labels will have to be strictly Numeric. Again the exteranlCode value does not matter at all here. It just has to be unique for every value is all we need to take care.
So once we have such numerical values and we choose Display order = "Numeric", the values will be sorted numerically (starting from lowest number on the top ---> largest number at the bottom of the Picklist). See below:
Result: The order followed is Numeric. i.e 17 => 23 => 45 => 56 =>88 (see screenshot below)
3) Custom => One more option that we have is "Custom" in which we have to provide a number in the "Sort Order" field of each picklist value. This Sort Order number will define which value appears at which position in dropdown. It is like assigning each picklist value their position in the dropdown. It can be very helpful in case you want to see certain most selected values always on the top.
So once you have set the display order to Custom, click the Details link. Enter a numeric value in the Sort Order field for all the picklist values. See below:
Result: The order followed is Custom. i.e test-top (1) => test-middle (2) => test-bottom (3) (see screenshot below )
NOTE: This is only for picklist values ordering. The ordering of instances of an MDF object on Manage data or the order of the values in GO type field is not possible.
custom sort order, alphabetical, alphabetically, picklist order, picklist values order, sorrting, order, numeric, numerically, display order, order, MDF Picklist, , KBA , LOD-SF-MDF-PKL , Picklists , How To