How to add new value (data row) in existing Datatable?

Hi,

I have a DataTable with 10 columns.

I have 2 values in String variables, I need to insert those 2 values in the appropriate columns as a Last Row of the same DataTable.

How can I do this? Someone please help to achieve this.

11 Likes

Hi @cthamizh,

You can use append range activity. But number of columns to be added should be equal to number of columns in existing Data table irrespective of number of rows to be added.

Thanks,
Vikas Reddy

You can try Add data row activity and in the array row property you can pass the row values.

{"","","","","","",rowval1,"",rowval2,"",""} (should be 10 columns)

15 Likes

Use add data row with arrow property as {} - ie you are adding a blank row.
Use assign add value to the specific cell in datatable:

“tablename”.Rows(“rownumber”).Item(“columnName/columnNumber”) = value

26 Likes

Hi @palindrome - Your suggestion is so helpful. I have achieved what I required.

Thanks a lot :slight_smile:

1 Like

welcome :slight_smile:

1 Like

Hi palindrome…I have Similar Query, below is the screenshot , Please check and help.
Thanks in advance

Use assign to add value to specific cell.
example:
dt.Row(6).Item(6)=value

To add blank row in datatable use {} in array row and Datatable as tablename.

2 Likes

Hello palindrome, I did the same attaching my work flow and displaying screens, please help.

ClaimGetRow.xaml (30.1 KB)

1 Like

When using add data row from one DT do another, is there a way how to add DT.Rows(CurrentRow)+Comment to the next column?

It’s very simple. You have to use DataTable.NewRow method in *DataRow input.

image

8 Likes

Hi Palindrome,

I have scenario where i fetch one column data from database named State and carries values like (in below snaphot)

image

At this time these are only 18 but it can be upto any number.

I stored this data in Datatable named “sqlDT” , i want to apply my operation on if (State=Open) then
Value in all field (“Open”) should be changed to “In Progress” and then should be stored in data table after that i can run insert query to insert that updated data into database.

Please help

Hi based on condition I want to edit only specific existing rows of a column MCC.Can you please help @palindrome

In assign you can try :
row(“MCC”) = newValue

2 Likes

Hi Nitin According to my condition if EARFCNDL row is suppose 5780 then it should make MCC of only those particular row as one right now even after if condition it makes the whole MCC row as one.

Both row earfcn and mcc are int
Condition is
If row value of earfcndl = 5780 then row value of mcc of that particular row to be 1

Please Help!its really important
Thanks
vivek

Sorry EARFCNDL is string but olds value 5780 etc as with integer error is coming @palindrome

If MCC is a column and you want to update it to 1 for a specific row. then use assign activity with :

row(“MCC”) = 1

@akif_p This is smart way of adding New Blank row. Thank you.

1 Like

Hi,

I think my issue is similar

Can you please advise
I have to workflows
1.Upload data from ExcelFile into the queue in Orch - Numbers from CalumnA
2.Download data from the queue in Orch. Then Numbers one by one are checking in website if their are Valid or NotValid. If numer is Valid I have to go back to ExcelFile (the same excelfile as in point 1.) and in ColumnC write “ValidNumber” or If numer is NotValid again go back to ExcelFile (the same excelfile as in point 1.) and in ColumnC write “InValidNumber”

My issue
In 2 Forkflow I have in ExcelFile always in ColumnC “ValidNumber” status it must be something wrong in my sequence.
I attached only a part of the whole fExcelStatus.zip (2.1 KB)
reamwork

Do you need guys the whole 2 Workflows?

Thank you in advance!

1 Like

The above solution is giving error Assign : Exception has been thrown by the target of an invocation.