Update a specific value in another table

Hi, I'm new on appsheet and I'm working on a shopping app to save all the products I have already  bought and those I would like to buy.

I have the first table named DA PRENDERE where I have a number for quantity and an action  ( 👍AGGIUNGI ) to check the product .

Then I have a second table named PRESI where I have the list of all the product I've bought with some actions , date and a total number of products bought.

I would like, after clicking the action AGGIUNGI , to update the total number of  bought product.

So I have quantity 2 for milk in table DA PRENDERE and after click I want to change milk quantity in PRESI table.

03.png

 I tried to execute an action in another table.  Why in referenced row I can select only column? It's the right way? (I selected PRESI [PRODUCT] because the right one , QUANTITA, get an error about type of data). The action to call is UPDATE VALUE with 2 input, quantity and index (an ID created by myself) . [QUANTITA] and [ID PRENDERE] are columns or the specific value I clicked on, from these columns ?

 

04.png

 In UPDATE VALUE to select the right row I thought to use a behavior to check if the index of the product is the same saved in input .

Sorry for all my errors but I'm trying to understand this new logic of coding.

thanks

Solved Solved
0 2 192
1 ACCEPTED SOLUTION

Steve
Platinum 5
Platinum 5

@RAFFAELE_GOLD wrote:

In UPDATE VALUE to select the right row I thought to use a behavior to check if the index of the product is the same saved in input .


You claim you're new to the logic of coding, but I'm impressed with the approach you used. It isn't wrong but it could lead to complexity later as you continue to develop your app. Specifically, the expression here:

Steve_0-1729171560154.png

Should identify the one specific row you intend to update. A row is identified by its key column value. Your post doesn't make clear what the key column is of the PRESI table, but you did use ID PRESI elsewhere, so I'm going to guess that's it. If so, the Referenced Rows expression should be:

LIST([ID PRENDERE])

With this properly configured, the AGGIUNGI action will apply the UPDATE VALUE action to the one row of the PRESI table that has the key column value matching that of the ID PRENDERE column value from the row of the AGGIUNGI table.

With the above done, you don't appear to need the INDEX input:

Steve_1-1729172112967.png

Or the condition in the UPDATE VALUE action:

Steve_2-1729172407698.png

 

View solution in original post

2 REPLIES 2
Top Labels in this Space