Freeze App Formula - Random Number

Alrighty, so in the FORM I want to generate a random number, but I want the user to effectively be able to roll the die, getting a new random number… How could I randomize it, but “freeze” it from changing?

In a FORM, you certainly cannot activate an action upon request. I cannot think of any way you can work around this.

Could you make this a two-step process? An action that generates and saves the random number and then launches into the FORM and picks up the saved random number. And if you DON’T need to re-generate the random number, just simply launch into the FORM.

Maybe this doesn’t fit your needs? If not, could you elaborate on when you need to be able to re-generate a random number?

1 Like

Currently I’m clearing a cell, and then using an on save action to post the value static back… But was hoping to find something more elegant…

How many times would a user possibly “reset” the number during a single FORM session?

You could have multiple columns to hold random numbers, with the same Display text, so the user doesn’t see a difference. All of these columns generate upon entering the form. Then have some sort of “reset toggle” field with a yes/no or enum or something that simply shows and hides different columns.

Upon saving the form the random number can be saved to a static column.

Use a virtual column to display the current “actual” value.

1 Like

Just do an uneditable Initial Value, but that doesn’t allow “rerolls”.

1 Like

Thanks for helping with some ideas!

Another alternate idea: a separate table to generate this data, once confirmed transfer to the working table where the value is not editable, and then wipe this temporary generation table and lock from going back to it.

I’m thinking of it as if I was generating a character for a game.

1 Like