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

datatable
excel
activities

#1

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.


How to Append Column to A Scrap Result Data Table?
How to check a specific column in the datatable is blank or not
#2

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


#3

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)


How to insert data dynamically in data table
How can I insert a blank row in the data table or .csv file?
Create CSV File with ScreenScraping Results
Scraping text from an Input Field
#4

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


Update Column in a specific row
UiPath Community
#5

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

Thanks a lot :slight_smile:


#6

welcome :slight_smile:


#7

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


#8

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.


#9

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

ClaimGetRow.xaml (30.1 KB)


#10

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?


#11

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

image


#12

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


#13

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


#14

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


#15

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


#16

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


#17

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


#18

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


#19

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!


#20

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