How to modify a column value in a row when a new record is created in another table

Hello everyone

I’m trying to modify the value of a column in a row of a table based on a new record from another table.

I have two tables

  1. tb_Tables: [ID_Table], [Table_Number], [Name], [Bill], [Status]

  2. tb_Tables_Closed: [ID_Close_Table],[ID_Table], [total_value],[Payment_Cash],[Payment_CCard]

Is there any way to change the value of [Status] in tb_Mesas from “Open” to “Closed” as soon as a record is created in tb_Mesas_Fechadas for the same [ID_Table]

I tried to use a BOT, but in Behavior there is no option to change a record, only to add a new row based on another table.

I could also use the INPUT() function on a single table (a union of these two) but the beta is not working well

For such a simple data change INPUT() works. Perhaps you can share both your INPUT() expressions so that we can help you with them.

1 Like

Another workaround, if it fits your use case, is to use a virtual column for the status column and check ISBLANK([Related tbl_Tables_Closed]) to set it OPEN or CLOSED.

2 Likes

hello Joseph,

The INPUT() function doesn’t work properly, the beta version doesn’t show the default value and I need it to. When they release the final version it will be a good option

Hello TeeSee

Could you explain a little more this syntax for the ISBLACK() function? What do you mean [Related tbl_Tables_Closed]?

https://support.google.com/appsheet/answer/10106510?hl=en

I am referring to “Reverse References” automatically created in a “referenced” table.

You should have a [Related xxxxs] col in your tb_Tables:.

If a row is added in tb_Tables_Closed, the referenced row in tb_Tables via [table ID] should contain the key of that added row within [Related xxxxs].

ISBLANK([Related xxxxs]) tells is if any referencing rows are created in tb_Tables_Closed.

Combine this with IF() and you can control the value of STATUS by this expression …

IF( ISBLANK([Related xxxxs]), “OPEN”, “CLOSED”)

3 Likes

works perfectly fine

Thank you very much!!!

1 Like