How to filter multi condtion with multi column

Hi everyone
IN excel I have the multi-column,
I have to check that column
{CP1, CP2, CP3…CP11} does not contain
any of these values (“CO-45"or"CO-16"or"CO-18"or"PR-1"or"PR-2"or"PR-3”)
if the column contains these values I have to remove that column.

Hi!

Use filter DataTable.

please refer:

https://docs.uipath.com/activities/docs/filter-data-table

Regards,
NaNi

I have to check multiple conditions in the same column

CO-45
CO-16
CO-18
PR-1
PR-2
PR-3

Yes, you can do that by using the filter DataTable,

please find the attachment below for your reference

filter

Regards,
NaNi

1 Like

Hi @ashishmani

Filter datatable

regards

so I have to use filter Datatable 11 times, for CP2, CP3…up to CP11

Hi @ashishmani

Follow the steps below!

Read the excel

assign arrayVariable={“FilterValue1”,“Filtervalue2”…}

use For each and change Type argument to string

For each item in array variable

assign NewDtVariable =readDt.select("[YourColumn name] = ‘"+item+"’").CopyToDatatable

use Path exists activity Input the path with xlsx

Like “your path/file.xlsx”

If condition use path exists output exists

then append range the NewDt

else write Range the NewDt

Regards

can you make the xaml for me, Denial Note Examples.xlsx (35.4 KB)
first I have to check cpt1…CPT 11 does not contain
CO-45
CO-16
CO-18
PR-1
PR-2
PR-3
After that I have to check cpt1 to cpt11 must have different values, if the value is same i have to skip that cpt

@ashishmani

Could you be elaborate your requirement !

From the File I am having 2 sheets which sheet i do need to refer!

Regards

from sheet1 first, I have to remove duplicates “Visior id” (column1),
so I remove it and paste it to sheet A,
after that I have to check cpt1 to CPT 11 column does not contain above values,
after that I have to check the value of cpt1 to CPT 11 must be differentExcel denial code.xaml (59.1 KB)

create a string array
arrColSet = {“CP1”,“CP2”,“CP3”…“CP11”}

create a string array
arrKeys = {“CO-45”,“CO-16” …}

use an assign activity
LHS: dtFiltered
RHS:

(From d in dtData.AsEnumerable
Let hasKey = arrColSet.Any(Function (x) arrKeys.Any(Function (k) d(x).toString.Contains(k)))
Where not hasKey
Select r=d).CopyToDataTable

arrColSet.Select(Function (x) row(x).toString.Trim).Distinct().Count = arrColSet.Length

check your spelling CopyToDataTable

done, can you tell me the next step

what are you looking for to get achieved?

now I want to check that every CPT have different values

checking row level an approach was shared with you

Maybe you can resharpen the requirement

  • check on row level?
  • what to do if all same / all distinct?

I want different values, if the same values are there I will skip that one.

check there are dicstinct on row level

filter out datarow

then combine it with the LINQ from above:

(From d in dtData.AsEnumerable
Let hasKey = arrColSet.Any(Function (x) arrKeys.Any(Function (k) d(x).toString.Contains(k)))
Where not hasKey
Let isDist = arrColSet.Select(Function (x) d(x).toString.Trim).Distinct().Count = arrColSet.Length
Where isDist
Select r=d).CopyToDataTable

in case of empty results from filtering are to expect handle defensive the CopyToDataTable

can you paste this xmal.