Confused about reference to child reference with [Related Rows]

This is a minor issue that can be solved with a VC, but I would like to understand what I am doing wrong, or if this is simply not meant to work the way I expected.

I have a parent table (session), with related child entries (session_users). There is a lookup table (users) which contains properties for the child entries. Can be seen in this sample app https://www.appsheet.com//templates/?appGuidString=1503869e-e9fe-4c60-8067-ea908a1a3c34

The issue arises when I attempt to use [Related Session_Users] to reference values from the Users table, while looking at the Session (parent) table.

[Related Session_Users][ref_user_id]

Returns the correct key for the Users table, but trying to use that key in a SELECT, fails

SELECT(
  Users[user_property],
  [user_id]=
    INDEX(
    [Related Session_Users][ref_user_id]
    ,1)
)

It returns the correct value, but ALSO the last row of the Users table.

I can add VC's to the User_Sessions table to get all the columns from Users that I might want to display in Session, but I was trying to minimize VC use and it feels like I am making an error here somewhere.

 

temp.png

0 6 93
6 REPLIES 6

It sounds you have the value 103 twice in your table.

It is not repeated.

I made this example app to demonstrate. I ran into this issue in a more complex app, when trying to reference child reference data in a form, and it produced much more confusing results, but fundamentally it appears what while I can return the correct key, I can't use them in a SELECT. IN(,) produces the same results.

SELECT(Users[user_property],IN([user_id],[Related Session_Users][ref_user_id]))

 

The issue manifests in a simple detail view as well.

Is this not supported? Am I missing something? Or do I simply use VC's to pull child-reference data, so that they can be referenced in the parent via [Related Child][VC of the child reference value I want to look up]

Other ref_user_id's will produce the same result (the correct row, as well as the last row).

Screenshot 2024-03-20 155008.png

What happens if you write SELECT(...,[user_id]="103")?

One value returned, and the correct one, as expected.

The issue manifests with [Related Rows]

What is the value that brings 6000?

The erroneous record is being pulled from from another row in Session_Users (sheets had reverted a deletion).

[Related Session_Users][ref_user_id]

Returns the correct key (and only one), but in the context of SELECT:

SELECT(Users[user_property],[user_id]=INDEX([Related Session_Users][ref_user_id],1))

[Related Session_Users][ref_user_id] is returning all (?) rows in Session_Users.

Is it just not supported to do this kind of lookup? Or am I doing something wrong syntactically? It's not obvious to me what to change to make this function, if it's possible. 

Top Labels in this Space