Select to view content in your preferred language

Feature Report Order Repeat

549
6
10-23-2023 08:51 AM
abureaux
MVP Frequent Contributor

In Feature Reports, is there a way to order a repeat by a number field that doesn't result in: 1, 10, 11, 2, 3, ..., 9

I found a way to trick this into working the way I want and how users expect it to work. But this solution is just silly:

abureaux_1-1698075178590.png

It takes 21 rows to sort 1000 items.

Is there an easier way to do this?

0 Kudos
6 Replies
Katie_Clark
MVP Regular Contributor

Could you elaborate more on the workaround you found? I need to do something similar - users enter values for percent cover within a repeat in any order, but in the final report I need them printed in descending order. Could your workaround be used for that?

Best,
Katie


“The goal is not simply to ‘work hard, play hard.’ The goal is to make our work and our play indistinguishable.”
- Simon Sinek
0 Kudos
abureaux
MVP Frequent Contributor

Sure! Hopefully this is easier to read:

abureaux_0-1698086764522.png

For my first attempt, I used "orderByFields" as-is, with the result I am sure you are familiar with (e.g., 1,10,11,2,...,9).

For my second attempt, I combined "orderByFields" with an IF statement to filter out all of the rows I didn't want. While more tedious, this does give the expected result (e.g., 1,...,9,10,11)

In my case, I have a numeric field (rtv_num) that starts from 1 and counts up by 1 for every ever item in the repeat. This is what the orderByFields is based off of, and what I am using for my filter:

abureaux_1-1698087109293.png

And of course, if there is nothing in a given number range, those rows are deleted from the table for a clean final appearance.

0 Kudos
Katie_Clark
MVP Regular Contributor

So, @abureaux to address your initial question, I tested this syntax with my survey, and it sorted as expected for numeric values (this was actually my first time trying this syntax, thanks for reminding me about it!)

Anyway, as you can see in this screenshot, they are definitely sorted descending by number, as intended.

Katherine_Clark_0-1698239324820.png

 

In my case, I am sorted descending based on an integer type field. What field type is ${rtv_num} in your survey? 

Best,
Katie


“The goal is not simply to ‘work hard, play hard.’ The goal is to make our work and our play indistinguishable.”
- Simon Sinek
0 Kudos
abureaux
MVP Frequent Contributor

Ugh! So, it is an integer in the first repeat, but then converts to text in the second! As a result, half of my Feature Report was fine. This change was made after the survey was published, so the second field was missed since it is quite buried and only needed in the Feature Report.

Well, at least I now have a way to neatly organize "numbers as text" in the Feature Report!

0 Kudos
Katie_Clark
MVP Regular Contributor

Could you add another (hidden) field that would convert it *back* to an integer, to use for sorting?

Best,
Katie


“The goal is not simply to ‘work hard, play hard.’ The goal is to make our work and our play indistinguishable.”
- Simon Sinek
0 Kudos
abureaux
MVP Frequent Contributor

Yep! That was my plan. Will be pushing the update this weekend, actually.