# How to remove rows using filter data table with variable inside the filter data table

**URL:** <https://forum.uipath.com/t/how-to-remove-rows-using-filter-data-table-with-variable-inside-the-filter-data-table/456257>\
**Category:** Activities\
**Tags:** question, excel, system, activities\
**Created:** [July 13, 2022, 10:44am UTC](https://forum.uipath.com/t/how-to-remove-rows-using-filter-data-table-with-variable-inside-the-filter-data-table/456257 "2022-07-13T10:44:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rhys18](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rhys18/32/304108_2.png) [@Rhys18](https://forum.uipath.com/u/Rhys18)\
**Post date:** [July 13, 2022, 10:44am UTC](https://forum.uipath.com/t/how-to-remove-rows-using-filter-data-table-with-variable-inside-the-filter-data-table/456257/1 "2022-07-13T10:44:32Z")

</div>

Hi,

I have an activity to remove a rows but based on inputted customer ID from excel. In order to do this, it need to read the excel then save it to datatable, and should the data table converted to string in order to delete it? If no, then how to delete it? Does it have to be done with looping or with a string? Here’s an example in excel :

 ![image](https://global.discourse-cdn.com/uipath/original/4X/b/7/b/b7b0a9a619399f5ac32837e6f75e3697fd47c9ee.png)

---

<div class="post-metadata">

**Author:** ![Vaibhav\_Rajpoot\_17](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vaibhav_rajpoot_17/32/310892_2.png) [@Vaibhav\_Rajpoot\_17](https://forum.uipath.com/u/Vaibhav_Rajpoot_17)\
**Post date:** [July 13, 2022, 10:48am UTC](https://forum.uipath.com/t/how-to-remove-rows-using-filter-data-table-with-variable-inside-the-filter-data-table/456257/2 "2022-07-13T10:48:08Z")

</div>

@Rhys18

```auto
Have a look on this thread->

```

> **[Four Ways to Filter Data Tables in UiPath Studio | UiPath](https://www.uipath.com/community/rpa-community-blog/four-ways-to-filter-data-table-in-uipath-studio)**
>
> Discover how working with data tables are an important part of automation. Learn some cool, handy activities for filtering data tables on UiPath Studio.

---

<div class="post-metadata">

**Author:** ![Veera\_Raj](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/veera_raj/32/523251_2.png) [@Veera\_Raj](https://forum.uipath.com/u/Veera_Raj)\
**Post date:** [July 13, 2022, 10:49am UTC](https://forum.uipath.com/t/how-to-remove-rows-using-filter-data-table-with-variable-inside-the-filter-data-table/456257/3 "2022-07-13T10:49:02Z")

</div>

step 1 read the first table DT1  
step2 read the second table DT2

for each row(dt2) activity and inside for each row use filter table  
for filter table input is dt1

configure the column name and value of filtter should be row(cutomerid).tostring

---

<div class="post-metadata">

**Author:** ![Rounak\_Kumar1](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rounak_kumar1/32/267009_2.png) [@Rounak\_Kumar1](https://forum.uipath.com/u/Rounak_Kumar1)\
**Post date:** [July 13, 2022, 10:51am UTC](https://forum.uipath.com/t/how-to-remove-rows-using-filter-data-table-with-variable-inside-the-filter-data-table/456257/4 "2022-07-13T10:51:07Z")

</div>

hey,  
you can use merge Data table  
where you can keep output of of First Data Table as DT1 and DT2 as destination of  
Second Data table.  
Thanks

---

<div class="post-metadata">

**Author:** ![supermanPunch](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/supermanpunch/32/133652_2.png) [@supermanPunch](https://forum.uipath.com/u/supermanPunch)\
**Post date:** [July 13, 2022, 11:47am UTC](https://forum.uipath.com/t/how-to-remove-rows-using-filter-data-table-with-variable-inside-the-filter-data-table/456257/5 "2022-07-13T11:47:41Z")

</div>

Hi @Rhys18 ,

Could you Check the below Linq Expression :

```auto
CurrentDT.AsEnumerable.Where(Function(x)Not(DT_List.AsEnumerable.any(Function(y)y("Customer_ID").ToString.Equals(x("Customer_ID").ToString)))).CopyToDataTable

```

---

<div class="post-metadata">

**Author:** ![Rhys18](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rhys18/32/304108_2.png) [@Rhys18](https://forum.uipath.com/u/Rhys18)\
**Post date:** [July 14, 2022, 3:19am UTC](https://forum.uipath.com/t/how-to-remove-rows-using-filter-data-table-with-variable-inside-the-filter-data-table/456257/6 "2022-07-14T03:19:48Z")

</div>

Tried it and it throw me “source contains no datarows” :

![image](https://global.discourse-cdn.com/uipath/original/4X/d/3/1/d316407d91a44fe8773737720c2d7a47c12b50fc.png)

I even added .Trim after .ToString and it still says no datarows

---

<div class="post-metadata">

**Author:** ![Rhys18](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rhys18/32/304108_2.png) [@Rhys18](https://forum.uipath.com/u/Rhys18)\
**Post date:** [July 14, 2022, 3:21am UTC](https://forum.uipath.com/t/how-to-remove-rows-using-filter-data-table-with-variable-inside-the-filter-data-table/456257/7 "2022-07-14T03:21:09Z")

</div>

Thanks for the help ! Will learn this in paralel

---

<div class="post-metadata">

**Author:** ![Rhys18](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rhys18/32/304108_2.png) [@Rhys18](https://forum.uipath.com/u/Rhys18)\
**Post date:** [July 14, 2022, 3:31am UTC](https://forum.uipath.com/t/how-to-remove-rows-using-filter-data-table-with-variable-inside-the-filter-data-table/456257/8 "2022-07-14T03:31:24Z")

</div>

Thank you ! Tried this and it works

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [July 17, 2022, 3:31am UTC](https://forum.uipath.com/t/how-to-remove-rows-using-filter-data-table-with-variable-inside-the-filter-data-table/456257/9 "2022-07-17T03:31:47Z")

</div>

Closed on July 17, 2022, 3:31am UTC

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