I have a Data Field called ‘DirectReports’ which contains a list of numbers (Child IDs) and a list of texts (Child Names) like shown below:
I would like to present them in a repeating group such that each student name and their ID are displayed separately in each row. However, I am struggling to do this and instead I just get the whole list on each row like below:
This can be done the way you set it up but the DB scheme is not set up properly. You should have a directReports dataset / table and in it a childId and childName field.
Yes I do. That’s the first Step. Especially since you have emails as well. As you see, instead of 3 lists in DirectReports, it should be one a child that has those 3 fields. This is very basic, and you should learn the fundamentals before continuing to work on your app. It’s not as fun but it will save you hours and hours of torture and headache.
Okay, so if I understand you, you’re saying to just use a regular database without the use of lists? This way all fields are one-to-one.
I use this structure in plenty of other tables, but what I was experimenting with is how to do this using lists to save on creating multiple entries for each teacher (if you follow the logic - there are multiple students per teacher).
If this approach is not appropriate, then I’m interested to know when a list should be used in a database? Because it seems as though it creates more of a headache than anything else, like you mentioned.
That is not what I’m saying. Lists are a critical part of an DB. Just because something is a list doesn’t mean it has to be broken into different fields and have a list of each field. Consider: How would you link Child Id 9 to Beth Ranger? Sure you can use index 0 fo each array but if anything gets sorted or modified you’re in a huge mess…
Lists/Arrays are critical for a robust Database
So yes USE Lists but don't create lists of multiple fields that are linked to each other; instead, create a list of records that contain all those fields.
See the DB diagram below. The top table shows how you are doing it. The bottom tables are how it should be done. You should be able to see how much cleaner and easier it is to manage and determine relationships between the child’s data (i.e., their name and email).