Best way to update object and relations 2 levels deep using Codeless

Expected behavior:

Say I have table Parents that have 1:N relations with table Students. Students in turn have 1:N relations with table Tutors.

Something like this:

    "parent_name": "Aderonke",
    "created": 1610025386000,
    "Students": [
            "tutors": {
                "tutor_name": "John",
                "phone": "123",
                "created": 1610027425000,
                "objectId": "D3E311E3-EB15-485A-9842-07A12F871ED6"
            "subject": "Maths",
            "created": 1610027323000,
            "student_name": "Panos",
                    "updated": 1610027643000,
                    "objectId": "823D9812-0CB8-49B1-907E-ABEA5698C762"
  1. I check if objects in Parents need updating versus a property in an external list :white_check_mark:
  2. I now want to check if the relations 2 levels deep (Students and Tutors) need updating as well.

I am trying to use a load table block with dot notation like this

But I only get 1 object from the 1:N relations. Is that normal?

Alternatively I can load table by specifying properties and relations depth. However I would need a sequence of complex nested IF/else statements to check if each relation needs updating (if the related object exists, if the relation has changed, etc.)

What is the best way to check objects with relations versus an external list and then update them?

Hi @Andreas_Marinopoulos,

When you specify a list of properties, you get them as property values rather than related objects. If you need to get the related objects, you need to use either the relations connector or the relations depth connector.


I have an additional question on getting a list of properties from related objects

If we take a schema example like the above, and I am loading the Tutors table (which is a child of Students, in turn a child of Parents), is there a way to load properties of a parent related object?

I know that if I am loading the parent table, I can include child table properties with, for example subjects.tutors.tutor_name, but is there a way to go the opposite way around? From child to parent?

Hello @Andreas_Marinopoulos

Yes, you can:
See more detail - Inverted Relation Retrieval

Perfect, this worked!

Strangely, if I try to retrieve the parent objectId together with the child objectId, it will not do so. Any other field is fine. If I do each separately, it is also fine (eg. parents[slots].objectId works on its own). But the combination only gives one objectId.

Is this because the field name is the same?

Hello @Andreas_Marinopoulos

Seems like they are both named objectId, could you please try the following:

parents[slots].objectId as parentObjectId

This is what I get

did you add the entire string: parents[slots].objectId as parentObjectId
or just parentObjectId?

I tried both this

and this

and got an error.

The second approach would not work since there are 2 parent tables in my schema that contain a slots relation.

both of these are not equal to this parents[slots].objectId as parentObjectId string

I am not sure exactly what you want me to try, could you screenshot it please?

1 Like

got it, trying now

it works, thank you.