Getting A Random Array Item

When asking your question, please include:

:footprints: The steps you have taken
:camera_flash: Relevant screenshots
:link: Any links you have
[ Code { "and": "JSON", "in" : "code block"} ]
:x: Exclude Personal Information.

Can someone please educate me on what the best practice would be to set multiple variables manually, and then pull one value from random to pass onto another module?

Example: I have 9 possible responses i’ve written, all in a “Set Multiple Variable” tool with Variable Values “1, 2, 3, … 9” and Variable Names of all different texts. I want to pass a random text string to a following module that needs a text value.

I’ve tried using random(), array aggregator, {{first(shuffle(8.array))}} and I’m just too stupid to figure this out. It’s always giving me an error of " * Collection can’t be converted to text for parameter ‘text’."

The Make documentation does not help me at all, and Googling any kind of answer for is already a nightmare.

Thank you to anyone who can lend some advice.

Hey @Tyler_H ,

A screenshot of the whole scenario would help to better understand the flow of things. But I will try to help with what I have.

The Problem is, that 8.array does not contain the actual strings like “No Update”, but rather multiple objects in the form of “No Update : 1”.
Bildschirmfoto 2023-04-15 um 11.08.16

Easiest way to do it, would be to remove the iterator, and just set one Variable, for instance called “RandomStrings” with the value

{{add(emptyarray; " No Update"; " Nothing to report"; " No Updates"; " Still Working")}}

Bildschirmfoto 2023-04-15 um 11.15.05

This will create a normal array of those strings.

And afterwards, you can use your shuffle mechanism to get the random item:


If you NEED the Mapping of a certain ID to the Text like “No Update” has to be mapped to “1”, there’s another solution. Just let me know if you need it and I can provide more info.

Do not hesitate to contact me if need further Info. :slight_smile:

Christoph Gerl
Funkenwerfer Process & CRM-Automation