Hi guys, I’m trying to sort my clients in a repeating group, based on status and date.
The date is type date, and status is an option set which has an attribute “sort index”. I don’t see status in the “sort by” dropdown of the constraint. Is there a way to sort by it?
Hi there, @silverishclover… unfortunately, the short answer is no (which is one of the biggest limitations of option sets, in my opinion). I’m sure there are workarounds (one or more of which can be found in the forum, I believe), but they’re not going to be pretty.
Just food for thought… have you considered allowing users to filter the repeating group by status as opposed to doing a sort? If a user is sorting by status, they obviously want to see all of the things that have a particular status, and in that case, one might argue that a filter is just as good (if not better) than a sort. Again, just food for thought.
Best…
Mike
thanks for the quick answer Mike. I do use a filter as well but I want to have a default view for the employee where clients with status “done” appear at the end of the list.
This problem arises in other places as well, i.e., when I want to hide elements of a certain type (option set selection).
I might resort to using text to identify the status instead of an option set, but as you say, messy.
Hi - not sure if you’re still having this issue but I ran into the same problem so I created a text field to house the display property of the option set and then sorted on that text field.
To make sure that the text field remained consistent with the option set I added a database trigger to update the text field every time the status was updated. Hope this makes sense.
I’m doing a grade level sort. So my option set starts with Pre-K, K, 1,2,3,4…and so on. I added an attribute of 1 to PreK, 2 to K, 3 to 1, 4 to 2, etc. So what I’m getting here is there is not a way to look at that attribute as what sorts that list?
This quick tip could help you find a solution for this problem:
Another option if the list you want to sort isn’t enormous, could be to merge multiple searches.
So in the OP’s example, search clients where status <> ‘Done’, and another search for Clients where status = ‘Done’. Then join them with the ‘merged with’ operator. This will put the ‘Done’ clients at the bottom of your list.
Yes, you’re wearing the overhead of two searches (in this example), but like I said, shouldn’t matter much for smaller datasets.