Action is not firing on save, but it works through a button

Hi everyone!

I am stuck and I need help.

Have anyone encountered a situation when the action is not firing on save (or in a bot), but if you fire it through the button it works.

Action is a referenced action, which is updating a number for a specific row in one table (parent), after adding a new row in another (child).

Parent table contains information about products (primary key is concatenation of product_id and process columns), and child orders for products from Products table (primary key is Order_id).

Column to which it is writing is physical. It looks like every time on save the action is rewriting the column with blank, but if I fire the action manually with the button, it is writing a correct number.

Action is added to the form, and form is using a slice (slice also has the action).

Maybe there is an issue with primary keys, but why then manually it works?

An update from myself - so after several tests I figured that the action is working, but instead of updating the value, it is making it blank.
Again, if I trigger the action through the button, it works.

Would love some help!

What is the expression that the Action is using for the column’s value?

1 Like

Marc, thank you for replying me!

Here is the expression:

LOOKUP([_THISROW].[Product_ID], “Recent order”, “Product_ID”, “Multiple_processes”)

  • Recent order is a slice of Test_Customer table(which contains all orders), slice is showing only the latest (based on maxrow timestamp) order for a product.
  • Multiple processes is a column value from which I am trying to use to update value for Process in another table.

If the “Recent Order” Slice is a single record, maybe try:

ANY( Recent Order[Multiple_processes] )

…instead of your LOOKUP() expression.

Tried it, worked only with LOOKUP(), when I specifically say which Product_ID to look for.
Otherwise not… which probably means that slice has more than one row, which can be a reason.
As when I am triggering the action via a button, it know which product_id specifically is being used.

Thats why it is resetting it.
What if I just use a virtual column with LOOKUP([_THISROW].[Product_ID], “Recent order”, “Product_ID”, “Multiple_processes”), so it will be updating with every sync. I understand it will be slower, and better to avoid it.

I think you’re running into an issue where you’re trying to reference a value before it “exists” (or saves to the database). I’m not really sure why right now, and don’t have the time to dig into it more. Maybe someone else can step in, or I’ll try to get back to this later.

1 Like

This was a configuration of my slice [Order_ID] = [_THISROW].[Recent order]

Where [recent order] is a column from Test_customer, with the expression MAXROW(“Test_Customer”, “Timestamp”, [Product_ID] = [_THISROW].[Product_ID])

Maxrow is giving the right output or the primary keys of rows of the latest orders of each of the product.

Why am I trying to do this:
I am trying to create a sequence of forms, where saving of each form is triggering a sequence of actions, based on initial input of multiple processes. Each form is based on a different table, but they are all related through Product_ID process number. In order to call a right form I am relying on Multiple-Processes in the initial input of a user.
So overall the question is how to transmit multiple processes value across 3 other tables.

  • I tried virtual column, but even with forced sync upon saving a form it was not appearing in the next form.
  • tried referenced action, which is supposed to be updating a respective value for Quantity of processes in other tables (for now trying to make it work at least with one).

I believe my scenario is possible with AppSheet, but somehow dont know how to make it work.
Or if I am completely wrong, maybe there is another way (as there is always another way in appsheet) how I can make it?

How?

Steve, thank you for answering me! I appreciate a lot.

When I am saving a form, I have an action which is calling one form or another depending on the inputs in the current form.
For example if in the current form there was Process = “1” and it is less than a total amount of processes, I will call the form to add another row for process = “2” (or another number).
And i was able to create to whole sequence , with resulting success message.
But it got messed up, when I am calling the form to edit the existing row.

Steve, does it make sense?

1 Like

One of the actions of the sequence is updating the quantity, which I cant make to work.

1 Like

Note that when using an action of type Grouped: execute a sequence of actions, execution will stop immediately after the first navigation action that is performed. For instance, if a sequence of actions includes an action to navigate to another form, followed by an action to update a column value, the action to update the column will not be performed. A navigation action must/will be be the last action performed. Could this be your problem?

1 Like

Steve, I have deleted the action from the form, and left the bot only.
Bot is not showing any problems in the monitor mode also.

Let me summarize what I am doing:

Bot is triggered at “ALL Changes” in Test_Customer table.

Referenced table is Test_process_machine.
Referenced rows: SELECT(Test_process_machine[_ComputedKey], [_THISROW].[Product_ID] = [Product_ID])

Referenced action:

expression: LOOKUP([_THISROW].[Product_ID], “Recent order”, “Product_ID”, “Multiple_processes”)

One update - now bot somehow is rewriting the value for Company_ID column, which is LOOKUP(USEREMAIL(), “Test_Company”, “Email”, “ID”)

But it is still not updating the column that I need, however the action works perfectly through the button attached to the Test_process_machine table.

Is a change occurring in the Test_Customer table?

Steve, it is. When a new order is added, it is adding a new row to Test_Customer table.

1 Like

UPD I fixed it :slight_smile: hooraaay!

So the problem was apparently in the formula for slice for the recent orders from Test_Customer table. Now it is
[Order_ID] = MAXROW(“Test_Customer”, “Timestamp”, [Product_ID] = [_THISROW].[Product_ID])
Also, I deleted the bot and added a complex action to the form.

3 Likes

Well done!

:slight_smile:

Thanks Steve! I am very happy, I was stuck for 1,5 weeks.

1 Like