Can we get a sort function please

1275
5
11-17-2021 08:10 AM
Status: Needs Clarification
Labels (1)
DougBrowning
MVP Esteemed 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!

Thanks!

5 Comments
VMitch
by

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

JamesTedrick
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.

DougBrowning

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".

Thanks!

HélèneTouyéras

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

https://community.esri.com/t5/arcgis-survey123-questions/sort-results-of-select-multiple-question/m-...

 

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

 

Many thanks for any help! 🙂

DeborahDennison

I am interested in the ability to Sort collected repeat information based on a field. 

Our team used a survey to document the planting (and health)  of hundreds of trees.  We surveyed/documented the work by different team members with S123.  Consequently, and for practical reasons, we have physical tree tags that are number in different groups such as:  300 to 360; 64 to 125; 1-63; 126 to 300, and so forth.  It is not efficient to tell staff to log the trees sequentially.  We have simultaneous Survey users and it is impractical to orchestrate a survey sequentially to accommodate a problem with sorting in S123.   

When creating a report, we need the Tree Tag ID number to be sequential:  1, 2, 3

Not 95 to 254, 1 to 94..... , and so forth.  There are over 10 groups of collections. 

I understand there is an OrderbyField, but from my understanding, a #repeat section cannot be individually displayed in a summary.  Or is the summary capable of this?   

Really, it would be ideal to use the OrderbyField in the Repeat section. 

If anyone has any tips on how to get around this, that would be so helpful!

Here are images of the Report Template and the Results:

 

Report TemplateReport_Template_NotSorting.jpg

 

Results from the printed template:

 

Report_Output_NotSorting.jpg