How to filter the multiple column?

Hi All,

I want to filter the excel using the multiple condition using the filter data table activity.
But I am not getting that when to use the or and operators.
Can someone help at what scenarios I need to use OR AND operators.
if I want filter more than 5 columns.

Thanks in advance

@naveen.s ,
Try to use LInq it will be efficient
Regards,
Dheerandra Vishwakarma

1 Like

Hi @naveen.s

Rather than filter datatble use linq query to get required solution

Please Provide the excel with dummy data, and the requirement. So that we will help you out

1 Like

Hi @naveen.s

Use the AND operator when you want to filter rows that meet all specified conditions. All conditions must be true for a row to be included in the filtered result.

Use the OR operator when you want to filter rows that meet any of the specified conditions. A row will be included if at least one condition is true.

But it would be preferable to use the Linq query rather than using the filter data table activities.

Regards

1 Like

A sample Statement could look like:

(From d in dtData.AsEnumerable
Let v1 = d(0).ToString.Trim
Let v2 = CDbl(d("Amount").ToString().Trim)
Let v3 = d("ByPassInfo").toString.Trim
Where v1.Equals("Prio1") And (v2 < 250 Or v3.Equals("Yes"))
Select r = d).CopyToDataTable
1 Like

SampleDummyData.xlsx (14.0 KB)
The purpose of the filtering is that in an input excel if any empty/null row values are present then need to remove that before adding to the queue.
For reference I attached the excel sample file, in that excel actually only 3 records are present, but when I check the row count it has showing output as 13 rows, so instead of adding 3 rows to the queue, it getting added 13 queues item.

Assign Activity
dtFiltered =

(From d in dtData.AsEnumerable
chk = d.ItemArray.any(Function (x) isNothing(x) OrElse String.IsNullOrEmpty(x.toString.Trim))
Where not chk
Select r = d).CopyToDataTable
1 Like

Hi @naveen.s

Output
image

Copy Excel Table To Email.zip (185.4 KB)

1 Like

@naveen.s

Make sure to check the column name,It contains Spaces.Need to maintain the spaces.

1 Like

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