Sorting on Enum

I would like to perform a retrieve where I sort the entities ascending based on an enum value, but I get different results when running this locally vs. in the cloud. How is sorting on an enum done? Does it sort on alphabetic order, on either the caption or the name or is there no sure way to retrieve with a sort order based on an enum?
2 answers

Sorting is done on the Key and depends on the database and the applied locale for sorting.
You probably used non-alphanumeric codes like underscores. Did you use a HSQL/Builtin database locally and postgres on the cloud?


If sorting on enums is important in the GUI, I sometimes set them up like this:

alt text

They are sorted on the Name, but display the Caption. I have not tested sorting in a microflow, but I suspect the sort is also on the Name