Convertigo Public Knowledge base

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 (Get a random item from a JavaScript array ). Finally, a jElement Step will output the file name at the end of the Sequence execution.

 

(c) Convertigo 2023 https://www.convertigo.com