Passing values to a form from a grandparent record

I have asked this question before but I think my understanding of appsheet has improved enough for me to better explain my question.

I have a I have a table called “Sessions” that has the following columns
Session ID (Key for this record)
Client (Client id for this session)
Assigned Objectives (Virtual column listing all of the assigned objectives for this client from a table called “Assigned Objectives”)

“Assigned Objectives” has a behavior that opens a new form for a record in the table “Objective Utilizations” filling in data from the “Assigned Objectives”

Selecting one of the rows in “Assigned Objectives” opens a form and enters the data for a new “Objective Utilizations” record.

I would like to also pass the “Session ID”

In PDF Templates you can do something similar with a [_ThisRow-1] to access a grandparent record.

But that ([_ThisRow-1].[Session ID]) does not work with the expressions I enter for the behavior.

Is there a way to access this grandparent value in the expression for the bahavior?

I already have a quasi solution that I use at present (Detailed below) but it I think there must be a more elegant way to accomplish this.

Current solution

A behavior when the session is opened that sets a status column in the current record column to true after setting any other trues to false.

Then the “Assigned Objectives” behavior sets the “Session” column in “Objective Utilizations” to the value returned by doing a lookup for the row in “Sessions” that has true set as its status. But this adds two extra sync actions.

Hi @Mark_Taylor ,

It sounds that you are trying to build a relation between grandchild and grandparent record to pull in some values from the grandparent record.

You may wish to take a look at the following article and especially the section " Double Dereference Expressions"

If you are looking for something else, I request you to post which is grandparent, parent and child table in your case and respective columns so that I believe the community may be able to help better.

4 Likes

I have used that article to accomplish other actions elsewhere in my app.

I don’t think it will work in this situation unless I can put a virtual column in the Objective Assignment that somehow references the session record that is displaying it.

GrandParent = Session (with a Client Column)
Parent = Objective Assignment (reference to the Client Column)
Child = Objective Utilization

Yes, inclusion of a VCs is necessary in the approach described or the approach that I know of.

Sorry, I may not be able to add further. I believe , someone else may share inputs.

2 Likes

Hi @Mark_Taylor I’m also looking for the possibility to access the grandparent value via [_THISROW-1].[Grantparent_ID].
But as @Steve mentioned here, it’s not possible.

3 Likes