cancel
Showing results for 
Search instead for 
Did you mean: 

Better looping on a modified collection

AmiBarrett
Level 12
I've got some custom collection manipulation code I wrote using the Linq library. I discovered the other day that if you loop through a collection, then pass it into a custom code stage to modify it mid-loop, the row position resets after it returns the modified data. It would be nice if Blue Prism could retain this info within the loop. I got around it pretty easily by modifying a cloned version of the collection, but it would be ideal if we didn't have to do that when it comes to large data sets, given how easy it is to make Blue Prism run out of memory.
3 REPLIES 3

John__Carter
Staff
Staff
Sounds like a good idea. This channel will get more visibility than the forum https://portal.blueprism.com/products/enhancement-request

AndreyKudinov
Level 10
Short version: this is how Datatable works. Problem with your request is: what happens if you loop over collection, then just drop all rows in the middle of your loop (simple case)? Nothing stops you from doing it. Now you either need to somehow only allow changing current row (not everyone would like this) or come up with some other magic selecting ""next"" row.

AmiBarrett
Level 12
@John__Carter - Thanks, I'll go check that out. @aikudino - You could do this by only using the Linq library and looping through row numbers that way, using decision stages to see if your row++ calculation stage has gone over the maximum number of rows. Each cell can be referenced with integers starting with 0, or by name in the case of columns. Couple that with SQL queries and you've got your solution. An enhancement like this would drastically simplify the process, though.