Sorting Repeating Group Based On Calculation In The Repeating Group

Hello Everyone!

I am trying to sort my repeating group based on a calculation which is run in each in each line of the repeating group.

The options seem to only let me sort the repeating group based on data in the database. There is an option to sort based on a dynamic field, but the inputs in the repeating group do not appear in the “dynamic field name” section.

Does anybody know if this is possible/ how I would do it?

Many thanks,

Ben

Please pick a subcategory to help organize the information. Thanks!

Also, the more context you provide with your questions (screenshots, link to an open app, etc.), the more likely you’ll get good help quickly :slight_smile:

1 Like

Hello @bentomsouthgate,

There are many ways to go about this. One basic one could be:

  • Create a number field in the thing that you want to sort for
  • Seems that you are running the calculations on the RG if a user does something in the row
  • Once the user clicks something on the row to run the calc … update the row’s thing number field accordingly
  • Sort the RG based on that thing’s number field

The above is not the most performant way to do something like this. But… without knowing how your dB is structured, the UI, the UX … this should at least get you started. :+1:

1 Like

Thanks @cmarchan ! unfortunately, I’m trying to create a solution that does not involve saving the data to the DB as the data is dynamic and just calculated on the page.

To give you a bit of background I have a list of phones with scores from 1-10 for different features.

Users can set their preferences on what features matter to them the most and a score is calculated showing based on their preferences what phone best suits them…

So the repeating group pulls a list of phones and each line is a new phone.

Users can play around with their preferences so the score being calculated for each phone is dynamic.

The score is calculated on the page and not saved to the DB. Do you know a workaround for this without saving the data to the DB?

Thanks,

Ben

Perhaps the easiest way is to use this very useful plugin by @keith

Hi @cmarchan

Thank for the advice. It seems that even with this tool, I can still only sort the data by values saved in the database rather than values calculated in the repeating group

Thanks,

Ben

1 Like

Some discussion on this topic here…

This topic was automatically closed after 70 days. New replies are no longer allowed.