How to assign string variable to List<String> array

Hi all,

I would like to know how to assign string variable to a variable that i assign with new List(of String).

I have a variable called finalArray = new List(of String)
I have a variable that i want to put in finalArray but there’s this error.

image

Hi @saraawq,

Use add to collection activity.
Refer this link

Regards,
Arivu

1 Like

Hi @arivu96,

Thanks! But my arrayVarName will always change cause its dynamic and when i try this it gives me an error, how do I resolve it?

image

image

Hi @saraawq,
Refer this image

Here in properties

Collection-> list name
Item.-> what value you adding that one alone
Type argument-> list of array type.

You should not add just pass your value alone

Regards,
Arivu

1 Like

How do i pass in the value in the array?

for example my arrayVarName is 1 then subsequently it will be 2
How do I stored it so that 2 will not overwrite 1?

1 Like

It will not overwrite refer the link first.

Regards,
Arivu

Add the “string” data type values in to collection .

Add to collection activity “type” should be string.

Then use this list or convert this list to array by.
List.ToArray

okay thanks! How do I see the values in my array? Do i just write message box ‘finalArray.ToString’ or?

Thanks! How do I see the values in my array? Do i just write message box ‘finalArray.ToString’ or?

Hi @saraawq,
Use the below code it will return the string value with comma separated.

String.join(",",finalArray)

Use log message or write line or message box activity to see the result

Regards,
Arivu

Use string.join(“,” ,array )

Or
Loop the array with for each