Help setting USER_ID based on USEREMAIL() in an Action

I have an action to set values in three fields when the user clicks it. Two fields work, simply setting one field as “Yes” and one with “TODAY()”.

2X_1_1e5cd450864cec798d34888fd9adc21be79c7dc9.png

I have a USERS table with USER_ID and USER_EMAIL. I want to compare the logged in user’s email, USEREMAIL() to the matching/ referenced USER_EMAIL in the USERS table and pull out the USER_ID to put that value in the 3rd field.

2X_1_188cfa11389ab698b90eb5e30e9bc5b2260ec84f.png

I just can’t get it to work even after researching dereferencing, LookUP() and more.

This is my latest attempt for the action setting the value:
IF(Users.USER_EMAIL=USEREMAIL(),Users.USER_ID,"")

These are the relevant fields in my main table, the ones I want to set with the action.
2X_b_ba6c8480744b97e9a480f7be24f3ccaf54666fec.png

Could it be because I’m trying to set the value of field with a REF field type? If so, if I change it to text, how can I access that related record email in other parts of the app?

Thanks in advance for helping me through this MAJOR BLOCK.

Lucinda

Solved Solved
0 4 1,149
1 ACCEPTED SOLUTION

In general the “dot” notation is used when you already have a row identified, such as when a Ref column is set - it points to a specific row. Then you can do [Ref Column].[Other row column]

In this case for you, I think you need to use the LOOKUP() function:

LOOKUP(USEREMAIL(), "Users", "USER_EMAIL", "User ID")

View solution in original post

4 REPLIES 4

Steve
Platinum 4
Platinum 4

Users.USER_EMAIL isn’t a recognized form of expressing anything; AppSheet sees it as "Users.USER_EMAIL", a text value. To reference the value of a column, enclose the column’s name in square brackets: [USER_EMAIL].

Thanks Steve,

I’m still missing something. I tried IF(Users.[USER_EMAIL]=USEREMAIL(),Users.[USER_ID],"")

This action is not on the USERS table. It is on my main table, JF_PI_PRAYER_REQUESTS. Is that why it can’t find the USERS table? If so, how do I pull data from the USERS table to populate the field I am trying to?

2X_8_8af2c72de7d9d07da09a448ae80b650022f47892.png

In general the “dot” notation is used when you already have a row identified, such as when a Ref column is set - it points to a specific row. Then you can do [Ref Column].[Other row column]

In this case for you, I think you need to use the LOOKUP() function:

LOOKUP(USEREMAIL(), "Users", "USER_EMAIL", "User ID")

You did it John. I made one minor field name correction, LOOKUP(USEREMAIL(), “Users”, “USER_EMAIL”, "User_ID”)

Thank you so very much.

Top Labels in this Space