Tags and repeating elements

You can store the values from repeating elements in a tag, either as a list or as a single value. The values can then be reported in the test output.
When you store the values from repeating elements in a tag, the way the values are stored depends on the Append to list of values option. This option is found on the Store page of the Field Editor, which is displayed when you right-click the element and select Contents > Edit > Store.

An Iterate Test Data or Lookup Test Data action returns a list of values that you can store in a list tag.

The value that is returned from the tag depends on context. When constructing messages that have repeating elements, list tags control the number of local repeated elements in the message. At any given point in the message structure, only a single value from the list is substituted.

In some test actions, such as Log or SQL Query, you can extract a specific value from a list tag by using the %%tag[index]%% notation. The values within the list are stored by using a zero index. For example, to extract the first value in the list, use %%tag[0]%%; to extract the third value, use %%tag[2]%%. If the selected tag does not contain a list, an error results. You can use another tag as the index, but do not enclose it with double percent signs; %%tag[%%indexTag%%]%% creates an error condition.

Contents of a list tag are shown in the following form on reports:
{value1, value2, ... valuen}

List tags in ECMAScript

You can write ECMAScript functions that manipulate the values in a multi-value tag. The Java™ ArrayList class is available for multi-value tags in custom functions that you write in Rational® Integration Tester. Not all methods are guaranteed to work.

For general information about scripting, see Options for scripting.

In the following example script, the numbers.get() method returns the value corresponding to the specified index, and the numbers.add() method appends a new value to the list.

// Get the last two numbers in the list, and convert them to numbers:
var beforePrevious = parseInt(numbers.get(numbers.size() - 2));
var previous = parseInt(numbers.get(numbers.size() - 1));

// Add 10 more numbers to the list
for(var i=0; i<10; i++) {
  // Calculate the next number to add to the list
  var next = beforePrevious + previous;

  // Add it to the list
  numbers.add(next);

  // Update the variables for calculating the next number
  beforePrevious = previous;
  previous = next;
}

Feedback