Forum Academy Marketplace Showcase Pricing Features

Sorting repeating group by option set

I have a repeating group containing Artifacts. They have, among other fields, Name and Priority. Name is a text field. Priority is an option set. I select Artifacts on several criteria and sort them prior to display. I can sort the repeating group by Name but Priority isn’t on the list of sorting options in the “Search for” form. It only lists the text fields. How do I sort the Artifacts in the repeating group by Priority?

And, a further question:
The Priority option set has three values: Low/Medium/High. A drop down shows them in that logical order (which is how I entered them). But, if I sort them alphabetically, they will be in the order: High/Low/Medium. I want them sorted in the logical order rather than alphabetical order. How would I do that?

Thanks for any help you can provide.

To answer the second part of your question, one way to do it is to add an attribute to the option set, called something like rank/priority/order etc. of type 'Number.

So for example, High might be 1, medium 2, and low 3 (or the other way round - whichever is most logical to you).

Then you can sort the options in the dropdown by that attribute.

n.b. Although, specifically in the case of Option Set options, by default (if you don’t add any additional sorting) the options will be displayed in the order they appear on the option set tab of your app data in the editor, and you can change this order to suit by using the ‘Move Up’ and ‘Move Down’ buttons next to each option.

So it’s probably simpler to just use that, and set the order there.

As for your first question, having just looked at it there doesn’t seem to be any obvious way to do it (which is strange). I might be overlooking something simple, so if I work it out I’ll get back to you, but as far as I can see right now there’s no way to sort by an option set field, unfortunately.

The only workaround I can think of at the moment is having an additional field (number) on the Artefact datatype just for sorting, then set that using the priority option set.

Any progress with this? Any workaround?