I have an interface where I select numbers using a multi select dropdown .
When I select it is in the sorted order
In the next confirmation screen , I show these values in an array as a read only paragraph , it is not maintaining the sorred order ( shown below )
a!paragraphField( label: "Item #", labelPosition: "ABOVE", instructions: "", value: a!forEach( items: toString(local!selectedItems), expression: substitute(fv!item, ";", ",") ), saveInto: local!selectedItems, readonly: true ),
I am displaying the paragraph as shown above , Is there anyway to display the local!selected items as sorted ?
Discussion posts and replies are publicly visible
AFAIK the items selected for a MultiDropdown are added to the target array in the order the user selects them. The fact that you're seeing them in "sorted" order in the MultiDropdown's value is more an aspect of the fact that that's the ordering as it exists in the dropdown's "choice labels" list.
If you're saving it as an array of integer, you can always go MadLad and call the primitive (and barely supported) "sort()" function on it. But it's probably better to establish a hardened expression rule that sorts an arbitrary array based on a supported method like the "toDataSubset" approach, which I'm sure has been posted here numerous times in various permutations.