Hi i’m new to UiPath, i want to add multiple user input(integers) to an arraylist/list. How to achieve this. and arraylist or list which would be appropriate??
Main.xaml (26.2 KB)
@loginerror
Hi
pls try with ADD TO COLLECTIONS activity
And try to use LIST as only list can include new element in it as array would require a defined index range and more than we won’t be able to add new value to array
So let’s do it with list variable
Where in
Collection property mention your list variable name
And
Item property mention the integer value you want
And
In argument change the rule as integer
Cheers @selwin.s
I added 3 integer to a list i.e 1,3,4 through user input and when i iterate the list using foreach, the loop runs only one time.
In while loop dialog what is the variable type of dialog and input
I hope input is of type int32
But what is the type of dialog variable
Use a writeline before while loop and mention dialog variable name and let’s see how the value looks like
Pls share that screenshot
Cheers @selwin.s
dialog variable type is int32.
Hi @Palaniyappan I called the list.count() in writeline activity and found it gives the output of 1. Each element is getting replaced instead of appending
Hi @selwin.s
Can you check where List variable initialized it should be initialized before the loop
@selwin.s You can alternatively use “Invoke method” to add all the values in to the List directly. I have attached a sample workflow for you. Hope this will work easy for you. Let me know if this works.
Cheers.
AddValuesToList_InvokeMethod.xaml (6.8 KB)
thanks @aanandsanraj it was really helpful yes the list was initialized within the while condition, now its working as i expected after i initialized before the loop
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.