Search code examples
collectionsblueprismrpa

How to refer to a column with index instead of name in a collection in Blue Prism


I read an excel range into collection with standard BP Excel VBO. The range sometimes has headers sometimes not, that is why the header of my collection is not standard. I would like to loop through on the collection the get the data what I need from a column, and the only thing I know that the data is in Column2. Is there a way in Blue Prism to refer to a column in collection with column index like Collection.Columns[2] instead of column name?


Solution

  • This functionality is not supported out of the box. However, you have two options:

    1. Create a new Business Object with a code stage-based action that reads an input collection at a specified column index and row number to an output data item.

      InputCollection.Rows.Item(rowNumber).Item(columnIndex)
      
    2. Define the expected headers manually in a separate Collection, then use the Set Column Names From Expected Collection action within the Utility - Collection Manipulation VBO bundled with Blue Prism to set the headers. Afterward, you'll be able to use simple Blue Prism-style dot (.) notation to grab the fields that you need.