Multiple script task instances

Example

bild1

The following workflow properties have been set for the sequential script task:

NewItem1002

The "Prepare Data" script task provides the collection and also initializes the result variable for the "Calculate Product" script task.

The workflow expression of the preparation task consists of this Python code:

Data = [1, 2, 3, 4]
Product = 1

So we have an array Data with the numbers we want to calculate the product with.

The workflow expression of the "Calculate Product" script task performs the actual calculation. This is done with the following Python code:

Product = Product * Token.Attributes["Figure"]
Result = Product

We obtain a value of the collection by addressing its element variable with Token.Attributes, calculate the product of the collection and store it in the result variable.

The collection is read-only. So you can get a value of the collection with Token.Attributes[string] (or Token.GetAttribute(string)) but you can’t modify the collection value with Token.SetAttribute(string, object).