Run action to ref. table when I deleting entry in main table

I want to run action to ref. table when I deleting entry in Register(main) table :

Example: I have 3 table

1. Register - (Parent)

2. Inventory - (Child)

3. Items - (Ref. with Inventory table)

Now I adding new entry to register and then under register row, I adding multiple child entry in Inventory table. and in Inventory there is ref. column for select item from Items table. so Item table there is [quantity] and [item name].

Now I made action and I link with automation to update quantity for every changes. now if I do any changes in Register table I see below,

# If i Add then quantity updating by automation action .

# and also If i Update  then quantity updating by automation action .

# But If i Delete then quantity not updating by automation action.

I hope you understand because I explained very well.

 

Please help me. 

Thanks

Saddam

0 5 802
5 REPLIES 5

There are not enough details about your setup to answer this precisely.

However, be aware that when you Delete, THAT row and any "strongly" linked Child rows (by usage of "Is Part of" property) will be removed by the time your action fires to update the quantity.  Meaning they will not be in the data table to access.  If your action then relies on the presence of these deleted rows in order recalculate the quantity, it won't be able to because, well, the rows were removed.

There are 2 main approaches (without knowing more about your implementation) to handle this:

  • Calculate the quantity based on the history, ie sum up all rows that determine what the quantity should be.  The downside to this is that you ALWAYS have to have ALL rows available to the app - i.e. no Security Filters.  This can make the app become slow over time.
  • Postpone the Delete until AFTER the recalculation is performed.  I typically do this by creating a custom Delete action that simply marks the row (or rows) to be deleted using another column named "To Delete?".  I will then recalculate considering that any rows marked "To Delete?" are either not included OR are deducted from the original quantity amount.  Then add a new action that deletes any rows marked to be deleted.

I hope this helps!

If i understand your problem, it sounds like you want to run an action on a reference table when you delete an entry in the main table.

To do this, you need to create a new automation rule. The rule should be triggered when an entry is deleted in the main table. The action for the rule should be to run the action that updates the quantity in the reference table.

Here are the steps on how to create the automation rule:

  1. Go to the Automation Rules page in AppSheet.
  2. Click the Create Rule button.
  3. In the Trigger section, select When an entry is deleted.
  4. In the Table field, select the main table.
  5. In the Field field, select the primary key field for the main table.
  6. In the Action section, select Run Action.
  7. In the Action field, select the action that updates the quantity in the reference table.
  8. Click the Create button.

Once you have created the automation rule, it will run whenever an entry is deleted in the main table. The action will update the quantity in the reference table accordingly.

Here is an example of the automation rule that you can create:

Trigger: When an entry is deleted
Table: Register
Field: RegisterID
Action: Run Action
Action: UpdateQuantity

This rule will run whenever an entry is deleted from the Register table. The UpdateQuantity action will be run, which will update the quantity in the Inventory table accordingly.

I hope this helps! 

 

Hello! Can you please elaborate on how to create a rule? You mean create a Bot in Automation, right? If yes, where do I find the "Trigger" section?

Yes, create a Bot.  The "trigger" section is now the "Data change type" - (it was changed).  You can select "Delete" as one of the types and use the Bot to perform calculations based on that deleted row. 

My problem is solved! Thank you!

Top Labels in this Space