Can we get a sort function please

11-17-2021 08:10 AM
Status: Needs Clarification
Labels (1)
MVP Notable Contributor

We get a lot of requests to sort things.  There is no sort function now. 

I would mostly like to use it for join.

sort(join(separator, question))

Should be easy and really cool.

unique(join(separator, question)) would also be really cool!



I like this idea, would like to see it added also.

Status changed to: Needs Clarification

Hi @DougBrowning ,

We may have talked about this before, but what values are needing to be sorted?  Is this sort numerical, alphabetical, or based on another rule?

Unfortunately, there is no sorting type function in the functions documented in the XLSForm specification.  That being said, it would be possible to create a custom JavaScript function that takes a repeat or field within a repeat, applies a sort, and then outputs the results.


I just need alphabetical. 

The problem with javascript is it cannot handle my repeat.  Run out of memory every time.  My repeat is not that big really at 100 fields.  But for me JS is pretty much useless.  I think if I could pass in just one field from the repeat it would solve a lot of this.  Is that something that could be changed on your end?  I think we talked about this and it is not there yet but your post makes it wonder since you said "a field inside a repeat".



Good morning @JamesTedrick , I am also interested in a sort() function, to clean-up a little results of select-multiple questions, as described here:


The idea would be to sort the list of selected values either alphabetically or numerically.


Many thanks for any help! 🙂