How to assign string variable to List<String> array


#1

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


#2

Hi @saraawq,

Use add to collection activity.
Refer this link

Regards,
Arivu


#3

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


#4

image


#5

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


#6

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?


#7

It will not overwrite refer the link first.

Regards,
Arivu


#8

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


#9

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


#10

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


#11

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


#12

Use string.join("," ,array )

Or
Loop the array with for each