Bot Triggered Action Zeroing function Created Values

I am building an app to help me budget while traveling. I have a form for inputting accommodation data to an "Accommodation" Table (Check in Date, Check out Date, Total cost) this form also has some function created values like length of stay, cost per day .  I created a recursive action that creates a new row in an expenses table with the daily cost then increments a column in the "Accommodation" Table, then repeats until the incremented column equals the length of stay column. This all works well when the action is triggered manually but when i have a bot trigger this action on the creation of new record the incrementation step zeros out all the columns that were created by the formulas in the original form (Cost per day, Length of stay).  Any insight on why this might be or how to fix it? 

0 12 230
12 REPLIES 12

The values used in the calculations, where do they come from?  I.e. are they all table stored values?

My hunch is that maybe you are using a value that is not accessible on the server side and it is being treated as zero.

All of the values in question are stored on the server side. They are getting zeroed out on the server side. The columns in the "Accommodation" Table are ID, Check in Date, Check out Date, Cost Local, Cost USD, Accommodation Name, Country, Length of Stay*, Daily Cost USD*, Daily Cost Local*, Add Count (Incrementation). The columns with the * are the ones experiencing the problem. I've broken it down while trouble shooting and the first record creation on the budget screen has no problem, they get zeroed out at the incrementation phase. The Action for incrementation is

"Set values of some columns in this row" 

Set These columns: Add Count = [Add Count]+1

I get this same behavior if the only action the bot is triggering is this increment action

I assume you have your expression to calculate those columns in an App Formula.  Just to make sure you know, ANY change to that row will trigger ALL App Formulas on that row.  That's why Add Count = [Add Count]+1, would have the same affect - it's a row edit and will trigger ALL App Formulas to re-calculate on that row.

I still think that when those calculations run there is a value not present causing a zero result.

I had mentioned...


@WillowMobileSys wrote:

My hunch is that maybe you are using a value that is not accessible on the server side and it is being treated as zero.


...this can also occur if your automation relies on rows that maybe have not yet been saved.  For example, if you have Parent row with children and your bot is triggered by an edit on the Parent row - the Parent row is saved and next any Parent Bots are triggered, then the child rows are saved and next any Child Bots are triggered. 

If a Parent Bot performs calculations using the child rows, the children will not have been saved yet and the calculations will result in zero values.

Could you have a situation like this where a Bot is being triggered before all necessary rows are saved?

 

 

Screenshot 2023-10-04 152540.png

This is what the table looks like in the Data Tab. all of the formulas here reference only values in this table. Every one I'm having a problem with only references other rows in the same table so I'm at a loss for where a zero could be introduced. 

If we look at only the "Length of Stay" column:

The formula is:  Hour([Check in Date]-[Departure Date])*(1/24)

both the Check in Date and Departure date are working as expected and don't change when the bot is run but the "Length of Stay" goes to 0 

I also tried putting a 5 min wait after creation of record on Accommodation before running just the incrementation to make sure it wasn't a time conflict. The data was entered correctly but after the 5 min delay was up the columns in question still zeroed out but the "Add Count" value was incremented. 

This is a pretty simple application so far so this is the only bot that exists.


@Squalimander wrote:

If we look at only the "Length of Stay" column:

The formula is:  Hour([Check in Date]-[Departure Date])*(1/24)


I agree, it should work.   

Just to make sure, you are relying on the App Formulas to perform the calculations? Correct?  Meaning you don't ALSO have actions updating these columns, do you?

What exactly is your Bot doing?  I.e. what are the steps in the Bot?

I assume you are using a sheet as your datasource?  One thing I would suggest to do is to intently watch your sheet as the processing is happening.  For instance, tap Save to add the new row and then immediately switch to the sheet and watch the new row added AND watch for the value updates to occur.

I have sometimes found the correct values get inserted and then get wiped out.  Upon closer look I had two things updating the row that were fighting with each other.

 


@WillowMobileSys wrote:

Meaning you don't ALSO have actions updating these columns, do you?


Ignore this part.  If you have App Formulas implemented, you can't even choose those columns to update in an action.  I wasn't thinking enough.

 

I am Actually using an Appsheet Database. But the steps for the bot are:

Triggered by Creation on "Accommodation"

Run a data action:  "Distribute Cost"

Distribute Cost is a grouped action that takes the following steps: 

distribute cost.png

Then stops when Add Count (Increment) = Length of Stay

Add date plus 1:

  • Add new row to another table using values from this row
  • (this one works when bot triggered and acts as expected)

Screenshot 2023-10-04 164101.png

  • Increment Count
  • (This is where the issue arises) 

 increment count.png

  •  Loop
  • Go back and re-execute Distribute cost.

loop.png

And if the bot is only triggering "Increment Count" it still zeros out the columns in question but does increment [Add Count]. Everything works fine when "Distribute Cost" or "Increment Count" is manually triggered. "Add date plus 1" works when triggered by bot or manually. 

In your loop action, shouldn't the Referenced Action be "Distribute Cost Accom 2" rather than "Distribute Cost Accom".  This is important for the looping to work correctly.  What is "Distribute Cost Accom" doing?

Screenshot 2023-10-04 155949.png

This is what the bot monitor looks like and the data is all correct here. 

Screenshot 2023-10-04 160401.png

and this is the table after the incrementation step runs

Something is not right between your Monitor screen shot and this table row screen shot.  They have different departure dates showing.

I apologize those were apparently from two different tests but the behavior is the same (I've been working on this issue ALL day and uploaded the wrong one on accident ). 

But just to be thorough here are the screenshots from a new test where the only action that is triggered is the "Increment Count" action.

Test1.pngTest2.png

Top Labels in this Space