When I push the button it works perfectly and updates the value.
However, if I set an automation to have that formula action, it fails. I thought maybe disintermediating with a button would work, so I created a button that has this action, and set an automation to push the button. It fails too - and by saying it fails I mean the automation runs, but it always results in the same value. When I manually push the button, it generates a proper random value and updates. Ideas why it only works manually?
Iâm testing this is it looks to be working fine. I donât know your full setup, but when you say it generates the same number, is it setting the same number for a full column or is it generating the same random number every time?
@BenLee thank you for graciously helping. The formula works, I know. It doesnât seem to work when incorporated into an automation. I am having some trouble debugging because in the automation history it shows the result of the âautomation-runâ and it shows the ârandomâ value as X. When I go and look at prior âautomation-runsâ it also shows the value as X. So I took this as meaning it was not changing the value. However I noticed now that no matter how far back I go, the value always shows as X, despite it having been Y and Z and other numbers, so the automation history is not helping. I know what the value is now and have set an alarm to check again in two hours when it runs. It doesnât appear to have been working but now I need to double check.
Can you see if you can get your formula to work in an automation to reset a cell/row value to be the random output?
Itâs working clicking the automations test button, but not sure about when the automation runs on itâs own. Doing the same thing and waiting to see what happens here too.
Okay, the automation fired and the number changed for me from 1 to 3. So itâs working on my setup. I have a canvas button with the following formula that is editing a full column, but it should work if you have column buttons tooâŚ
@BenLee thanks ⌠I still canât make it work. My button works by itself. The automation successfully âpushesâ the button but then it does two things that are unexpected.
1 - it does not âreallyâ push the button because the action does not fire
2 - It shows the same results in the Activity section, when I mouse over the results field from that step.
Interestingly, if I push the[ Test Rule ] button, it DOES take action and update properly. Here is a gif showing the situation:
What you are showing in the GIF, the âquoteâ hover, is actually reading from the current value and not the value that was written at that time. So on the next run, it might show a different number for all of those.
Instead, open a row in the table and where comments are, click on âActivityâ. That should show what values were updated at what time.
As you can see it was returning the same value repeatedly (15, 15, 15).
When I read your prior post I added a third step to the automation, and then recorded the gif. You can see the third step in the gif the formula step which changes the cell directly. Perhaps that has fixed it? Here is the activity:
Automation Bot is indeed a different thing than doing an action manually (i.e. in the browser, not on the servers). Testing automation is NOT running it as an Automation Bot, but STILL as you. The only time automation indeed runs like it would is when itâs triggered on the server (row-changed, time-based, crossdoc sync etc).
I donât know about the Random() function, but a bunch of time- and user-based functions (User(), Now(), Today()) arenât guaranteed to calculate on the server side. Thatâs because Coda servers donât normally evaluate docs, but only read from the last snapshot calculated and pushed into the storage by last viewerâs browser.
The implementation of Random() is usually based on time for pseudo-entropy, hence could also be affected. I.e., last timestamp in the doc is 1234567890 epoch milliseconds, and when used as seed for Random() calculation, it would always yield the same value. Thatâs my assumption about whatâs happening.
Random should be working fine here. I think it depends on other things you have going one. Hereâs a screenshot of the activity from my setup using that exact formula. The doc was closed and my computer was off overnight, so this was fully on the servers. Also, only 3 rows in the table so not a ton of variety, but the value was changingâŚ