Hello, in the data browser, tables that have an incoming “parent” relation from another table have a column that says “Relation From” and “This is not a real column, it is a cue that another table has a relation to this table.” And each record offers a link to the parent record.
Given a child record, how can I query for that parent record?
The child records are quite large, and each parent record has many of them, so querying the parents and sifting through relations would return a huge, unworkable amount of data, so that is not an option. It’s a design flaw - I wish I had stored the parent’s object id in the child records but it is too late.
Thank you,
Kelly
Hello @Kelly_Oglesby
Let’s consider you’ve got two tables: Parent and Child and the Parent table has a column children
which is a relation 1:N to the Child table.
So your query will look like: children.objectId = 'CHILD_OBJECT_ID'
, you need to apply the quire for loading Parent object.
Is that what you are looking for?
Regards, Vlad
Hi Vlad,
Actually, the opposite is what I need. If I have the child record, I need to get the parent that points to it. It appears to be stored, or queryable, since the “Relation From” column is able to display it, but I don’t see the syntax that would be required in the documentation.
I want the record the link in this picture would return:
Thank you!
To query xdev_people
(which I believe is the parent table), you need to send a request to that table with the following where clause:
compliance.objectId = 'value of the child objectId'
Regards,
Mark
Thank you, Mark, that’s perfect. I’ll try to think up a harder one for next time.