Single-element data array, select unique values

This script shows how a script can be used to ensure that only a single value from an array is used by a clip/composition.  It takes into account track and clip indexes to make sure that only unique values are used in the test.  If the serial repeats or the number of virtual users exceeds the number defined in the script, the composition will abort.

// This array must contain enough values to satisfy the number of Virtual Users
// times the maximum number of Clip repeats per Virtual User.
var listOfValues = 
[
"Value 1",
"Value 2",
"Value 3",
"Value 4",
"Value 5",
"Value 6",
"Value 7",
"Value 8",
"Value 9",
"Value 10"
];

// This variable must be set to the maximum number of Clip repeats that
// there will ever be per Virtual User (Track).
var maxClipRepeats = 5;

if ($context.currentClipIndex >= maxClipRepeats)
{
  $context.composition.abort("Too many Clip repeats.");
}
else
{

// note that the ‘?’ syntax below is used to change any negative indexes to 0

  var index = ($context.currentTrackIndex < 0 ? 0 : $context.currentTrackIndex) * maxClipRepeats + ($context.currentClipIndex < 0 ? 0 : $context.currentClipIndex);

  if (index >= listOfValues.length)
  {
    $context.composition.abort("Too many Virtual Users.");
  }
  else
  {
    $prop.set("MessageClip", "GeneratedUniqueValue", listOfValues[index]);
  }
}