Enter string in a Datatable

I have a array {‘a’,‘b’,‘c’} which I want to insert in a new datatable .The datatable should contain 3 rows a,b,c.
Can anyone suggest a way to do to ?

@Abc_Xyz1

Use a for loop…give input array in the in argument and change type argument to string

Use a add data row with {currentItem}

Cheers

Use ‘Add Data Row’ activity and you can pass the array of strings through one of the input properties labeled “ArrayRow”

image

I tried this I get Add data row : object reference not set to an instance of object

@Abc_Xyz1

First before for loop use a build datatable qctivity…add only one column and assign datatable in output

Cheers

Hey

can you try the following?
image

yourArray.Select(Function(n) cobj(n)).ToArray()

Regards

That did the work.
One more query.
I have 1st datatable has 1 column with 3 rows a,b,c
2nd datatable has 2 columns
Column1. Column2
a 1
b 2
c 3

Can I just compare these two datatables and get
a–>1
b->2
c–>3
in the datatable?

@Abc_Xyz1

Do you mean you wamt to replace a with 1 in second table?

Loop on table with one column using for each data row in datatable

Then inside loop use filter datatable on two columns table on column containing a,b,c …give condition as column name on left equals on right currentrow("columnnamefromfirsttable).Tostring

Then use if condition filtereddata.rowcount>0

Then found a matchign value use assign currentroe(“columnname singlecolumn”) = filtereddt.rows(0)(“columnnamefromsecondtable”).ToString`

Cheers

I don’t want to replace a with 1 instead I want to have two columns which has a in col1 and 1 in col2.

@Abc_Xyz1

Then if it is series …in for loop properties you have a index …assign variable to it…

Now use {currentitem,(indexvar+1).Tostring}

And add one more column in build datatable

Cheers

How do we add another string in the datatable as right now I created a Datatable for array of string … I want to add rows in d third column with strings coming from another sequence …
Can we add the string variable in add data row activity?

@Abc_Xyz1

Can you please show what you are trying to acheive…with some screenshots or attach a sample xaml…if you have any sample input and outputthat also will help

Cheers

I got it sorted… Thanks for your help

1 Like

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