Sorting a RG based on :count list of dates

Now that @despega replied more, I can reply more (seem to have hit a spam-filter… you can only reply so many times in a thread, apparently). Our next step is to use SET Process FIELD of Interest for our List Shifter. We need to get at the values for “Concert Dates”. By setting this as our “Field of Interest” we can access those values in the PROCESS List action:

Now for our PROCESS List step: What we will do is take each item in the “Original List” (this is the list of Concert Goers). For each Concert Goer, we get the “Field of Interest” (which is a list of Concert Dates) and use the “Array x.length” operator on it. (This is the same thing as Bubble’s :count operator.)

And then we will push that value on to List Shifter’s Processed List:

And in design mode, I’ll just display that list in text element, so we can check our work:

Let’s go to preview and see if it works!:

AWESOME! Now we have our list of number of concerts each Concert Goer is going to, just like we need it.

Now we can use List Shifter’s SORT action to do the mapped sort:

:point_up_2: To do the sort, we need to provide some information. We tell List Shifter about the “Sort by” list – this is the list of values that we want to use to sort the Original List. In this case, we are using the list of numbers held in List Shifter’s Processed List.

The SORT action has three different sort modes (for Number, Text and Date). In this case, we want to use Number. And then of course we can tell it to sort either ascending (the default) or descending.

Now what will happen is that list which represents “# of concerts” will be sorted low to high… and our list of Concert Goers follows along with it. We cannot actually change the order of our Concert Goers in the Original List, so our sorted values appear at List Shifter’s “Shifted List” output.

To check my work, I again use a text element to see what I’ve done:

Now in preview mode, let’s see what we’ve got!:

BINGO! Now we can make that the source for our “SORTED” repeating group and this page will make sense again. So I set the RG on the right to be sourced from List Shifter’s Shifted List:

And I’ve hidden my “debug” text element and our preview looks like this:

Now, you might be thinking… GEEZ, this seems kinda complicated and does it take a long time to compute? The answer is no, it all happens in the blink of an eye. Check out this demo page here:

(Editor here.)