Associating children to parents from parent's detailed view?

Is it possible to associate children with parents from the parent item’s detailed view?

I have a Parent has many Children relationship between two tables. In the detail screen of Parent items I have an inline list showing all the children related with the parent.

Is there an option or a workaround to allow users to be able to link children with parents from the parent item’s detailed view?

I am thinking about the possibility of adding an ‘Add Child’ button below the inline list. That button would open a screen (form?) showing the full list of children and then when I click on an item it should associate the child item with the parent item and go back to the parent item’s detailed view.

Hola @gusa ,

It is posible. Make sure that in your “Log sheets/table” you are also registering the parent’s ID. Then use a relation to bring such info to the parent screen.

1 Like

Yes. I imagine you’d use the inline list of all children > view Details > add a button that has a compound action:

  1. Set column action to assigned the “Parent ID” to the User’s Parent ID from the User Profile sheet.
  2. Show notification action of “child assigned”
  3. Go back action
3 Likes

Thank you. Quick question, how do I register the parent’s ID in the User Profile table?

A way to Natively do this is to create a RowID in the Glide Editor.

What do you think @Robert_Petitto ?

Either you create a rowID column or on your onboarding experience, set a unique identifier to a unique ID column.

I might be way off, but my working hypothesis right now is that you and @SantiagoPerez are utilizing the User Profiles table as a place to store session variables. In my example, I would use it to store the Parent ID at some point of the flow so it can be assigned to the Child’s Parent ID field deeper in the flow.

Am I missing it completely?

I’ve done something similar in this app
Tareas escolares.
When a student logs in, the app ask for parents email. Then a parent logs in and in the Gsheet I use “vlookup” to find which student has registered that email. The column “correo alumno” (student email) has always the student email. It’s the same as “correo usuario” (user’s email) if user is a student or the one vlookup calculates if it’s not.


(This is fascinating because it gives me an idea for another app that I have in mind related with a gamified app for parents and kids that allows parents to give awards to their kids when they sleep all night long in their rooms.)

However, let me reformulate my question because I might be wrong but I think that your answer is not related to my question.

Let’s say that I want to model an admin app for science clubs where I have students that form groups and their work is organized in activities.

Activities have a starting date and an end date and they are assigned to sub-groups from the main group.

I’d like to have a tab showing Activities grouped by Group. Then, when I click on an Activity I want to see the details including an inline list with the students assigned to the Activity.

From this detailed view, I want to be able to select students from the main group and add (assign) them to the Activity. (I also want to remove them from the Activity, but I already solved the problem.)

In order to do that I created a tab listing the Activities (grouped by Group). Then (for the sake of giving more context to this explanation) in the Activities > detail view screen I have an inline list with the students assigned to the Activity. Then I want to either show a list of students in the Group so I can assign them to the Activity being displayed, or have a button that takes me to a screen containing the list of students in a Group.

In either case, I want to be able to select an item from the list and trigger an action that assigns the student to the parent Activity (either the one being showed or the one from the previous screen).

How can I access the parent Activity’s ID from the inline list of students so that I can assign it to the student’s Activity?

Would you mind giving us a few screenshots/video of how you have everything set up?

If I’m understanding correctly you want to bring the ID from the category tab. For that I’d use a relation on the activities tab that matches the category in that tab to the category in the other tab. The a lookup to the the ID so you can be able to use it later.

Let us know if this is what you’re looking for.

Can student’s be involved in more than one activity?

I agree with @SantiagoPerez Perhaps with a screenshot I could understand better what you need.

All students in subactivity A1 are assigned to activity A?

Let’s say no.

In this app you can assig a student to an activity (no subactivity) or assign a student to both a subactivity and its parent activity.
It’s made with relations to a unique row in an aux sheet. If this is what your are looking for I can show some screenshots

3 Likes

I think this is very similar to what I am trying to solve. Maybe I am overcomplicating things because I am new to this Glide!

Please do share some screenshots! Where can I learn more about these auxiliary structures to store user session data?

This is how I would have approached it as well…well done @profechef.

1 Like

I have a sheet “Aux” with only one row. The A0 is the code used in the relations. Columns “Actual Activity” and “Actual Subactivity” are used to store the activity and subactivity that are been watched by the user.
image
Activity’s tab has column filled by an array formula with “A0”.
image
This column is used to make a relation with “Aux”
image
Activity’s list action is composed. First it sets Actual Activity in Aux sheet with Activity’s code. Then View details
image
image

Students’ tab also has a relation with A0 row and the students’ list also has a compound action, which sets Student activity with Actual activity in aux.

All this is replicated in Subactivities tab. In this case the compound action sets activity and subactivity student columns.
You can copy the app and its google sheet

1 Like

@Robert_Petitto @SantiagoPerez @profechef I think I made it with all your help!

Let me try to explain it briefly.

Step 1

I created an (auxiliary) Glide table named Session with one row and the following column specification.

  • ID: Template field with the value “1”
  • Session User ID: User specific field
  • Session Activity ID: User specific field

Step 2

I added the following fields in the Users table.

  • Session ID: Template field with the value “1”
  • Session: Relation column to the Session table
  • Session Activity ID: Lookup field that I’m using use later to link the student with the activity.

Step 3

I added the following fields in the Activities table.

  • Session ID: Template field with the value “1”
  • Session: Relation column to the Session table

I needed this step to be able to have access to the Sessions table from an Activity entity in a Set columns action (see Step 5 below).

Step 4

I created an empty tab (source Users) to list all the activities. (I needed to create a tab from scratch because the predefined tab for Activities doesn’t allow me to select the list and add a custom action.)

Step 5

I added an inline list of Activities to the new tab. Then I created a new compound action for the inline list with the following steps.

  1. Set columns action. In the table Session sets Session User ID = User.Row ID and Session Activity ID = this.Row ID
  2. View details action. Let the flow to move forward.

With such a mechanism in place I am able to ‘save’ the current Activity ID ‘globally’ (within the scope of the user’s session) just before I open an Activity.

Step 6

In the Activity detailed view I added an inline list of students associated with the current activity. Then I added a second inline list with all the students. The latter is the list I’m going to use to assign students to the former list.

Step 7

In the list of all students I added a ‘Set columns’ action that assigns the lookup field Session Activity ID in the Users table (previously saved in Step 5) to the student’s Activity ID.

I think that’s more or less what I did.

Some notes:

  • Fields Session User ID and Session Activity ID are user specific in order to avoid messing up with other user sessions.
  • I created the table Session as a Glide table I don’t know why, but guts tell me that it’s cleaner than having it as a sheet.
  • The field Session ID in Users and Activities tables is a template because I don’t know a better way to set a ‘read-only’ field with a default value. Since it’s a template field it’s nice that it lives in the memory.

Thank you so much for your help. I will keep learning and iterating these ideas over.

1 Like