Calling on global variables through a global variable?

Help! I am a german student in dire need of some advice on my issue I’ve been stuck on for weeks.

For my project I created 10 items as global variables (Item1, Item2, …).
Now I let Axure pick a random number between 1-10 (stored in global variable “RandomNumber”)
RandomNumber = [[Math.floor(Math.random()*10)+1]]

and add that number to a string creating an existing item-variable to another global variable called “RandomItem”
RandomItem = [["[[Item".concat(RandomNumber)]]]]
–> resulting in e.g.
RandomItem = [[Item2]]

If I then set text of a box called “PrintBox” to RandomItem it will only show the string “[[Item2]]” instead of the global variable (Item2 --> “cool”) it should call on.

I know this sounds super confusing - please check out my sample file. I am super grateful for any tips or help! Or maybe a whole different approach to my case?

GlobalVarIssue.rp (45.5 KB)

Not exactly sure what you are expecting as an outcome as you explain the issue you seem to have but not the expected output as an example.
When I print, i do get exactly was I see on screen.
I modified your code a little to display the output in the widget as “Random Item .value” vs what you had as [[item2]] in this case after clicking the button I got “Random Item 5”.
I removed the excess brackets [[ ]] to keep it clean. See image GlobalVarIssue.rp (45.5 KB)
See Video example


Dear Pierre,

thank you so much for answering! I think something got lost in translation here (probably because of my german english hehe). If you look into my global variables in the original file you see that I would like to see in case of RandomItem = [[Item2]] the box should say “cool”, because in my global variables Item2 is prefilled with “cool”

I am not sure you can choose randomly the value of those multiple variables.