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 ?


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

Use a add data row with {currentItem}


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


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


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



can you try the following?

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


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
in the datatable?


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`


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.


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


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?


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


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.