How to use filter datatable as case insensitive?

For example, I am having a column “status”, in that particular there are so many possibilities of name may come such as TATA or tata or Tata. In that column how I can change the entire column to lower or upper in order to use the filter datable. Please let me know how to resolve this.

@kalees_waran

Use below expression in Invoke Code activity.

InputDT.AsEnumerable().ToList().ForEach(Sub(row) row(“status”) = row("status").ToString.ToUpper)

Note: Create one argument for Invoke Code activity and mention properties as below.

Name - InputDT
Direction - In
Type - DataTable
Value - InputDT

Hi @kalees_waran

Try with below steps

Read Range the excel

Iterate through For each row

Assign Currentrow(“status”)= Currentrow("Status).toString.ToLower Or Upper

Then Out side the loop Use Filter datatable with filter Value.

Regards

1 Like

Hi,

FYI, another solution:

We can filter datatable with case insensitive using LINQ and String.Compare method, as the following.

 dt = dt.AsEnumerable.Where(Function(r) String.Compare(r("Status").ToString,"TATA",true)=0).CopyToDataTable

Regards,


I am receiving the below error sir and attached my xaml file for your reference.TestinguppertoLower.xaml (5.6 KB)

Hi @kalees_waran

I have created a sample work flow based on your use case !

Sample Input:image

Expected Output:image

Refer to the xaml below !

test_1.xaml (6.7 KB)

Regards

Thanks@pravin_calvin. It works for me.

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