Designer 10.7 | webMethods Service Development Help | Building Flow Services | The LOOP Step | Specifying the Input Array
 
Specifying the Input Array
The LOOP step requires you to specify an input array that contains the individual elements that will be used as input to one or more steps in the LOOP. At run time, the LOOP step executes one pass of the loop for each member in the specified array. For example, if you want to execute a LOOP for each line item stored in a purchase order, you would use the document list in which the order’s line items are stored as the LOOP’s input array.
You specify the name of the input array on the LOOP step’s Properties view. The array you specify can be any of the following data types:
*String list
*String table
*Document list
*Object list
LOOP properties
When you design your flow, remember that because the services within the loop operate against individual elements in the specified input array, they must be designed to take elements of the array as input, not the entire array.
For example, if your LOOP executes against a document list called LineItems that contains children called Item, Qty, and UnitPrice, you would specify LineItems as the Input array for the LOOP step, but services within the loop would take the individual elements of LineItems (for example, Item, Qty, UnitPrice, and so forth) as input.
Note:
The LOOP step is not thread-safe when the input array is a child of another variable (for example, a String list that is a child of a Document). Because the LOOP step changes the dimensionality of the input and output arrays during execution of the step, any threads invoking services that access the parent variable can experience the input array variable as either an array or a scalar. This results in unpredictable behavior for threads accessing the parent variable.
If the input array is a top-level variable in the pipeline, any thread that accesses the pipeline object (IData) for the service containing the LOOP step might also experience unpredictable behavior. Consequently, do not code other services that might concurrently access the object, such as a document, document list, or pipeline, that contains the input array. For information about the changes in dimensionality of inputs in a LOOP step, see About the Pipeline for a LOOP Step.