# How to filter data table as per the string array

**URL:** <https://forum.uipath.com/t/how-to-filter-data-table-as-per-the-string-array/230085>\
**Category:** Studio\
**Tags:** question, studio, system, activities\
**Created:** [June 10, 2020, 1:05pm UTC](https://forum.uipath.com/t/how-to-filter-data-table-as-per-the-string-array/230085 "2020-06-10T13:05:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sapta\_619](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sapta_619/32/26675_2.png) [@sapta\_619](https://forum.uipath.com/u/sapta_619)\
**Post date:** [June 10, 2020, 1:05pm UTC](https://forum.uipath.com/t/how-to-filter-data-table-as-per-the-string-array/230085/1 "2020-06-10T13:05:10Z")

</div>

Hi All,

I need some help, need to know a way how can we filter a data table from string array.

This is the data table:

 ![image](https://global.discourse-cdn.com/uipath/original/3X/e/2/e2c0033316482cc008fecda979c330285e6eb9df.png)

Consider if we have a string array value {A,B} and i need the data table only for these two column, how to achieve this logic?

@ [arivu96](https://forum.uipath.com/u/arivu96)

---

<div class="post-metadata">

**Author:** ![William\_Blech\_Sister](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/william_blech_sister/32/120552_2.png) [@William\_Blech\_Sister](https://forum.uipath.com/u/William_Blech_Sister)\
**Post date:** [June 10, 2020, 1:16pm UTC](https://forum.uipath.com/t/how-to-filter-data-table-as-per-the-string-array/230085/2 "2020-06-10T13:16:23Z")

</div>

Hy @sapta_619,

Unfortunately not!

At least for know to achieve what you want you must:

- create a data table with build data table activity (col A and B)
- loop through this excel via data table (for each row activity)
- add records to the data table

Regards

---

<div class="post-metadata">

**Author:** ![ppr](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ppr/32/464097_2.png) [@ppr](https://forum.uipath.com/u/ppr)\
**Post date:** [June 10, 2020, 2:49pm UTC](https://forum.uipath.com/t/how-to-filter-data-table-as-per-the-string-array/230085/3 "2020-06-10T14:49:30Z")

</div>

@sapta_619  
If I got you right then you would like to achieve that a String Array defines which columns are to pickup.  
In your case: {“A”,“B”} will pick up column A and B but not C

Give a play on:  
A origin Table with three Columns:  
 ![grafik](https://global.discourse-cdn.com/uipath/original/3X/f/c/fccc2cd8e740fd37b7304d3b02c692f4eedc16e6.png)

A string Array with the needed columns

 ![grafik](https://global.discourse-cdn.com/uipath/original/3X/a/5/a57faadc8c26a528e6fe99555bb9a181ce25c3bf.png)

the line below is doing a filtering based on the ColList Array:

 ![grafik](https://global.discourse-cdn.com/uipath/original/3X/4/b/4bf2f20a9a1845c113ff075fc803434b988f05f5.png)

---

<div class="post-metadata">

**Author:** ![sapta\_619](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sapta_619/32/26675_2.png) [@sapta\_619](https://forum.uipath.com/u/sapta_619)\
**Post date:** [June 10, 2020, 2:58pm UTC](https://forum.uipath.com/t/how-to-filter-data-table-as-per-the-string-array/230085/4 "2020-06-10T14:58:33Z")

</div>

Thanks worked fine. However i got the answer in this feed after i posted.

> [@DataTable filtering with expressions](https://forum.uipath.com/t/datatable-filtering-with-expressions/21692):
>
> Hi All, Use below code to remove empty row from the table. DataTable name-\>DataTableName Use assign activity DataTableName=DataTableName.Rows.Cast(Of DataRow)().Where(Function(row) Not row.ItemArray.All(Function(field) field Is DBNull.Value Or field.Equals(""))).CopyToDataTable() Re-usable Component pass Parameter as datatable you will get the answer. [RemoveEmptyRows.xaml](https://global.discourse-cdn.com/uipath/original/2X/1/18c0883a487d21d4e0c1031cfa692253af6718cf.xaml) (8.5 KB) Remove rows based on particular column is empty. DataTableName.Select("Convert(column3, System.String)\< \>''"…

---

<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:** [June 13, 2020, 3:09pm UTC](https://forum.uipath.com/t/how-to-filter-data-table-as-per-the-string-array/230085/5 "2020-06-13T15:09:16Z")

</div>

Closed on June 13, 2020, 3:09pm UTC

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