AddRow in DataTable

I have a data table with three column 1. Serial Number( int type, auto increment) and other two strings. when i am adding data row to this data table i created {“ABC”,“DF”} i am getting an error “Add Data Row: Input string was not in a correct format.Couldn’t store in SerialNum Column. Expected type is Int32.” then i tried to keep it “” then it says string type can not be hold in this column. how should i pass data to the row

Hi @Jyothilekshmi_menon

i think u had to pass the serial number too there if u are adding via add datarow

or u can try using write cell activity or using assign activity

Hi @Jyothilekshmi_menon ,

There are various methods to handle this, the best way would be as below:
Re arrange the columns so that the SL.No is at last(filter data table can be used)
Add Rows without serial Number
Since serial Number is set to be autoincremented it will be incremented and added
Re-arrange again back to normal

Thanks nived for quick responds, however i thought there will be a way to handle with add row method itself.

Check this below workflow, @Jyothilekshmi_menon
Uipath_AppendRowToTable.xaml (7.5 KB)
Hope this may help you :slight_smile:

1 Like

This is a good answer, even i thought the same to do. But actually it has extra steps of rearranging. Thanks a lot for your immediate responds :slight_smile:

Hi @Jyothilekshmi_menon

you can add counter variable and add it in add datarow, , and then increment it

I came to know that creating a column in left extream side of a datatable as auto incremental type can not be done. If you seeinanother comment either you have to declare your auti incremental column at extream right / you can re arrange the column after adding the data row.
Thanks & Regards
Jyothi sajith

with the assumption of not reordered etc. did you try following:
{nothing, “String1”,“String2”}