Append string to array

Hello friends,
@rkelchuri, @Ninett_Panfir, @Rammohan91, @balupad14, @Florent_Salendres, @vvaidya, @Palaniyappan, @ClaytonM, @vvaidya

how is it possible to append subsequent strings at the end of an array (which is initially empty)?
Thank you so much,
Cami :slight_smile:

2 Likes

@CamiCat,

You can get the length of the array using array.length.

Then use assign activity as

array(count+1) =
“value you want to append”

3 Likes

I don’t know if it’s the best method, but I use the .Concat() when wanting to add items to arrays.

arrvariable.Concat({"newstring"})

or you can use an array variable inside the parenthesis.

Regards.

4 Likes

Oh also with my previous suggestion, the array initially needs a value, even if it’s an empty array. So initialize it as {}, if you can

2 Likes

Thank you so much @ClaytonM.
And hot to print all values in the array in an excel cell of an Excel file?
it’s a lista of name of files and I should report it in a cell.
Thank you,
Cami

To output an array to a string, so you can assign to a cell, you can use String.Join()

String.Join(", ",arrvariable)
6 Likes

That can be done in many ways @CamiCat,

  1. Use excel application scope
  2. initialize a variable of type integer assuming as count
  3. Loop through the array inside excel application scope
  4. use write cell activity and give the value as item (for each value) and range as “A” + count.tostring
  5. Increment the value as count = count + 1
1 Like

Thank you so much for your precious help @ClaytonM.

1 Like

Thank you so much @HareeshMR for your help.
Cami :wink:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.