rpablueprism

Blue Prism Collection - Add Row from a Collection


Is it just me or does Blue Prism handle collections in a strange way?

Basically I want to be able to loop around a collection and if the collection has a certain value then add this row to another collection. Currently reading a value from the collection in the loop references the current row in the collection which is great.

However here is where I believe BP falls down; there does not seem to be a simple way to add the current row in the loop to another collection, any attempt at assigning results in copying the whole collection again in the loop.

It seems the only way to do this is to use the Copy Row action but then I need to maintain a counter to reference the row which defeats being able to loop around without one in the first place.

So simply, is there any way to get the current row in the loop and copy this row into another collection?

Example code in C# below, is very easy to do!

foreach ( var item in collection1 )
{
    if ( item.Flag == true )
    {
          collection2.Add(item);
    }
}

Solution

  • The internal loop counter you reference that's used in conjunction with Loop stages and the actions under the "internal" Work Queues VBO is for the exclusive use of these Blue Prism-provided stages and actions. This counter is not accessible outside of these contexts in any documented fashion.

    If you need to perform tasks based on specific row indices that are unknown before runtime, the official guidance from Blue Prism is to manually maintain a Data Item with the current row number you're operating on (as you seem to already be doing) and use that to perform the necessary index-based Collection operations.

    You may wish to suggest this feature to Blue Prism's product management team by submitting it as an idea in their Ideation portal.