Question

Passing a collection of records as separate records to other process elements in a script task

Out of curiosity, and because it would be useful to know, on the Process collections page of the User Documentation it says:

 

"There are several ways of processing a collection:

...

Use the [ Script task ] element to process the parameters of the “collection” type. For example, you can use a C# script to parse the collections of records into separate records that can be passed to other process elements."

 

My question is how would you pass the separate records sequentially to other process elements from within a script task?

Like 0

Like

2 comments

Hi Gareth, 

Here's an example of iterating over the collection of records and setting the result value to the process parameter. 

 

var entities = Get<ICompositeObjectList<ICompositeObject>>("ReadDataUserTask4.ResultCompositeObjectList");
 
var result = "";
 
foreach(var entity in entities) 
{
    	var Name = "";
    	if (entity.TryGetValue<string>("Number", out Name))
    	{
    		result = result + Name + ", ";  
    	}
}
 
Set("ProcessParamenter", result);
return true;

 

Thanks for the reply.

Show all comments