Random number

Hello

Do you know a line of code to make a random number appear in a line?
For example I would like that with each click, a new number appears on my page between 1 and 89 for example? How to do ? Thank you

You can use the Dice Roll plugin column for this. Set it up as follows:

  • Create a User Specific Text column to hold a “seed” value
  • Create the Dice Roll plugin column
    – Use the Seed column as the Seed value
    – Set the number of sides to 89
  • Add a Button to your screen with an action that does a Set Column values on your Seed column, using the Unique Identifier special column value
  • Add a text component (or whatever) to display the value of the Dice Roll column
4 Likes

Hola!

Just to complement the Darren’s solution: if you want to have a random value based on time automatically (without pressing some button), all what you need to do is this:

image

image

With it, every 10 sec you will have a new value automatically.

Feliz día!

perfect thank you very much.
It’s possible to have a different value on each line? If yes, how do ?
thank you

I think so!

Let me try/look for a smart way.

I think the obvious way would be to create a template using the RowID + current timestamp, and then use that as the seed value.

1 Like

Here is the solution using Darren’s suggestion:

  1. image

  2. image

  3. image

Saludos!

1 Like

Thanks a lot of!
I wanted to try this to randomize my Swipes but it doesn’t work.
indeed I use the swipe model but it arranges the articles only compared to the table.
do you still have a solution? thank you

First of all I’m sorry for replying on this old topic! :slightly_smiling_face: But thought to share this here that may help!

You can make a Random Swiper using the Roll Dice column that mentioned above by Darren and Gustavo!

Here’s how! : Random Swipe?

Thank you

Is there a way to change the random values every 10 minutes, can something else be used instead of current time?

Try this as a seed value for a random number. It will only change every 10 minutes. ‘now’ refers to the current datetime which you can select as a replacement value.

(trunc(now)*1000)+
(hour(now)*10)+
floor(minute(now)/10)

2 Likes

Hi I want to know if it’s possible to generate a number per row but not randomly, like 01, 02, 03…?

I think you want use case #2 in the attached thread.

1 Like

Thank you sooo much

1 Like

Hi, I think I can’t make this solution because when I use a template I can’t search my value because it’s not in the User table. I don’t know if it’s clear. I wanna make that idea but for my inventory like object 1,2,3 etc but the number never change even I delete an row or add one.
Thanks.

@Camille1, could you show your setup with some screenshots or from a video? The method that Darren used ( thanks to @11183 ) in the topic that Jeff linked should work!

1 Like


I want to create a number ID for each row of “RAPPORTS” so I create a Row ID but I can’t choose it when I’m in the “assorted-month” table.

You need to display like 1,2,3,… in the RAPPORTS table right? In that table now you can create a Lookup column like this :

image

and you can create the Row Index column like this :

and finally you can create a Math column like this :

Thank you for your fast answer! I’m so sorry but I want to make the case 1 with unique ID when I make a new row that never change … But your answer was so clear thank you again