4 weeks ago
Hi team,
I'm facing a weird issue when extracting a field value from a collection using simple dot notation.
See the snaps below. The collection has data and values, but in the calc stage, all the fields are showing empty values. If I run then it also throws error.
To note this is outside the loop. Post loop completion I'm using a calc stage to grab a value. If I perform the same before the loop, calc stage works fine.
In Collection I can see value
4 weeks ago
Anytime a collection says "# Row" or "# Rows", you can't use an expression to reference a field in it because no row is selected. The reason it works before the loop is that by default Row 1 is selected. If you only have one row, then it can lead you to think something is wrong here when you try to use a calc after the loop, but it's always functioned like this I think. I tested it in 7.3.1 and 6.10.1 just to make sure I'm not crazy, and I see the same behavior in both. I get an error in the calc stage after the loop saying the collection has no current row.
As for the other issue you mentioned where the calc stage appears to be empty, did you try setting the value into a data item? I am guessing it shows empty for you where it says Temporary Values because that's just what it does if you don't have a current row selected, such as once you leave the loop. I tested this in 7.3.1, and during the loop for me it gets the value.
4 weeks ago
Yes, the collection and field I'm referring to have data. I understand the # row notation but once loop is completed shouldn't it return to the default behaviour as it was before the loop?
I have a master collection from that I'm taking a coll field to a local collection, now if I copy the same collection to 2 different collections and loop only on one of them still it shows # Row in all collections.
Try to take another parent collection and then save your Data collection on this page. Now take Data1, Data2, Data3 and populate it using 3 calc stages. After that run loop on Data1 and notice the # Row label on all Data2 and Data3.
Post loop completion all 3 will go into the same issue even though all 3 are individual collection.
3 weeks ago - last edited 3 weeks ago
Hi @teja1 ,
As @david.l.morris rightly said this is an issue (if it's an issue) since always in Blue Prism (faced in v6.3, v6.6, v7.1)
You can always fetch the 1st row value using a calculation stage at the beginning of a loop as the collection notation shows Row # of #
Once you end the loop and the collection notation changes to # rows , if you try fetch the value it throw the same error.
The fix I found because of the similar issue as yours is to use the Remove empty rows action as a 1st thing at the end of the loop. This resets the collection notation back to Row # of # and you can continue with your thing.
I guess BP needs to come up with a Reset Collection Status action !