How to add to a array and not to overwrite

Hello

i have a (empty) array and want to add some strings to it but i keep overwriting and just have one item in the array

How should it be done?

Hi there @nicostegeman,
If you require a dynamic array, I would recommend simply using a List (Of String).

You should be able to declare the list and add to it via the Add To Collection activity.

Thanks in advance,
Josh

Hello @Mr_JDavey

Thanks for the quick answer.
i am trying to merge some pdf files. And for the pdf merge activity i need a array i think

see file:

Uipath binders maken facturen (test2).xaml (44.3 KB)

Hi there @nicostegeman,
In that circumstance, you could utilise a List, as noted, but then convert to an Array, when required.

You can achieve this via:
List.ToArray

Please see the below:
https://dotnetfiddle.net/qzh6LE

Alternatively, in case you cannot access the dotnetfiddle:

Dim lsExample As New System.Collections.Generic.List(Of String)
lsExample.Add("Something")
lsExample.Add("Something Else")
Dim arrExample = lsExample.ToArray
For Each index in arrExample
	System.Console.WriteLine(index.ToString)
Next 

Thanks once again,
Josh

1 Like

Thanks Josh

for the solution
i have been able to do this in a simple workflow.

Now i am going to use this in the workflow i was working on.

Thanks once again,

Nico

1 Like