Random number generator to populate fields in a repeater

Hi!

So this is assuming you are not using column values to set the prices, correct?

You would use two set text commands: the first would set the normalPrice widget to a random value, and the second set text would set the salePrice to the value of the normalPrice widget minus a random number between 1 and 50.

You will need to use a local variable to grab the value of the normalPrice widget in the second set text command:

On Item Loaded
  Set text of normalPrice to [[(50 + 4500 * Math.random()).toFixed(0)]]
  Set text of salePrice to [[ LVAR_normalPrice - (1 + 49 * Math.random()).toFixed(0) ]]

…where LVAR_normalPrice is the local variable referring to the text of the normalPrice widget.

1 Like