Sorting users into groups based one field values

Hello!

I am creating a program for teachers to use in their classrooms. Every classroom have a list of users (students) and each student has a field called “category” and it can be one of 4 options.
I want to sort the classrooms users into groups based on their “category”. The size of the groups can vary depending on the teacher’s preference.

The different categories that the users can have are red, yellow, green and blue.

If the groups consist of 2 people, there are certain restrictions (this condition is the best case scenario, if users of that certain type do not exist, groups that defy this condition can still be created):

red can’t be with green
yellow can’t be with blue

if the groups are anything else they should optimally contain one of each category

Example 1 (4 people)
1 red
1 yellow
1 green
1 blue

Example 2 (7 people)
2 red
2 yellow
2 green
1 blue

Example 3 (3 people)
1 red
1 yellow
1 green

I would then like to present these groups.
The number of students can vary from classroom to classroom.

How would I go about creating this function?

Thanks for help!

hi @jakob.askling - you could create a repeating group for “Example” and within each “Example” cell you could have a text field. In that text field, do a search for Users that are in that respective RG’s Example (each User would be associated to their respective Example, ie Users1-4 associated with Example1, User’s 5-10 with Example2, etc.). So when you create an “Example” #, you’ll need to add respective Users to it (or alternatively add an “Example” field to Users and your RG search would be on Users ==> Example)

When you create each User, there’d be a “Color” field for them (red, yellow, green, blue). In the text field you’d have 4 search items - 1 for each color within that cell’s Example#.

Make sense?

1 Like

hi, sorry but unfortunately I could not understand that @nikolai. What does RG mean?
And one thing I forgot to mention is that every time you generate a new classroom with groups of students the groups must change. This might make it a bit tricky, but it is necessary to ensure that you don’t always end up in the same group.

hi @jakob.askling - RG is repeating group.

When a new Classroom is created, what’s the criteria (or rule) that’s used to re-allocate Users (Students) to a respective Classroom?

1 Like

hi, every classroom has a classroom code which is a number. When a student writes the corresponding number in an input it does a search for the classrooms and adds the matching it to the student’s classroom list. The students color will remain the same always but the student’s classroom list can change depending on what he/she connects to. The classroom will then access the students color to shuffle them into fitting groups.

I might have expressed myself wrong, the classroom stays the same with its list of user (students). But you’ll want to reshuffle the students into new groups now and then ( still in the same classroom but in new groups)’

Does that help @nikolai?

@jakob.askling - sounds like you have at least two personas, Student and Teacher (or Admin) but I’m not sure what each one is capable of doing (ie who shuffles Students into fitting groups? What is a fitting group, What does being in same classroom but new group mean (is group = color?) etc). As such, the following data structures should give you the flexibility to create workflows and achieve the functionality for each persona.

Under Data Type “User” add two fields, “Student Color” (type text) and “Classroom ID” (type List of Classroom).

Create a Data Type “Classroom” and in it add four fields for each of your Colors (type List of Users).

Your Student persona will get created with an appropriate color. Based on your workflow, the Student can select which Classroom(s) to belong to. I suspect the Student will have a pulldown menu to choose Classrooms or some other way to list Classrooms? The workflow can then add the Student to the respective Classroom’s Color which matches the Student’s Color

You Teacher/Admin can have access to all the Classroom’s Colors and take appropriate actions (whatever they may be)

Hope this is helping you get a little closer…

1 Like

Yes, this will be of great use.
Thank you for the help @nikolai

1 Like

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