How to remove a row with a specific ID from a Data Table?

What is the command to remove a particular row with a specific ID from a Data Table in UiPath.

@vivek_Chowdary,

Use Remove data Row activity to remove the row from dataTable.

how to remove the row based on ID?

@vivek_Chowdary,

  1. Iterate dataTable using for each row activity
  2. If row(“ID”).toString = ''requiredValue"
    Then use Remove Data Row activity and pass dataTable name and row

what is the value to be entered into the row field in Remove Data Row activity?

hiii
@vivek_Chowdary
Try this sample workflowMain.xaml (9.8 KB)

@monika.c

From where did you get that MethodName?

Its showing as error when I type in the same name.

@vivek_Chowdary,

This method will work when DataTable contains one matching row only.

But what should be entered into the row field in the properties?

@vivek_Chowdary

put the current row from the for each activity. If the row name is “row” then use it in the properties field.

@vivek_Chowdary,

Find the attached workflow.

Main.xaml (14.7 KB)

@monika.c

Its working fine for 1 ID. But its not working for multiple ID’s.

Hi @vivek_Chowdary

use the for each activity and list of Id which you want to remove from the table
Iterate over a list and inside the for each activity pass the one by one list item when in ID in your case to the remove data row then it will remove the data row from the datatable

Hope helpful

hii
@vivek_Chowdary
For multiple ID’s you can assign…
data_to_del=dt.Select("[Name]=‘Ron’ or [Name]=‘John’ or [Name]=‘Ram’")Main.xaml (9.9 KB)
Hope that works for you…

Yes… use Filter DataTable Activity for removing row with specific ID


“ID” is your column name and “A005” is ID …it will delete entire row which have ID “A005”

Thank you very much, it worked!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.