For activity


The For activity allows for iterative processing of a list of input data within a process.

When a For activity is placed on the TrueSight Orchestration Development Studio process canvas, an End For object is automatically placed to the right of it. A For activity is linked to a series of activities, terminating at an End For object. The process will execute the linked activities between the For and End For activities for each item in the list, moving to the next item on the list each time the End For object is reached. When all items in the list have been processed by the For loop activities, the process will continue with the activities that follow the End For object.

The End For object cannot be deleted individually. When a For activity is deleted, all activities connected to the For activity, including the End For object, will be deleted together as a group. Activities contained between the For and the End For can be deleted individually.

The Property Panel for a For activity consists of four tabs, Properties, Logging, Metadata, and Results. The Logging and Metadata tabs follow the layout and principles outlined in previous sections of this document.

The Input parameter can be a context item or a dynamic context that contains an XML document. An XPath expression is created through the Transform Editor to designate the Input document that will be processed by the For loop activities. The XPath expression selects the value from each element in the XML document in sequence. When the list is exhausted, the process proceeds with the activities subsequent to the End For object.

For example, with the following XML document as an input and an XPath expression of //line the value of each of the three <line> elements will be processed by the activities in the For loop.

<lines>
  <line>value one</line>
  <line>value two</line>
  <line>value three</line>
</lines>

To configure a For activity

  1. On the TrueSight Orchestration Development Studio process canvas, double-click the For activity to open the Property Panel.
  2. Select a Parameter type in the Input pane.
  3. Launch the Context Browser.
  4. Select a Context item to be evaluated or referenced.
  5. Click the down arrow next to the Basic** button, and select Advanced.

    XSLT is not a valid transformation option for a For activity. When launched from a For activity's Properties tab, the Transform Editor will default to the XPath option and will display the Sample Selection window first.

  6. Use the wizard to designate the element or node that will be saved to the Output Context item.
  7. When the expression is complete, click Save and Exit to close the Transform Editor.

    The For loop activities execute on each value in the list. Upon completing the list provided by the Input, the process proceeds with the activities that follow the End For object.

  8. In the Output pane, select a Context type.
  9. Click the Browse button to launch the Context Browser.
  10. Select a Context item in which to store the item currently being processed by the loop.
  11. Click OK to save the contents of the Properties tab.

On the Property panel you can also define success criteria on the Results tab and additional logging criteria on the Logging tab. For more information, see Activity-properties.

Example

The following BMC Communities video (6:46) is part three in a series that demonstrates how you can use XML, XPATH, XSLT and context items in workflows to integrate with other systems. It provides an example of how to integrate with BMC Server Automation, extract data, and translate the information into consumable XML for use in subsequent workflows. Part three uses the integration of TrueSight Orchestration and BMC Server Automation and demonstrates subsequent workflow execution using a For loop and leveraging tokens. The workflow retrieves server activity based on a dynamically-created server list.

icon-play.png https://youtu.be/HAmrMiOcENM

The rest of the videos in this four-part series are in Using-a-transform-editor.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*