0

Button with script to populate table

Hi. I have a database as per the model in the picture. 

1. Table with students.

2. Table with classes. Each class has a table of students (3) picked up from 1.

3. Table with assignments. For each assignment there is a table with the classes that were given that assignment (5).

I wanted a button that would automatically populate 6 with all the students that belong to the classes in table 5.

9 replies

null
    • Fred
    • 7 mths agoFri, August 30, 2024 at 3:20 PM UTC
    • Reported - view

    1) just to be clear, you have reference fields in table 6 that links to table 4 and 5 separately? or is Table 6 a child of table 5?

    2) Where will this button sit? Table 4 or Table 5?

    • John_Halls
    • 7 mths agoFri, August 30, 2024 at 3:55 PM UTC
    • Reported - view

    6. List of Students... is not a table but a view that uses the existing structure. So create a view in the 4. Assignments table with this formula

    '5. Classes with Assignments'.'2. Classes'.'3. Students per Class'
    

    And then in Edit columns put the Name of the student. If you need a unique list then group them together.

    • Alain_Fontaine
    • 7 mths agoSat, August 31, 2024 at 12:28 PM UTC
    • Reported - view

    Or:

    unique('5. Classes with Assignment'.'2. Classes'.'3. Students per Class'.'1. Students')
    
      • John_Halls
      • 7 mths agoSat, August 31, 2024 at 1:59 PM UTC
      • Reported - view

      I tried this and couldn’t get the view to work. Not sure what I was doing wrong. 

      • Alain_Fontaine
      • 7 mths agoSat, August 31, 2024 at 6:06 PM UTC
      • Reported - view

       Did you adapt the definition of the column to be displayed ?

      • John_Halls
      • 7 mths agoSat, August 31, 2024 at 7:05 PM UTC
      • Reported - view

       I was trying it prior to setting any columns. It doesn’t show any records. Had me flummoxed. 

      • Alain_Fontaine
      • 7 mths agoSun, September 1, 2024 at 12:38 PM UTC
      • Reported - view

       🤷‍♂️I took the database you uploaded, changed the formula defining the view, and then the formula in the column. Nothing more, nothing less. Version 3.12 for iPad.

    • John_Halls
    • 7 mths agoSun, September 1, 2024 at 1:49 PM UTC
    • Reported - view

    Hi    working as it should, thank you. I think it might have been a column formula that threw it, as you said. Maybe I was trying too hard to beat  to an answer and rushed it!

      • Fred
      • 7 mths agoSun, September 1, 2024 at 2:42 PM UTC
      • Reported - view

      love these posts where the original poster hasn't responded but others continue it.