Digital Exchange

last person joined: 21 hours ago 

This community is a place to discuss the Blue Prism DX and all of the assets hosted there.
Expand all | Collapse all

Edit Value in Collection by Index in Blue Prism

Jump to Best Answer
  • 1.  Edit Value in Collection by Index in Blue Prism

    Posted 08-05-2019 10:30

    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.


  • 2.  RE: Edit Value in Collection by Index in Blue Prism

    Posted 08-05-2019 10:36
    Edited by Ami Barrett 08-05-2019 10:36

    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
    ------------------------------



  • 3.  RE: Edit Value in Collection by Index in Blue Prism

    Posted 08-18-2020 15:41
    Is there a similar code in VBS, please?
    Thanks!

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



  • 4.  RE: Edit Value in Collection by Index in Blue Prism

    Posted 08-18-2020 16:29

    Should look something like this, @Eduardo GS Carvalho

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


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



  • 5.  RE: Edit Value in Collection by Index in Blue Prism

    Posted 08-18-2020 16:47

    ​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







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



  • 6.  RE: Edit Value in Collection by Index in Blue Prism
    Best Answer

    Posted 08-18-2020 17:22
    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
    ------------------------------



  • 7.  RE: Edit Value in Collection by Index in Blue Prism

    Posted 08-20-2020 06:52
    Thank you a lot, Ami, I was able to use it to do what I needed!​

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