cancel
Showing results for 
Search instead for 
Did you mean: 

Why can "Loop" get items stored in a collection in order?

sumire
Level 9
This is a sample collection "Col1".
12353.png


This process reads the items in "Col1" and outputs each  "Name" to  "ReadData".
12354.png

Inside "concatenate":
12355.png

Execution result is:
12356.png
I am wondering why " Loop"  get items from "Col1" in order from the top
I know For Each...Next Statement doesn' t control the order in which to get items.
Who control the order?


------------------------------
Mitsuko
Asia/Tokyo
------------------------------
------------------------------
Mitsuko
Asia/Tokyo
------------------------------
1 BEST ANSWER

Helpful Answers

NicholasZejdlik
Level 9
Collections in Blue Prism are based on the .NET DataTable class, which uses a DataRowCollection to store row data, which is what would determine the order of rows. It would not make sense for them to not have a determinate order since it would make it impossible to access a row via index, and things like sorting would be quite pointless. The order of items you see on the collection will always match the order in which Blue Prism loops through them.

------------------------------
Nicholas Zejdlik
RPA Developer
------------------------------

View answer in original post

3 REPLIES 3

NicholasZejdlik
Level 9
Collections in Blue Prism are based on the .NET DataTable class, which uses a DataRowCollection to store row data, which is what would determine the order of rows. It would not make sense for them to not have a determinate order since it would make it impossible to access a row via index, and things like sorting would be quite pointless. The order of items you see on the collection will always match the order in which Blue Prism loops through them.

------------------------------
Nicholas Zejdlik
RPA Developer
------------------------------

Thanks Nicholas that's it I want to know
> The order of items you see on the collection will always match the order in which Blue Prism loops through them
I wanted to know the reason for it.
Thanks again​

------------------------------
Mitsuko
Asia/Tokyo
------------------------------
------------------------------
Mitsuko
Asia/Tokyo
------------------------------

Apparently rows have an internal index assigned that can be used to directly address one specific line and makes a fix order mandatory. 
https://docs.microsoft.com/en-us/dotnet/api/system.data.datarowcollection.indexof?view=netframework-4.8#System_Data_DataRowCollection_IndexOf_System_Data_DataRow_

The index is assigned in order of how/when rows are added, if not specified otherwise.
If this would not be the case, the lines could be random whenever data is fetched with the possibility of reading one line twice.

It seems Blue Prism adds additional control mechanism as it is aware of which line was already processes / which one is the current line

I am no programming guru, so I wonder why a datatable (or collection in Blue Prism) shouldn't have fix order?

------------------------------
Walter Koller
Solution Manager
Erste Group IT International GmbH
Europe/Vienna
------------------------------