cancel
Showing results for 
Search instead for 
Did you mean: 

Edit Value in Collection by Index in Blue Prism

If I have a collection named CollectionLabels and the content is below

UI Value Label  |Backend ->Fields
Label1          |Backend1
Label2          |Backend2
Label3          |Backend3

How can I edit the 'Label2' to 'Label2_New' by index?

I really want to avoid using the Loop Stage since it's really slow. Is there a way like:

CollectionLabels.UI Value Label (2) = 'Label2_New'

I would really appreciate a fast moving code here.

--------------------------------------------------
Disclaimer: This content was auto-posted from Stackoverflow. The original Stackoverflow question is here Stackoverflow Post, posted by ac_98521.
Hi  I am a Digital Worker. Please check out my profile to learn more about what I do!
1 BEST ANSWER

Helpful Answers

If you change the 'Column' input from Number to Text, this should work:
Collection.Rows(Convert.ToInt32(Row))(Column) = newVal
Modified_Collection = Collection​


------------------------------
Ami Barrett
Sr Product Consultant
Blue Prism
Plano, TX
------------------------------

View answer in original post

6 REPLIES 6

AmiBarrett
Level 12

This C# stage assumes that the index you're updating is always of type Text. Should be fairly easy to make modifications to accommodate other data types.

Inputs:
Collection - Collection
Row - Number
Column - Number
newVal - Text

Outputs:
Modified Collection - Collection

Collection.Rows[Convert.ToInt32(Row)][Convert.ToInt32(Column)]=newVal;
Modified_Collection=Collection;


------------------------------
Ami Barrett
Lead RPA Software Developer
Solai & Cameron
America/Chicago
------------------------------

Is there a similar code in VBS, please?
Thanks!

------------------------------
Eduardo Gomes Serradela de Carvalho
------------------------------

Should look something like this, @EduardoGS_Carva

Collection.Rows(Convert.ToInt32(Row))(Convert.ToInt32(Column)) = newVal
Modified_Collection = Collection​


------------------------------
Ami Barrett
Sr Product Consultant
Blue Prism
Plano, TX
------------------------------

​Thanks, Ami, it worked perfectly!


Would there be a simple way to refer to Column by it's Name?
And Row by its Column=1 value (first one)?

Example: I want to change "val4" value, from fourth Row=XYZ and second Column=def, without calling them by Row=4 and Column=2, but by their names, is that possible?

Thanks a lot, other pictures show previous answer worked in VBS Code Stage!

column1 = abc def ghi jkl
opk val1 val5 val9
rst val2 val6 val10
uvx val3 val7 val11
xyz val4 val8 val12




7568.png
7569.png
7570.png

7571.png


------------------------------
Eduardo
------------------------------

If you change the 'Column' input from Number to Text, this should work:
Collection.Rows(Convert.ToInt32(Row))(Column) = newVal
Modified_Collection = Collection​


------------------------------
Ami Barrett
Sr Product Consultant
Blue Prism
Plano, TX
------------------------------

Thank you a lot, Ami, I was able to use it to do what I needed!​

------------------------------
Eduardo
------------------------------