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

Jane
New Member

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?

0 18 444
18 REPLIES 18

Jane
New Member

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?

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.

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?

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

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?

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โ€)

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.

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.

Jane
New Member

UPD I fixed it 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.

Well done!

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

Top Labels in this Space