Workflow and ServiceDesk Community

 View Only

For Each Element in Collection 

Jun 13, 2012 09:43 AM

For Each Element in Collection

Component definition

This component takes individual elements from an array variable and handles them one at a time. The For Each Element in Collection component is particularly helpful when arrays of data elements are run through sets of rules or other process components.

Component icon

The following screen shot shows the Number Range Rule component icon:

Description of component output paths

Unknown

The component output paths are described in the following table:

Property

Description

next element

Connect to a component (or chain of components) that contains operations you want to perform on each entry in your collection.

The component (or chain of components) that you connect to should then connect back to this component.

finished

Connect to the next component in your workflow after this component has finished iterating through your collection.

first element

If you select to show the first and last paths, this option appears. You can connect to a component (or chain of components) that contains operations you want to perform on the first element in your collection.

The component (or chain of components) that you connect to should then connect back to this component.

last element

If you select to show the first and last paths, this option appears. You can connect to a component (or chain of components) that contains operations you want to perform on the last element in your collection.

The component (or chain of components) that you connect to should then connect back to this component.

Description of component tabs and their properties

The properties on the Configuration tab in the For Each Element in Collection component are listed and described in the following table:

Property

Description

Array Variable Type

Lets you select the datatype of the collection on which you want to perform operations.

Array Variable Name

Lets you set the collection variable that you want to manipulate. To select a collection variable inside an array, drill into the array and select a variable.

Select Variable dialog box options:

  • Show convertible types

    Lets you select variables with datatypes that may not be text (examples are phone numbers and birth dates) but which can be converted to text.

  • Show optional data

    Lets you select the variables that are not required. These variables may not contain data.

Item Output Variable Name

Lets you set the variable that contains the reference to the item in your collection that this component works with at any given moment.

You can use this variable in the components that you connect to from an output path. As this component iterates through your collection, the value of this variable is changed.

Show First And Last Paths

Lets you use the first element and the last element output paths.

The properties on the Settings tab in the For Each Element in Collection component are listed and described in the following table:

Property

Description

Component Class Name

The class name of this component. This property is not editable, but useful if you call Symantec support.

Description

The description of this component. This property lets you describe how the component is used. You can use it to provide any wanted documentation for this component.

This description is included in the model reports that are created when you click Plugins > Generate Business Model.

Location

The physical location of the top left point of this component on the workflow model.

Name

The name of this component. You can change the name.

If you changed the component name when you double-clicked it on the workflow model, the changed name appears here.

Override Background Color

This property lets you change the background color of this component.

To Do

This property lets you record what you still need to do with the component. Use this property to help you remember the configuration that you want to apply to this component.

The text that you enter for this property appears at the bottom of the component editor. If you enter text for this property, a checklist symbol appears on the component in the workflow model.

Is Enabled

This property lets you enable or disable the component. By default, components are enabled. When a component is disabled, it has no effect on the Project. Uncheck Is Enabled to disable the component.

  • Execution Outcome

    If a component with more than one outcome path is disabled, you must select which outcome path you want the component to take. Click the Execution Outcome drop-down list and select the outcome path for the workflow to follow.

  • Disabled Mapping

    If the component has output parameters, you must configure all output parameters with fixed data to pass on. This configuration can be performed in the Disabled Mapping option.

Connection information

Not applicable

Component settings

Unknown

Use cases

An example for the For Each Element in Collection component is as follows:

  • Personalized email

    A company sends a personalized email to remind employees of upcoming performance reviews. The For Each Element in Collection component takes in data from a database component and hands individual data elements to an email loop.

Personalized email

Scenario: Employees appreciate having one day's notice for an upcoming annual performance review. To help the employee remember and prepare for the review, a reminder email is sent the day before the meeting.

Process: This process is created in a Monitoring Project type.

The following screen shot shows the process:

The process starts with a custom integration component. This component is created with the integration engine.

For more information on using the integration engine, see the Workflow Solution Administrator's Guide.

www.altiris.com/support/documentation.aspx

The custom component retrieves all of the assigned dates for each employee's annual performance review. It passes this data to the For Each Element in Collection component.

The For Each Element in Collection component takes the collection of dates and hands them to the rest of the process one at a time. When the final date has been evaluated, the "finished" output path ends the process.

The Get Current Date component retrieves the current date and adds it to the process as a variable called CurrentDate.

The Date Difference component takes this variable and subtracts it from the performance review date called OneReviewDate. The difference becomes an output variable called DaysUntilReview.

The Equals Rule component compares the variable DateDiff with the number 1. If the two numbers match, the component uses the "equals" output path. If not, the component uses the "not equals" path, which returns the workflow to the For Each Element in Collection component for another date variable.

If the numbers do match, that means the date of the meeting is one day away. A Send Email component sends an email to the employee with notification of the meeting.

Other components in this example are as follows:

  • Custom component

    This component was created with the integration engine.

    For more information on using the integration engine, see the Workflow Solution Administrator's Guide.

    www.altiris.com/support/documentation.aspx

  • Date Difference

  • Get Current Date

  • Equals Rule

  • Send Email

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Related Entries and Links

No Related Resource entered.