How to delete a row from data table

I have to delete a row that contains a particular string variable from a data table. string variable is input from user and I need to delete a row which contains this string variable value.

3 Likes

string value will be a full name… single variable is enough for a full name???

1 Like

Hi,

Hope the following helps you.

Regards,

1 Like

hey
1 - Read Range
2 - Create a ArrayofDatarow = outDataTable.Select(“[YourColumnName]=‘yourrowvalue’”)
3 - For each loop (System.Data.DataRow) and inside loop use Remove DataRow
Cheers @rifnanahasRemoveSingleRow.xaml (7.5 KB) here is a a sample which might help you

1 Like

Hi,

Can you check if TypeArgument of For Each is not object but System.Data.DataColumn?

Regards,

1 Like

"[Column1] = ’ “+StrVAr+” ’ "

1 Like


it’s working fine for me here

1 Like

what is you EmployeeCopyDT variable type
and EmployeeList Variable Type

1 Like

both are data tables

Did you check my workflow? @rifnanahas

1 Like

okay if you are approaching that way datatableVar=datatableVar.Select(“[Column1]='”+StrVAr+"').CopyToDataTable
and use DatatableVar in writeRange

1 Like

Now my error has gone. But that particular row is not deleting
sample.xaml (15.4 KB)

try nowsample.xaml (16.3 KB)
Before Trying remove that Remove Data row Activity

1 Like

row is not getting deleted

1 Like

give your excel and tell which row has to delete

1 Like

here you go with a sample
hope its resolved
deleterows.zip (16.3 KB)

Cheers @rifnanahas

1 Like

here I want to delete the row with Employee xxx. But it shouldn’t be harcoded. xxx should be stored as a string variable .EmployeeList.xls.xlsx (8.8 KB)

New folder.zip (12.8 KB)
cheers

1 Like

Thank you

sorry i didnt get you!

1 Like