How to add string dynamically to a list
suppose
“data1”
“data2”
“data3”
are the strings
no of strings are dynamic
@KarthikBallary You can add to list using “Add To Collection” activity
can you send sample file
It is showing add to collection is not intialised
@KarthikBallary For that variable in variable panel give default value as
New list(Of String)
here myList = List(Of String)
variable of type List
is it ryt?
Item- we need to pass the value ryt?
System.Collections.Generic.List`1[System.String]
I am getting this type of output
@KarthikBallary Please check below xaml file if you still have any doubts let me know.
Test.xaml (10.2 KB)
Hi
Hope these steps could help you resolve this
Just two steps
— in the variable panel create a variable of type
System.Collections.Generic.List(String)
And with default value as
New List(of String) and name the variable list_string
— now to add value value to that list we can use a special activity called
Add to Collections where in the property panel mention the collections as list_string and
In the item mention the string value we want to add
Like “value1”
And change the type argument as string in the property panel
For example here you go - one example from uipath resource
Simple isn’t it
Cheers @KarthikBallary
Hope this might be helpful to you.
Scenario 1: Create an array of string and initialize it .
2: Add Foreach activities to iterate with the array variable
3: Add Add to collection activities to pass the array of string.
See image below for your reference: Thanks
cheers
Happy learning
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.