# Filter datatable with non sensitive value

**URL:** <https://forum.uipath.com/t/filter-datatable-with-non-sensitive-value/609641>\
**Category:** Activities\
**Tags:** datatable, question, system, activities\
**Created:** [September 27, 2023, 7:31am UTC](https://forum.uipath.com/t/filter-datatable-with-non-sensitive-value/609641 "2023-09-27T07:31:06Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![QTH](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/qth/32/278220_2.png) [@QTH](https://forum.uipath.com/u/QTH)\
**Post date:** [September 27, 2023, 7:31am UTC](https://forum.uipath.com/t/filter-datatable-with-non-sensitive-value/609641/1 "2023-09-27T07:31:06Z")

</div>

Is it possible to use the filter datatable function but make it so that it isn’t case sensitive. For example if the input is ‘apple’, it should still keep ‘APPLE’ or ‘Apple’ or any other variations within the datatable.

If it could be done directly using Filter Data Table activity from UiPath.System.Activities it would be for the best.

I was suggested by chatGPT to use

```auto
Assign activity:
  To: myDataTable
  Value: myDataTable.Select("Column1.Equals('apple', StringComparison.OrdinalIgnoreCase)", "Column1", DataViewRowState.CurrentRows).CopyToDataTable()

```

When I use the following

```auto
Value: DataTable.Select("(Contact Name).Contains('tan', StringComparison.OrdinalIgnoreCase)", "Contact Name", DataViewRowState.CurrentRows).CopyToDataTable()

```

It return the following error

```auto
Source: Assign
Message: Syntax error: Missing operand after 'Name' operator.

```

Appreciate any and all advice.

Thank you.

---

<div class="post-metadata">

**Author:** ![tazunnisa.badavide](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/tazunnisa.badavide/32/419354_2.png) [@tazunnisa.badavide](https://forum.uipath.com/u/tazunnisa.badavide)\
**Post date:** [September 27, 2023, 7:33am UTC](https://forum.uipath.com/t/filter-datatable-with-non-sensitive-value/609641/2 "2023-09-27T07:33:50Z")

</div>

[Filter data table without Case sensitive values - Help - UiPath Community Forum](https://forum.uipath.com/t/filter-data-table-without-case-sensitive-values/168365)

---

<div class="post-metadata">

**Author:** ![Palaniyappan](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/palaniyappan/32/524095_2.png) [@Palaniyappan](https://forum.uipath.com/u/Palaniyappan)\
**Post date:** [September 27, 2023, 7:39am UTC](https://forum.uipath.com/t/filter-datatable-with-non-sensitive-value/609641/3 "2023-09-27T07:39:43Z")

</div>

Try with this in a assign activity

```auto
filteredData = yourDataTable.AsEnumerable().Where(Function(row) NOT row("ColumnName").Equals("apple", StringComparison.OrdinalIgnoreCase)).CopyToDataTable()

```

This query will remove rows with the exact lowercase “apple” but keep rows with variations in case like “Apple” or “APPLE.”

hope this helps

Cheers @QTH

---

<div class="post-metadata">

**Author:** ![Kartheek\_Battu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/kartheek_battu/32/307447_2.png) [@Kartheek\_Battu](https://forum.uipath.com/u/Kartheek_Battu)\
**Post date:** [September 27, 2023, 7:41am UTC](https://forum.uipath.com/t/filter-datatable-with-non-sensitive-value/609641/4 "2023-09-27T07:41:32Z")

</div>

Hello @QTH

Assign activity:  
To: myDataTable  
Value: myDataTable.AsEnumerable().Where(Function(row) row.Field(Of String)(“Contact Name”).IndexOf(“tan”, StringComparison.OrdinalIgnoreCase) \>= 0).CopyToDataTable()

Thanks & Cheers!!!

---

<div class="post-metadata">

**Author:** ![QTH](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/qth/32/278220_2.png) [@QTH](https://forum.uipath.com/u/QTH)\
**Post date:** [September 27, 2023, 8:04am UTC](https://forum.uipath.com/t/filter-datatable-with-non-sensitive-value/609641/5 "2023-09-27T08:04:14Z")

</div>

I would need it to keep all variations of the input, so in this case ‘apple’ as well.

---

<div class="post-metadata">

**Author:** ![QTH](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/qth/32/278220_2.png) [@QTH](https://forum.uipath.com/u/QTH)\
**Post date:** [September 27, 2023, 8:07am UTC](https://forum.uipath.com/t/filter-datatable-with-non-sensitive-value/609641/6 "2023-09-27T08:07:52Z")

</div>

Encountered the following error

```auto
22.10.5+Branch.support-v22.10.Sha.79bc7c61a909d990afd07620b3005b3a35eb1f1b

Source: Assign

Message: Object reference not set to an instance of an object.

Exception Type: System.NullReferenceException

System.NullReferenceException: Object reference not set to an instance of an object. at lambda_method(Closure , DataRow )
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Data.DataTableExtensions.LoadTableFromEnumerable[T](IEnumerable`1 source, DataTable table, Nullable`1 options, FillErrorEventHandler errorHandler)
   at System.Data.DataTableExtensions.CopyToDataTable[T](IEnumerable`1 source)
   at lambda_method(Closure , ActivityContext )
   at Microsoft.VisualBasic.Activities.VisualBasicValue`1.Execute(CodeActivityContext context)
   at System.Activities.CodeActivity`1.InternalExecuteInResolutionContext(CodeActivityContext context)
   at System.Activities.Runtime.ActivityExecutor.ExecuteInResolutionContext[T](ActivityInstance parentInstance, Activity`1 expressionActivity)
   at System.Activities.InArgument`1.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance activityInstance, ActivityExecutor executor)
   at System.Activities.RuntimeArgument.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance targetActivityInstance, ActivityExecutor executor, Object argumentValueOverride, Location resultLocation, Boolean skipFastPath)
   at System.Activities.ActivityInstance.InternalTryPopulateArgumentValueOrScheduleExpression(RuntimeArgument argument, Int32 nextArgumentIndex, ActivityExecutor executor, IDictionary`2 argumentValueOverrides, Location resultLocation, Boolean isDynamicUpdate)
   at System.Activities.ActivityInstance.ResolveArguments(ActivityExecutor executor, IDictionary`2 argumentValueOverrides, Location resultLocation, Int32 startIndex)
   at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

```

---

<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:** [September 27, 2023, 8:16am UTC](https://forum.uipath.com/t/filter-datatable-with-non-sensitive-value/609641/7 "2023-09-27T08:16:27Z")

</div>

@QTH

if using linq queries you can cast both sides and then compare

`dt.AsEnumerable.Where(function(x) x("ColumnName").ToString.ToLower.Trim.Equals("apple")).CopyToDataTable`

cheers

---

<div class="post-metadata">

**Author:** ![Palaniyappan](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/palaniyappan/32/524095_2.png) [@Palaniyappan](https://forum.uipath.com/u/Palaniyappan)\
**Post date:** [September 27, 2023, 8:45am UTC](https://forum.uipath.com/t/filter-datatable-with-non-sensitive-value/609641/8 "2023-09-27T08:45:23Z")

</div>

> [@QTH](#):
>
> would need it to keep all variations of the input, so in this case ‘apple’ as well.

Can u give an example on this @QTH

---

<div class="post-metadata">

**Author:** ![QTH](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/qth/32/278220_2.png) [@QTH](https://forum.uipath.com/u/QTH)\
**Post date:** [September 27, 2023, 9:22am UTC](https://forum.uipath.com/t/filter-datatable-with-non-sensitive-value/609641/9 "2023-09-27T09:22:15Z")

</div>

As in your provided solution mentions that it will remove ‘apple’ but retain all other variations. I’m just sharing I need all variations include the original input which is ‘apple’ in that example.  
So, ‘apple’, ‘Apple’, ‘APPLE’ all being retained in the datatable was my desired outcome.

---

<div class="post-metadata">

**Author:** ![Kartheek\_Battu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/kartheek_battu/32/307447_2.png) [@Kartheek\_Battu](https://forum.uipath.com/u/Kartheek_Battu)\
**Post date:** [September 27, 2023, 9:47am UTC](https://forum.uipath.com/t/filter-datatable-with-non-sensitive-value/609641/10 "2023-09-27T09:47:06Z")

</div>

@QTH

1. Check that your variables are properly initialized.
2. Verify data availability and extraction.
3. Validate selectors for web elements.
4. Implement error handling for empty results.
5. Use logging and debugging to pinpoint the issue.
6. Examine the exception details for specific clues.

---

<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 30, 2023, 9:47am UTC](https://forum.uipath.com/t/filter-datatable-with-non-sensitive-value/609641/11 "2023-09-30T09:47:28Z")

</div>

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