Add array of string to datatable

Hi,
I want to add array of string as datarow in datatable…

For example: I want to add {“abc”,“cde”,fgh"} in to a datarow…

Can anybody help to resolve this???

Fine
—we can use ADD DATAROW ACTIVITY where we can mention the datatable name in datatable property and
—in the array row property mention this array or pass this array variable as input

Then change the type argument as string
Make sure that we have same number of columns in the datatable as we have in the array (no of elements) and also the order of values passed must same so that it will get entered at right position

Cheers @Mohammed1

Hi @Mohammed1

Please follow the below steps

  1. Add Data Row activity
  2. In the property window you can find ArrayRow
  3. Add your array in that field
  4. In DataTable give your datatable variable

Hy Mohammed !

You can use “Add Data Row” activity where:

  • ArrayRow is your input array ( {“abc”,“cde”,fgh"} ) - you must define this array in a variable
    ex: VariableArray = {“abc”,“cde”,fgh"}
    VariableArray should be “Array of String (System.String)” as Variable type
  • DataTable is where your input array ( datarow) will be added

Hope is ok for you !

Actually, In the output datatable am not getting array of string value in column 2, am just getting system.string expression

Can anyone help me to resolve this?

Kindly share that screenshot pls
Cheers @Mohammed1

Yeah, I need {“abc”,“cde”,fgh"} this value in the the place of system.string
Capture

Hey @Mohammed1

See if below screenshot will help you.

image

Lemme know in case you are still facing problems.

Regards…!!
Aksh

1 Like

Hey Mohamed !

Use this :
where “arr” is system.string

1 Like

No I want Array of string value in the marked locationCapture%201

1 Like

Fine in that case
mention as String.Join(“,”,yourarrayvariable)

like in the array row property mention as
{“anyvalueforcolumn1”, String.Join(“,”,yourarrayvariable)}

this will appear as
Column1, Column2
valuewementioned, abc,def,ghi

or
{String.Empty,String.Join(“,”,yourarrayvariable)}

this will appear as
Column1,Column2
, abc,def,ghi

Cheers @Mohammed1

3 Likes

Hi,

Thanks, I am able to do this.

But I want to add the array value to specific column of data table as I have many columns in my data table.

How to do this ?

1 Like

Can I have an example pls

Cheers @gks.gauravkr

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