Skip to main content
Skip table of contents

Shuffle an Array in a Sequence

How to get a unique random filename from a Directory List Step?

Use a jsonSource Step whose source is directly the List Directory Step output, or, like in the sample project, from a filtered copy (only “.txt“ extension file), this will create a Javascript array named jfiles (Variable name property defined in the Step) into the JS scope of the Sequence. Then a SequenceJS Step is added to pick up a random file name from the Array (https://stackoverflow.com/questions/5915096/get-a-random-item-from-a-javascript-array ). Finally, a jElement Step will output the file name at the end of the Sequence execution.

random_file.car

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.