Using a button to trigger RandomItem update without using continuous updating

I’ve got a doc that I’ve created for a game that pulls a random item from a list and presents it to the user. I’ve used the RandomItem() formula to get this, pull in the record and build other filters that reference the formula.

However, I can’t find a happy medium between the doc updating the random item every time I change anything and the doc never updating the random item.

Is there a way to use a button to trigger an update to the RandomItem calculation to recalculate?

Example: RandomItemExample

Alright - I figured it out with a new approach. I created a sub-table with a list of the selections, then created a control which set the value of new rows to the “RandomItem”.

After doing this, I updated my lookups and other filters to reference the newest item on that table.

It would be really neat to have a “recalculate” command that could be run on a RandomItem formula that does not auto update.

1 Like

Hey there @JonO

Check out the formula reference for RandomItem. It has an option to update continuously or not

Just set your second argument to false as it defaults to true!

1 Like

Hi Scott,
Thanks for the response!

My question didn’t quite clarify that I was unhappy with both the true and the false state of RandomItem. When set to false, I can never get it to update. When set to true, I cannot prevent it from updating.

My solution was to set to false, but to write it to a table and reference the last record in the table.

@JonO ,

Yes, the ability to define which events trigger randomization would make randomization much more practically useful.

I have a use case where I randomize a value (upon which other doc randomization is based) once per day, by running a daily automation that checks/unchecks a checkbox for the sole purpose of triggering randomization. Once per day is not the ideal frequency for this use case – it’s a workaround until there’s a better happy medium solution – but it’s getting the job done for the time being.

It doesn’t seem like this will work for your use case, but maybe it will spark an idea you can build upon.

1 Like