Populate a field with values from a list
Hello!
I need to write some values in a field.
There are around 10 different values, that i want to put in a field in random order.
I guess i first need to put them in a separate table, or in a list or array, and then with some formula write them in the field... but i dont know how to do that programmatically ).
Please help! )
9 replies
-
Do you want a true random selection of values? Where you can get the same random number? Or do you want to exclude previous selections?
-
This was an interesting ask. Here is my 2 cents on the matter. Put the following in a button and have a text field called Text on the same form.
Line 1, creates an array of letters to print.
Lines 2 - 4, use a for loop to create an array of 10 randomly generated numbers.
Lines 5 - 7, uses a for loop and number array from line 2, to get the corresponding letter with the item() command. Then we use the concat() command to turn the new array into a string then set the field 'Text' to be equal to this new string.
I'm not sure how I would not allow repeating numbers. I'll give that a try in the following days and report back if I find a solution.
-
I know it's a bit of a sledgehammer to crack a nut but this gives and array of 0 to 9 randomly sorted
Regards John
-
This works in the console
-
With comma's: (F,G,F,J,C,E,J,H,C,J)
Without Comma's: (DADCJCFEAC)
Or oneliner with comma's:
for i from 0 to 10 do item(["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"], floor(random() * 10)) end
-
Thanks to here is another script to have non-repeating values.
-
Other two possibilitys. Repeating items
Nonrepeating
-
Guys, wow!
Thank you so much! I did not expect such a variety in aproaching this task. Im gonna try every method and report back!
Thanks again!
Good day to everybody!!!
Content aside
- 9 mths agoThu, June 20, 2024 at 2:45 PM UTCLast active
- 9Replies
- 103Views
-
5
Following