How Do I automatically Create New Line in New Table when Conditions is met

Hello and Thank You for Advance

On GoogleSheet, they have the option to do for the Script Editor and I am wondering if AppSheet database have the same features. 

On "Table1" where they have main columns such as "Name, Address, Phone, Email, Status, Sub Status, Date, etc" and depending on certain column "Status" and "Sub Status" is being selected by the user, a trigger will happens: Certain columns from "Table1" (Name, Phone, Email) are being duplicated and placed on new lines in "Table2" respective columns (Name, Phone, Email)

IF ("Table1[Status]" AND "Table1[Sub Status]") = TRUE
THEN DO/CREATE New Line on "Table2" with "COLUMN 1, COLUMN 2, COLUMN 3, FROM Table1"

This to me is too complex for me to archive since Im new with AppSheet, I appreciate if anyone willing to help me - Thank You

1 12 320
12 REPLIES 12

Create a Bot for the Table 1 and input a condition when this bot should trigger a Process.

In the Process select "Run a Data Action". Then on settings of this Process select either

"Add New Rows", then select Table 2 and assign the values for the new row in that table. Do not forget to use [_THISROW_BEFORE].[_column_name_here] or [_THISROW_AFTER].[_column_name_here] 

OR "Run Action on Rows", in this case you should create an Action separately from this Bot for Table 1 which will copy values from Table 1 to Table 2 according to your logic. Then select Table 2 in the Process settings and use a filter if needed for the activation of the Action.

Might seem a bit complicated but after some practice you will see it is very easy. 

@Elvic @dbaum 

Thank you for your replies,

I watched the video tutorial, read the documentation, and attempted to follow your advices but I am still confused on few steps.

I managed to set the Status Trigger as below:

2023-03-13 21_24_46-Threshold Sample App 2023 - AppSheet.png

On next step I selected "Run action on rows" via selecting the Main Table aka "Gexa Sample", along with the columns that I wanted to Copy to 2nd Table. However, the Referenced Action only allow "Delete"

2023-03-13 21_34_19-Window.png

 

The highlights are the ones I wanted to copy to the 2nd table:

2023-03-13 21_25_56-Table Data - AppSheet.png

“Delete” that you see in a dropdown is the only available action for this table. 
you have to create an Action in a separate menu (not here in Bots) which will be copying the rows from Table 1 to table 2. Then select this Action in this dropdown.

I also see some unusual stuff in the row above the dropdown. Clear it first to understand how the system works, them you can add conditions you need to flitter the rows against which the action will be activated.

if it is still not clear I can create for you a sample app to show how it works so you can look under the hood. Let me know. 

Hi @Elvic 

I deleted the Bots section and went to Actions instead:

On the "Set these Columns" How do I set the condition to "copy" entire row from first table and then "paste" the row in different table?

2023-03-14 17_40_48-Window.png

Actions can be triggered manually or by bots. So it will not automatically copy the line/lines without a bot. 

To add a new row to Work Orders you need to set the values for each column in "Set these columns" section

By setting behaviour "Only if this condition is true" you are making the Action Link (button) visible/invisible for the user in the related view. It has nothing in common with triggering the Action. 

Bot will not be trigger the Action if this condition is not met.

@Elvic 

So I removed the Behavior "Only If This condition is True"

2023-03-14 23_36_26-Threshold Sample App 2023 - AppSheet.png

And then added a new Bot 

2023-03-14 23_36_26-Threshold Sample App 2023 - AppSheet.png

2023-03-14 23_36_38-Threshold Sample App 2023 - AppSheet.png

I ran the test

2023-03-14 23_36_48-Threshold Sample Database 2023_ Gexa Sample - AppSheet databases.png

But I failed

2023-03-14 23_36_57-Threshold Sample Database 2023_ Work Orders - AppSheet databases.png

Im confused on what I did wrong here

here are two options you have:

1. you add a row right from the Bot Process, like you did know. The thing you did wrong is that you referenced the values incorrectly. It must be [_THISROW_AFTER].[CSP] for the CSP column in GEXA Sample. So you can get values from GEXA Table before the update - [_THISROW_BEFORE] and after the update [_THISROW_AFTER].

2. Another option is to trigger the separate Action using the bot. In this caxe you are able to trigger the action for many rows. Select "Run action on rows". Then select GEXA Table and then select the Action you have created for this table. You can keep the filter window empty just to start with.

If you fail again you should probably share with me you app and I will show you the machanics. I know it is confusing at first time(. I learned it with trial and error

@Elvic 

Is this where I should put the command?

 2023-03-15 23_16_00-Threshold Sample App 2023 - AppSheet.png

How do I share the app with you?

Looks correct

my email is <PII removed by staff>

Hi @Elvic 

Unfortunately your email has been censored - I sent you direct message

Top Labels in this Space