Simple Copy then Delete Automation

This is/will be my second automation so, I have zero experience with automations. I have been avoiding learning about them because I had workflows and reports that continued to do what I needed. Until now…

Generally, this should be very easy.
Copy rows from one table, ‘Source’, who’s dates are X days older than today to a second table, ‘Archive’. After rows are copied from source to archive, delete those rows from the source. Simple…

The process outlined below worked fine yesterday before I left for the day when the final action was executed manually by pressing the button. Today’s goal was to set it up to run automatically through an automation bot.

This morning, the actions are no longer working. The web browser/app freezes indefinitely. No action appear to copy or delete data and nothing is logged in the audit log.

I have created a slice of the source table with the row filter condition : DATE([INSPECTIONDATE])<TODAY()-279
This condition returns 42 rows in the slice.
So, I want to copy these 42 rows from Source to Archive then delete from Source.

I have created 5 actions:

STEP 1a: For a record in the ‘Source’ table, add a row to another table (Archive) using values from this (Source) table: All columns in the Source table are defined
Condition is true
Action is set Not to display

STEP 1b: For a record in the ‘Source’ table, execute an action on a set of rows. Referenced ‘Source’ table, referenced rows FILTER(“Sliced Source Table”,TRUE)
Referenced Action: STEP 1a
Condition is true
Action is set not to display

STEP 2a: For a record in the ‘Source’ table, delete this row
Condition is true
Action is set not to display

STEP 2b: For a record in the ‘Source’ table, execute an action on a set of rows. Referenced ‘Source’ table, referenced rows FILTER(“Sliced Source Table”, TRUE)
Referenced Action: Step 2b
Condition is true
Action is set not to display

Final Action: For a record in the ‘Source’ table, execute a sequence of actions
1st Action: STEP 1b
2nd Action: STEP 2b
Condition is set to true
Action is set to display

@Steve @LeventK

I have helped a client setup exactly the same process you are building.

It looks like you are trying to process the items in a recursive manner. Recursion, in any language, does not like it when the list of rows it is operating on has changed - i.e. deleting a row in the middle of the recursive process. It can cause chaos.

No matter, you do not actually need Recursion and the bot is much simpler than you would think.


I understand you are trying to automate the archiving process so I believe you will want to use a Scheduled Bot. Here is what I suggest:

Create a Scheduled Bot with the “ForEachRowInTable” on. The criteria is set to identify the rows you wish to archive - e.g. IN([Key], FILTER(“Sliced Source Table”,TRUE))

Then perform Step 1a and Step 2a - as a Grouped Action - and…your done!!


By the way, your manually controlled process via button can ALSO be much simpler.

You really want the visible action to be Step 1b. It then calls a Grouped Action (same as mentioned above) that performs Step 1a and Step 2a together. That’s it!!

I hope this helps!

1 Like

Thank you John! I am headed in the right direction with one caveat:

The bot doesn’t execute according to the schedule I’ve set.

I have chosen my timezone and set a time a few minutes in the future and I wait. Nothing happens and nothing is logged in the audit log.

If I manually run the bot, it executes the steps and does so very quickly.

Any idea why the set schedule seems to be ignored?

Is the app deployed? It needs to be to take advantage of scheduled processing.

2 Likes

After four years using AppSheet, I should have known/realized that…

Thank you again @WillowMobileSystems

2 Likes