# Filtering value from datatable with loop taking time

**URL:** <https://forum.uipath.com/t/filtering-value-from-datatable-with-loop-taking-time/342492>\
**Category:** Studio\
**Tags:** tools, question, studio, system, activities\
**Created:** [September 4, 2021, 5:20am UTC](https://forum.uipath.com/t/filtering-value-from-datatable-with-loop-taking-time/342492 "2021-09-04T05:20:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lorun\_hiper](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/lorun_hiper/32/228383_2.png) [@lorun\_hiper](https://forum.uipath.com/u/lorun_hiper)\
**Post date:** [September 4, 2021, 5:20am UTC](https://forum.uipath.com/t/filtering-value-from-datatable-with-loop-taking-time/342492/1 "2021-09-04T05:20:57Z")

</div>

I am using for each row to check value of specific column from datatable and inside loop I am using if condition for checking whether value exists in the datatable or not.

Process is taking time can we do it without loop?

---

<div class="post-metadata">

**Author:** ![ghazanfar](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ghazanfar/32/175617_2.png) [@ghazanfar](https://forum.uipath.com/u/ghazanfar)\
**Post date:** [September 4, 2021, 5:22am UTC](https://forum.uipath.com/t/filtering-value-from-datatable-with-loop-taking-time/342492/2 "2021-09-04T05:22:49Z")

</div>

Hi,

You can check it with linq query.

Try this:  
yourDT.AsEnumerable().Any(Function(x) x(“yourDatatableColumn”).ToString = DesiredValue)

---

<div class="post-metadata">

**Author:** ![lorun\_hiper](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/lorun_hiper/32/228383_2.png) [@lorun\_hiper](https://forum.uipath.com/u/lorun_hiper)\
**Post date:** [September 4, 2021, 5:27am UTC](https://forum.uipath.com/t/filtering-value-from-datatable-with-loop-taking-time/342492/3 "2021-09-04T05:27:37Z")

</div>

Thanks @ghazanfar

---

<div class="post-metadata">

**Author:** ![pravin\_calvin](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pravin_calvin/32/212149_2.png) [@pravin\_calvin](https://forum.uipath.com/u/pravin_calvin)\
**Post date:** [September 4, 2021, 5:30am UTC](https://forum.uipath.com/t/filtering-value-from-datatable-with-loop-taking-time/342492/4 "2021-09-04T05:30:35Z")

</div>

Hi @lorun_hiper

`DataTable.AsEnumerable.Where(Function(dr) Convert.ToString(dr(“YourSearch Column”)) = "YouSearchString")`  
it will return True Or false based on value exits

If You need to copy the value as datatable or list

`DataTable.AsEnumerable.Where(Function(dr) Convert.ToString(dr(“YourSearch Column”)) = "YouSearchString").CopyToDatatable/List`

Regards

---

<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:** [September 7, 2021, 5:30am UTC](https://forum.uipath.com/t/filtering-value-from-datatable-with-loop-taking-time/342492/5 "2021-09-07T05:30:36Z")

</div>

Closed on September 7, 2021, 5:30am UTC

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