Add row in table B, after delete row in table A

Hi everyone, I need you to help me with something. Step to comment.
From table A (detail), where the record of equipment associated with an order is saved. I give the possibility to delete a record from table A (detail). But I need to be able to create an action that executes when a record is dropped from table A (detail). This action must leave a record in table B (history) creating a row where data of the deleted record and the date of deletion are saved.
Is it possible to do this? I appreciate your help.

Yes, however you will need to create your own custom action(s) to delete. When you use the AppSheet native delete action, this effectively removes the row from the table immediately and is therefor not available to access for copying to another table. At least that is my experience, someone please correct me if I am wrong.

What I do for this situation is create a custom Grouped action. The first action within the group copies to your history/log table and the second action performs the delete. I may be oversimplifying as it could take more than two actions but you get the main idea I hope.

1 Like

THANKS!!! do you have any example that can guide me?

These are some articles that may help you:

You can go deeper from those articles.

1 Like

yes, approach shared by @WillowMobileSystems would be work.
There should be bunch of other workaround as well.

For instance, dont involve the other table store the deleted record but use just a slice.

Create custom action to toggle the value for newly creating field value [Deleted?] from false to true. Initial value for this field is set to false, but once the user hit the delete action, it is actually not delete row from the table, but toggle the value to true. For the first slice is removing the row with value of true, then it only display the set of rows with value of false, which are not deleted explicitly by the users.
The second slice will be opposite, the deleted rows are only visible.

It is possible the user by mistake add the row, in that case, simply present the default action to delete the row.

Even for the second table for rows only delete? as true value, we can present action to toggle back to true, then move the product back to original order. This would flexiblity to the users to control.

3 Likes

That’s correct!

2 Likes

Is it possible to do the following steps via grouped behaviour ?

  1. edit form of table B using values from table A record [link to form view]
  2. And if the Table B form is saved, delete table A record

if possible, how to do that… plz help

Not possible. A grouped action stops after the first navigation action.

Delete action and deeplink action within group actions is action killer.

1 Like

Ok, Thanks for the Information…

1 Like

It is not possible with a SINGLE Grouped action. However, you can accomplish the same thing by breaking it up.

One action that uses the LINKTOFORM() and copies Table A row values into Table B Form view.

Then a second action (or likely a Group) that is attached to the Form Save behavior of Table B Form view. This action would delete Table A row. This would require “remembering” somehow which Table A row to delete. I would probably include in Table B a hidden column named “Copied From” that saves the Table A row key value. If that column ISNOTBLANK(), then delete the Table A row by that row key. Then clear the column after delete.

1 Like