Suggestions - how to structure repeating group (Advanced Q)

Hi all,

Have a use case I’m hoping someone might be able to provide some advice on.

I’m trying to build a table that would show the following.
Screen Shot 2023-01-11 at 8.47.46 pm

This table represents subjects at a school, and the rankings of students.

The ‘Subjects’ in column A is an option set, that can grow as time goes on.
The headings in Row 1 ‘1st; 2nd; etc.’ are static and won’t change.

On first load, the table would look like this:

Clicking on ‘-’ would present a dialogue that allows the user to select a student. On selecting a student, an entry in the ‘Ranking’ table would be created, e.g.:

Ranking table:

  • School
  • Student
  • Class
  • Rank

Looking for suggestions on how I can create this table, so that it automatically displays the right student in the right cell? It feels like it would need a repeating group nested in a repeating group, but not quite sure how I can iterate the list of classes. I almost need the loop/order or proceedings to go:

  • Get first subject in Option Set (Print in A2).
    ** Get student from Rank table where Option Set = current option set and rank = 1
    ** Get student from Rank table where Option Set = current option set and rank = 2
    ** Get student from Rank table where Option Set = current option set and rank = 3
    ** Get student from Rank table where Option Set = current option set and rank = 3

And so on for each option in the option set…

The only way I can get it to work is by hard-coding a lot of things, and I want it to be dynamic as possible for scalability (I don’t want to manually build the screen for each school that may be onboarded).

Thanks!

Hi there, @thethinklab.au… if something like the following looks reasonable to you (ignoring the fact that it’s ugly, of course, but it actually functions pretty much as you described), the hard part isn’t making the table because I made this in about 10 minutes or so.

As you suggested, it is, indeed, a repeating group inside a repeating group. The main repeating group (which is vertical) has a data source of the subjects option set. The nested repeating group (which is horizontal) has a data source of a search for rankings (sorted by ranking) where the subject is the current cell’s subject, and the school is whatever school you need it to be. Note that the column headings are not part of either repeating group.

The tricky part (if I am thinking about all of this the “right” way) is that in order to get the empty inputs with dashes to show up, you have to have things in the ratings data type that correspond to each subject for each school. So, if you want to show the top 10 students for each subject for a particular school, you need 10 things for each subject for that school in the ratings data type, with each thing having a ranking (1 through 10, of course), but the corresponding student field is empty.

When you add a new subject, you would use a recursive backend workflow to create the necessary things in the ratings data type for the new subject for each school. When a new school is added, you would use a recursive backend workflow to create all of the necessary things in the ratings table for each subject for the new school.

Anyway, maybe someone will come along with a better suggestion (which might not be all that difficult to do), but I would likely go down the path I described, and I hope this helps.

Best…
Mike

Hi @mikeloc , thanks for the help!

I had started having a crack and was on the same path as you with the nested repeating groups.

I was stuck at the part of your response that I’ve quoted, so thanks for answering that. :slight_smile: It doesn’t seem unreasonable to populate the ratings table, without a student, initially - then have the user set the student over time.

My next issue is going to be around styling. On mobile the entire table will hang over the page, and I’m going to want the user to be able to horitzontally scroll the table whilst ideally keeping the subject column fixed. I did some digging and found a table that I basically want to mimic the behaviour of: Buffalo Bills 2023 NFL Depth Chart - ESPN

Page load:

Scroll horizontally:

Any thoughts on if that would be possible with the current approach of nested RGs?

Thanks again!