I have an array of ui elements and I loop over each one and get the ‘get attribute’ component to get the value and save it to a variable called ‘companyName’, that works, the problem is that I now want to create a new array of strings with just these values but the problem is that when it gets to the ‘append item to list’ UiPath throws an error saying “object reference is not set to an instance of an object” any ideas of how to add these strings to an array/list in a for each loop?
we recommend to use a list (e.g. String list)
before using the list, it has to be initialized
For example: got to variable panel, search for the variable and set its default value to:
new List(Of String)()
as an alternate we can do it also directly within an assign activity
Assign Activity
compList | Datatype: List(Of String) =
companies.Select(Function (x) x.Get("outerText").toString.Trim).ToList()
Hi @Michael10
Might be you are not initialized the List. Before each use assign activity to initialize the list as below,
- Assign -> compList = New List(Of String)
Hope it helps!!
Hi @Michael10
Try by initializing the List Of String.
New List (Of String)
Hope it helps you to Understand !!
Cheer !! Happy Automaion
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.