Filter entiry based on multiple criteria using OR

Hi everyone,

I would like to filter an entity in UiPath Apps based on multiple criteria using the idea of OR, not AND. See below an example:

Original data table:

Name Country Age
Artur Brazil 32
Maria Argentina 28
John USA 30
Artur Peru 25

I would like to filter the data table to bring values for Name = “Artur” OR Country = Argentina. So the output would be:

Name Country Age
Artur Brazil 32
Maria Argentina 28
Artur Peru 25

I tried with “=Filter(Datatable,Or([DatatableName,”=“,“Artur”],[DatatableCountry,”=“,“Argentina”]))”, but the result I get is completely different.

Do you guys have any idea?

Thanks

Hi @artur.tranzola ,
You can try filter data table


regards,
LNV

Hi @artur.tranzola

Try These methods:

Hi @artur.tranzola ,
logic is
Name = “Artur” OR Country = Argentina → keep
Name != “Artur” AND Country != Argentina → remove

→ 2 logics are same result
input
image
output
image
code with Name != “Artur” AND Country != Argentina → remove
filter data.xaml (19.4 KB)

code with Name = “Artur” OR Country = Argentina → keep
filter data.xaml (22.1 KB)

my excel file
input.xlsx (9.1 KB)
input in sheet1 and output sheet2
hope it help
regards,
LNV

@artur.tranzola ,

UiPath Apps Filter do not support any advanced operation like OR and combination. This will return only all the matching result based on filter into AND condition.

UiPath VB Apps is coming soon and that will support OR and AND both condition.

Thanks,
Arvind

1 Like

Hi @artur.tranzola

=> Read the data from excel and save it to a data table say dt_input.
=> create a variable say dt_filtered of data type System.Data.DataTable.
=> Give the below condition in assign activity:

dt_filtered= dt_input.Select("Name = 'Artur' OR Country = 'Argentina'").CopyToDataTable()

=> you can print that in message box by converting the data table to string using Output Data Table actvitiy.

Check the below images for better understanding. Instead of excel I have taken data through build data table.
image



Output:
image

Hope it helps!!

@Arvind_Kumar1 ,

Thank you. Yes, I noticed that in UiPath Apps the functionalities are limited.

Let’s wait for this upgrade then.

Regards