Sorting repeating group by value computed

Is it possible to sort a RG by a value that has been computed via a dynamic text search?

Above i have a RG with a list of users. I want to sort this RG by total points. The total points has been computed via a dynamic search like so,
Screen Shot 2021-01-27 at 10.36.42 pm

Normally i would apply a sort to the RG data source but in this case, I dont think it can.

Any ideas on how I can achieve this?

  • Create a field on the User with Total points.
  • Update this field automaticly with the database triggered workflow that will calculate the total points every time you update related numbers.
  • use this field for sorting in the RG

Unfortunately that won’t work as every user can have multiple leagues they are apart of so this total points field will not be unique.

Hello!

Nest the text element into a group of type number (an easy way is just to right click on the text element and choose the command “group elements in a group”).

Write the same expression that the current text element has as a data source for the nesting group of type content “number”.

Set the text element to display parent group’s value so that the content of the parent group can be displayed by the text element.

You now can use that group’s number value for math and likely … sorting purposes.

Hope this helps :+1:

Hey @cmarchan
I have grouped the text element and created the data source for the text content but now I am a little stumped as to how I can now use that groups number value for sorting purposes. Ive explored the :sorted parameter and seeing if I can use that groups’s value via the dynamic field option but it doesn’t appear. Any thoughts on how I can use that groups number value?

I don’t believe this is doable (sorting on a calculated value) without the use of a plugin. If you do some searching on the forum you’ll see some other threads on this and a couple of plugins people use.

@ed727 I believe you are right. @stuart.warren1 my suggestion was geared to enable you to use the result of that expression in a viable way where possible in your app. It was “trapped” inside the text element. Now it is not.

To sort the RG you will likely need to store that value in a number field of the RG’s data source thing.

Or pre calculate it prior to displaying it in the rg.