Trigger an action from two different table simultaneously

Hi All,

I just need some help, please. 

I have 2 tables in my app,  Table 1 and Table 2.

Each table has an action - Action 1 (in Table 1) and Action 2 (in Table 2).

If I trigger Action 1, is there a way to also trigger Action 2 simultaneously?

For example, if I run Action 1 in Table 1, it will trigger Action 2 to change the value of a row in Table 2.

Noob here, so please be a little more elaborate on your answers ๐Ÿ™‚ 

Solved Solved
0 4 496
1 ACCEPTED SOLUTION

Aurelien
Google Developer Expert
Google Developer Expert

Hi @Aaron_B 

 

Yes it's possible.

What you need to do is:

-create your Action1  from Table 1

- create your Action2 from Table 2

- create an Action3:  with these settings:

==> For a record of this table : Table1

==> Do this : "Data: execute an action on a set of rows"

==> Referenced Table : Table 2

==> referenced Rows: a FILTER() expression, I suggest you have a look on the help documentation for this part

 

FILTER("Table2", yourCondition)

 

==> Referenced action: Action2

 

- create an action "Grouped : execute a sequence of actions" from Table1 with these:

==>Action1

==>Action3

 

Let us know  if you have some trouble into implementing this.

 

For reference:

https://help.appsheet.com/en/articles/2357308-filter

 

View solution in original post

4 REPLIES 4

We need explanation by what parameters action 2 would know which row to change in Table 2

Aurelien
Google Developer Expert
Google Developer Expert

Hi @Aaron_B 

 

Yes it's possible.

What you need to do is:

-create your Action1  from Table 1

- create your Action2 from Table 2

- create an Action3:  with these settings:

==> For a record of this table : Table1

==> Do this : "Data: execute an action on a set of rows"

==> Referenced Table : Table 2

==> referenced Rows: a FILTER() expression, I suggest you have a look on the help documentation for this part

 

FILTER("Table2", yourCondition)

 

==> Referenced action: Action2

 

- create an action "Grouped : execute a sequence of actions" from Table1 with these:

==>Action1

==>Action3

 

Let us know  if you have some trouble into implementing this.

 

For reference:

https://help.appsheet.com/en/articles/2357308-filter

 

@Aurelien, YOU ARE AMAZING! That is exactly what I needed. Thank you so much! Great explanation too! 

jdtylerdev_0-1697896332956.png

In Table B, you can create a column X that references Table A by making column X a Ref type and setting the Is Part Of? option in the column's settings to TRUE with an Initial Value of [_THISROW].[Column X].[ID].

This will create a dynamic link so that when changes are made in Table A, they are also reflected in Table B.

For example, let's say:

  • Column X in Table B is called [OrderID] and links to the key column [ID] in Table A.
  • Both tables have a column label [STATUS] that is used to track the status of orders. This column is an enum type with two possible values: Started and Completed.
  • You have an action in both tables that you want to fire anytime the status is changed in Table A.

To achieve this, you can:

  1. Configure both actions to trigger using the following formula:
[_THISROW_BEFORE].[Status] <> [_THISROW_AFTER].[STATUS]

This formula will cause the actions to fire only when the value of the [STATUS] column changes.

  1. Configure a referenced action for Table B to set the value of [STATUS]. This action should use a LOOKUP expression and have its behavior set to TRUE so that it only fires when called on.

  2. Configure a BOT workflow that, if the value of [STATUS] is added or updated in Table A, will update the value of [STATUS] in Table B using the referenced action in Table B.

This setup will cause both actions to fire anytime the [STATUS] column is added or updated in Table A. The value of the [STATUS] column in Table B will also be updated by the BOT workflow.

Additional notes:

  • The [_THISROW_BEFORE] and [_THISROW_AFTER] variables refer to the values of the row before and after the change, respectively.
  • The LOOKUP expression can be used to retrieve the value of a column from another table. For example, the following expression would retrieve the value of the [STATUS] column from Table A for the row with the ID that is stored in the [OrderID] column of the current row:
LOOKUP([_THISROW].[OrderID], "Table A", "ID", "STATUS")
  • The BOT workflow should be configured to listen for changes to the [STATUS] column in Table A. When a change is detected, the workflow should update the value of the [STATUS] column in Table B using the referenced action. and Both of you actions in seperate tables should trigger on a data change of the[STATUS] column in their respective tables.
Top Labels in this Space