Stream Loop Edit Tab

Use the Stream Loop edit tab in the TestStand Sequence Editor to configure the Stream Loop step.

Input Group Box

The Input group box in the Stream Loop edit tab contains the following options:

  • Input Record Stream —Specifies an object reference to the InputRecordStream over which to iterate.
    • Auto Close —Check this box to automatically clean up the input stream at the end of the loop. When this box is checked, upon terminating the loop, the Stream Loop step closes the stream and sets the object reference in the InputRecordStream expression to Nothing .
      Note Cleanup occurs only if the loop terminates normally by encountering the end of file (EOF) or as a result of a Break step . Cleanup does not occur if execution flow exits the loop for some other reason, such as via a Goto step .
      Leave this box unchecked to continue using the stream after the loop terminates and/or close the stream yourself by calling the InputRecordStream.Close method through the TestStand API.
  • Input Record —Specifies where to store the next record read from the input stream. The record may be a container, array, or string.
    • If the record is a container, the subproperties represent the fields.
    • If the record is an array, each array element represents a field.
    • If the record is a string, the fields are represented as comma-separated values.
  • Field Mapping —(Optional) Specifies the mapping from fields in the stream to elements of the record. The mapping is a comma-separated list of index ranges. For example, "0, 3-5, 8-7" specifies that fields 0 through 5 in the record read from the stream be stored to elements 0, 3, 4, 5, 8, and 7 of the record in the step. The final range in the list may be open-ended. For example, "2, 3-" indicates that fields be stored to elements 2, 3, and all elements beyond 3 of the record in the step.

    If the input record is a container, the range list may include individual subproperty names. For example, "Temperature, Pressure, 0-1" specifies that fields 0 through 3 of the record from the stream be stored to subproperties Temperature and Pressure, followed by the subproperties with index 0 and index 1.

    Field mapping is not supported when the record specified in the step is a string. Specifying a field mapping with a string record results in a run-time error.

  • Iteration —(Optional) An expression that determines the numeric variable or property in which to store the current loop iteration. This is the zero-based offset from the beginning of the loop.

Output Group Box

The Output group box in the Stream Loop edit tab contains the following options:

  • Enable Output —Check this box to enable output for this loop. If checked, the output controls are enabled, and the stream loop will write the specified output record to the specified output stream at the end of each iteration.
  • Output Record Stream —Specifies the stream to which to write output data. The expression can be either an object reference or a string. If it is an object reference, it must refer to an OutputRecordStream or ExecutionOutputRecordStream . If it is a string, it must be the name of an ExecutionOutputRecordStream attached to the current execution.
    • Auto Close —Check this box to automatically clean up the output stream at the end of the loop. When this box is checked, upon terminating the loop, the Stream Loop step closes the stream and sets the object reference in the Output Record Stream expression to Nothing .
      Note Automatic cleanup occurs only if the loop terminates normally by encountering the end of file (EOF) or a Break step . Cleanup does not occur if execution flow exits the loop for some other reason, such as through a Goto step .
      Leave this box unchecked to continue using the stream after the loop terminates and/or close the stream yourself by calling the OutputRecordStream.Close method through the TestStand API.
  • Output Record —Specifies the record to write to the output stream. The record may be a container or an array.
    • If the record is a container, the subproperties represent the fields.
    • If the record is an array, each array element represents a field.
  • Use Input Record —When checked, the record specified by the Input Record expression also specifies the output record. Checking Use Input Record when the input record is a string causes a run-time error because the output record cannot be a string.
  • Field Mapping —Specifies the mapping from elements of the record to fields in the stream. The mapping is a comma-separated list of index ranges. For example, "0, 3-5, 8-7" specifies that elements 0, 3, 4, 5, 8, and 7 of the record be written as the fields "0-5" in the stream. The final range in the list may be open-ended. For example, "2, 3-" indicates that elements 2, 3, and all elements beyond 3 of the record be written to the stream. If the output record is a container, the range list may include individual subproperty names. For example, "Temperature, Pressure, 0-1" specifies that the subproperties "Temperature" and "Pressure," as well as the elements 0 and 1, be written as fields to the stream.

Data Streams API Notes

The Stream Loop step is designed to work with any object that implements the InputRecordStream or OutputRecordStream interfaces. The loop reads records using the InputRecordStream.ReadRecord method. It writes records using the OutputRecordStream.WriteRecord method. Auto close functionality invokes InputRecordStream.Close or OutputRecordStream.Close as appropriate.

For optimization, the step may pre-evaluate the mapping and pass a reordered record consisting of aliases along with an empty mapping string to the underlying stream. This may be done instead of passing the specified mapping string directly to ReadRecord or WriteRecord .

See Also

InputRecordStream.ReadRecord

InputRecordStream.Close

OutputRecordStream.WriteRecord

OutputRecordStream.Close

ExecutionOutputRecordStream.WriteRecord

ExecutionOutputRecordStream.Close