Selecting a variable randomly from "create multiple variables" module?

You don’t need to use the random special variable, or mod operator, or even know the LENGTH of the array to “calculate” which random item to use.

All you need is the shuffle and first functions to get a random item from an array.

{{ first(shuffle( 1.array )) }}

To answer your original question, you first need to build this ARRAY.

You can use the built-in function add,

e.g.:

{{ add(emptyarray; 9.`Worker 1`; 9.`Worker 2`; 9.`Worker 3`) }}

Then insert it into the array placeholder in the above example:

{{ first(shuffle(add(emptyarray; 9.`Worker 1`; 9.`Worker 2`; 9.`Worker 3`))) }}

For more information, see the function documentation in the Help Center.

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

5 Likes