How to update a column in another table when a row is selected?

I'm building an AppSheet app where users can select a Client from the Clients table, and I need to update a field(selected_client) in the Users table to store the selected client for the logged-in user.

Here's what I'm trying to achieve:
When a user clicks on a client in the Clients table, the selected_client column in the Users table should be updated with the client's name.
The update should only affect the row where [Email] = USEREMAIL() (so each user has their own selected client).
Every time a new client is selected, it should overwrite the previous selection.

My Questions:

  1. What is the best way to update a column in another table (Users) when selecting a row in Clients?
  2. Should I use an action inside the clients table to trigger this update, or is a bot enough?
  3. Is there a more reliable approach to store a "session variable" for the selected client per user?

My main goal is to have a app with a navigation structure like this:

Client Selection → 1.0 Menu → 1.1 Submenu KPI Framework → 1.1.1 KPI Framework

I have a table called KPI Framework, which contains a column Cliente that identifies the associated client for each KPI and  I need to display only the KPI data where Cliente = the previously selected client.

Any guidance would be appreciated! Thanks in advance. 

0 1 43
1 REPLY 1

In general, you could do the needful with reference actions

1. When the client is selected in the Client table, you could use event of "row selected " to include the reference action stated in the point 2 below as an event action.

Run actions based on view events - AppSheet Help

Suvrutt_Gurjar_0-1742270420997.png

 

2) Define a reference action that runs as an event action when the Client record is selected and updates the column in the Users table for the logged in user using USEREMAIL()=  [Email]

The sample app about reference actions  from the help article Get started by using the sample apps - AppSheet Help is given below

Reference Actions - AppSheet

 

 

 

Top Labels in this Space