# FilterData Table conditions

**URL:** <https://forum.uipath.com/t/filterdata-table-conditions/751009>\
**Category:** Studio\
**Tags:** output-panel, question, studio, system, activities\
**Created:** [July 2, 2024, 12:42pm UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009 "2024-07-02T12:42:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![dutta.marina](https://avatars.discourse-cdn.com/v4/letter/d/aca169/32.png) [@dutta.marina](https://forum.uipath.com/u/dutta.marina)\
**Post date:** [July 2, 2024, 12:42pm UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/1 "2024-07-02T12:42:09Z")

</div>

Hello ,

I am trying to use filter data table wizard where one of the condition is the Amount column should be always greater than $10 or in other words it should not pick up any amount which is less than 10 dollar. When I am trying to put this filter its not working as expected

 ![image](https://global.discourse-cdn.com/uipath/original/4X/1/b/b/1bbe999a5fca0ca5e3a4b2897bc68a2b52fa7ed6.png)  
 ![image](https://global.discourse-cdn.com/uipath/original/4X/7/4/4/7442e07c4a25aff51657325585c019dad92a37d7.jpeg)

---

<div class="post-metadata">

**Author:** ![pravallikapaluri](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pravallikapaluri/32/484755_2.png) [@pravallikapaluri](https://forum.uipath.com/u/pravallikapaluri)\
**Post date:** [July 2, 2024, 12:47pm UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/2 "2024-07-02T12:47:35Z")

</div>

@dutta.marina  
Instead of using filter datatable use linq query to get appropriate output

---

<div class="post-metadata">

**Author:** ![rlgandu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rlgandu/32/488436_2.png) [@rlgandu](https://forum.uipath.com/u/rlgandu)\
**Post date:** [July 2, 2024, 12:51pm UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/3 "2024-07-02T12:51:14Z")

</div>

@dutta.marina

Send the sample excel so that it will be easy to provide you the FilterDatatable expression

---

<div class="post-metadata">

**Author:** ![pravallikapaluri](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pravallikapaluri/32/484755_2.png) [@pravallikapaluri](https://forum.uipath.com/u/pravallikapaluri)\
**Post date:** [July 2, 2024, 12:52pm UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/4 "2024-07-02T12:52:34Z")

</div>

Hi @dutta.marina

After read range.  
Use an assign activity  
And write range

```auto
filteredDataTable = dt.AsEnumerable().
    Where(Function(row) row.Field(Of Boolean)("Overall Status") = True AndAlso
                      row.Field(Of String)("Opportunity ID") <> "Oppty" AndAlso
                      row.Field(Of String)("Stage Name") = "Signed" AndAlso
                      row.Field(Of String)("RPA Close Eligible") = "True" AndAlso
                      row.Field(Of String)("Amount") > "$10.00").
    CopyToDataTable()

```

---

<div class="post-metadata">

**Author:** ![ashokkarale](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ashokkarale/32/474400_2.png) [@ashokkarale](https://forum.uipath.com/u/ashokkarale)\
**Post date:** [July 2, 2024, 12:53pm UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/5 "2024-07-02T12:53:05Z")

</div>

@dutta.marina,

As per screenshot here is how you can use LINQ for filtering this data.

```auto
io_dt_TransactionData.AsEnumerable().Where(Function(row) _
    row.Field(Of Boolean)("Overall Status") = True AndAlso _
    Not String.IsNullOrEmpty(row.Field(Of String)("Opportunity ID (Oppty)")) AndAlso _
    row.Field(Of String)("Stage Name") = "Signed" AndAlso _
    row.Field(Of Boolean)("RPA Close Eligible") = True AndAlso _
    row.Field(Of Decimal)("Amount") > 10.0).CopyToDataTable()

```

Thanks,  
Ashok 🙂

---

<div class="post-metadata">

**Author:** ![mkankatala](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/mkankatala/32/484097_2.png) [@mkankatala](https://forum.uipath.com/u/mkankatala)\
**Post date:** [July 2, 2024, 12:53pm UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/6 "2024-07-02T12:53:38Z")

</div>

Hi @dutta.marina

You can try the below linq expression,

```auto
- Assign -> dt_output = dt_Input.AsEnumerable().Where(Function(X) CDec(X("Amount").ToString().Split("$"c).Last()) > 10).CopyToDataTable()

```

Hope it helps!!

---

<div class="post-metadata">

**Author:** ![Anil\_G](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anil_g/32/524291_2.png) [@Anil\_G](https://forum.uipath.com/u/Anil_G)\
**Post date:** [July 2, 2024, 1:12pm UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/7 "2024-07-02T13:12:22Z")

</div>

@dutta.marina

First of all check the values in the locals pane if it is coming as integer or a dollar value…if dollar value then you cannot use filter datatable you need to go with linq…if integer then dont with dollar sign and inverted comma directly give 10 in filter datatable

Cheers

---

<div class="post-metadata">

**Author:** ![dutta.marina](https://avatars.discourse-cdn.com/v4/letter/d/aca169/32.png) [@dutta.marina](https://forum.uipath.com/u/dutta.marina)\
**Post date:** [July 2, 2024, 1:18pm UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/8 "2024-07-02T13:18:40Z")

</div>

@ashokkarale

getting the cast error  
 ![image](https://global.discourse-cdn.com/uipath/original/4X/5/6/1/5612b76f8de316283d2aae202995f6aaf1576ec0.png)

io\_dt\_TransactionData.AsEnumerable().Where(Function(row) \_  
row.Field(Of Boolean)(“Overall Status”) = True AndAlso \_  
Not String.IsNullOrEmpty(row.Field(Of String)(“Opportunity ID (Oppty)”)) AndAlso \_  
row.Field(Of String)(“Stage Name”) = “Signed” AndAlso \_  
row.Field(Of Boolean)(“RPA Close Eligible”) = True AndAlso \_  
row.Field(Of Decimal)(“Amount”) \> 10.0).CopyToDataTable()

---

<div class="post-metadata">

**Author:** ![ashokkarale](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ashokkarale/32/474400_2.png) [@ashokkarale](https://forum.uipath.com/u/ashokkarale)\
**Post date:** [July 2, 2024, 1:22pm UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/9 "2024-07-02T13:22:53Z")

</div>

@dutta.marina,

Check the datatype of your datatable columns and change type of fields accordingly.

Thanks,  
Ashok 🙂

---

<div class="post-metadata">

**Author:** ![rlgandu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/rlgandu/32/488436_2.png) [@rlgandu](https://forum.uipath.com/u/rlgandu)\
**Post date:** [July 2, 2024, 1:33pm UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/10 "2024-07-02T13:33:19Z")

</div>

@dutta.marina

```auto
dt.AsEnumerable().
    Where(Function(row) row.Field(Of String)("Overall Status") = "True" AndAlso
                      row.Field(Of String)("Opportunity ID") <> "" AndAlso
                      row.Field(Of String)("Stage Name") = "Signed" AndAlso
                      row.Field(Of String)("RPA Close Eligible") = "True" AndAlso
                      CDec(row.Field(Of String)("Amount").Split("$"c).Last()) > 10).
    CopyToDataTable()

```

---

<div class="post-metadata">

**Author:** ![dutta.marina](https://avatars.discourse-cdn.com/v4/letter/d/aca169/32.png) [@dutta.marina](https://forum.uipath.com/u/dutta.marina)\
**Post date:** [July 2, 2024, 1:39pm UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/11 "2024-07-02T13:39:48Z")

</div>

@Anil_G

I have tried different methods but getting cast value error for LINQ

---

<div class="post-metadata">

**Author:** ![pravallikapaluri](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pravallikapaluri/32/484755_2.png) [@pravallikapaluri](https://forum.uipath.com/u/pravallikapaluri)\
**Post date:** [July 2, 2024, 1:53pm UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/12 "2024-07-02T13:53:11Z")

</div>

@dutta.marina

Can you share the input file  
So that we will see the datatype formats the columns and give an appropriate sol

---

<div class="post-metadata">

**Author:** ![dutta.marina](https://avatars.discourse-cdn.com/v4/letter/d/aca169/32.png) [@dutta.marina](https://forum.uipath.com/u/dutta.marina)\
**Post date:** [July 2, 2024, 2:07pm UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/13 "2024-07-02T14:07:34Z")

</div>

@pravallikapaluri

If I click the Amount cell . I checked by clicking Information Tab in excel and Type itreturned 2 which means its not a number string

 ![image](https://global.discourse-cdn.com/uipath/original/4X/c/8/b/c8bfe9b4e10471016e090af5b3c8f1c465f17eae.jpeg)

---

<div class="post-metadata">

**Author:** ![pravallikapaluri](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pravallikapaluri/32/484755_2.png) [@pravallikapaluri](https://forum.uipath.com/u/pravallikapaluri)\
**Post date:** [July 2, 2024, 2:28pm UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/14 "2024-07-02T14:28:02Z")

</div>

@dutta.marina  
Okay.If all the columns are of string datatype  
Below query will work

```auto
filteredDataTable = dt.AsEnumerable().
    Where(Function(row) row.Field(Of String)("Overall Status") = "True" AndAlso
                      row.Field(Of String)("Opportunity ID") <> "Oppty" AndAlso
                      row.Field(Of String)("Stage Name") = "Signed" AndAlso
                      row.Field(Of String)("RPA Close Eligible") = "True" AndAlso
                      row.Field(Of String)("Amount") > "$10.00")
    CopyToDataTable()

```

---

<div class="post-metadata">

**Author:** ![dutta.marina](https://avatars.discourse-cdn.com/v4/letter/d/aca169/32.png) [@dutta.marina](https://forum.uipath.com/u/dutta.marina)\
**Post date:** [July 2, 2024, 2:29pm UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/15 "2024-07-02T14:29:08Z")

</div>

@pravallikapaluri

Yea I made similar changes the running the bot .will update

---

<div class="post-metadata">

**Author:** ![pravallikapaluri](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/pravallikapaluri/32/484755_2.png) [@pravallikapaluri](https://forum.uipath.com/u/pravallikapaluri)\
**Post date:** [July 2, 2024, 3:07pm UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/16 "2024-07-02T15:07:09Z")

</div>

@dutta.marina

Okay Sure

---

<div class="post-metadata">

**Author:** ![dutta.marina](https://avatars.discourse-cdn.com/v4/letter/d/aca169/32.png) [@dutta.marina](https://forum.uipath.com/u/dutta.marina)\
**Post date:** [July 2, 2024, 4:15pm UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/17 "2024-07-02T16:15:34Z")

</div>

@pravallikapaluri

I am getting as The source contains no DataRows: Is it because there is no data based on filter conditions

 ![image](https://global.discourse-cdn.com/uipath/original/4X/a/9/9/a992fdc071b6c697f2feb8e04e3d559010db1dc3.png)

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

---

<div class="post-metadata">

**Author:** ![Anil\_G](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anil_g/32/524291_2.png) [@Anil\_G](https://forum.uipath.com/u/Anil_G)\
**Post date:** [July 3, 2024, 4:46am UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/18 "2024-07-03T04:46:01Z")

</div>

@dutta.marina

Using `> "$10.00"` will never work…as said first check the values in locals panel or attach the file here we can check

When you use inverted comma it is a string and you also have $ which again cast cannot convert to integer

Cheers

---

<div class="post-metadata">

**Author:** ![dutta.marina](https://avatars.discourse-cdn.com/v4/letter/d/aca169/32.png) [@dutta.marina](https://forum.uipath.com/u/dutta.marina)\
**Post date:** [July 3, 2024, 11:56am UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/19 "2024-07-03T11:56:10Z")

</div>

@Anil_G

Attached the excel file . The values are string. The below query is not working for me

io\_dt\_TransactionData.AsEnumerable().  
Where(Function(row) row.Field(Of String)(“Overall Status”) = “True” AndAlso  
row.Field(Of String)(“Opportunity ID (Oppty)”) \<\> “” AndAlso  
row.Field(Of String)(“Stage Name”) = “Signed” AndAlso  
row.Field(Of String)(“RPA Close Eligible”) = “True” AndAlso  
row.Field(Of String)(“Amount”) \> “$10.00”).CopyToDataTable

[Opportunity Quote.xlsx](https://forum.uipath.com/uploads/short-url/ht0BZLB0G2Mj8ckM0BPQoDvobM7.xlsx) (628.5 KB)

---

<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 6, 2024, 11:57am UTC](https://forum.uipath.com/t/filterdata-table-conditions/751009/20 "2024-07-06T11:57:03Z")

</div>

Closed on July 6, 2024, 11:57am UTC

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