Select to view content in your preferred language

Unable to combine AND and OR in filter for multiple conditions

991
4
01-16-2024 10:58 AM
mikaël
Frequent Contributor

So I wish to filter a table for various conditions in a dashboard.

The easy way to do this would be like this: condition1 AND condition2 AND (condition3 or condition4 or condition5 or conditionX). But I can't seem to be able to achieve this in dashboards. The only way i found was:

(condition1 and condition2 and condition3) OR (condition1 and condition2 and condition4) OR (condition1 and condition2 and condition5) OR (and so on for every other OR condition)

However, I know that you can better combine AND and OR in map viewer. Why not in dashbords?

Thanks!

EDIT

Just to be clear, I'm talking about filtering data in a TABLE.

mikAMD_0-1705431618748.png

 

4 Replies
RonaldHaug
Frequent Contributor

Hi MikAMD,

I think your first statement doesn't work in a mathematical and logic gate switching way.

Your second statement does. The question is can you use it to solve your problem, or is there some reason you need to state it the way you have in statement 1?

See the sidebar solution on your post: https://community.esri.com/t5/arcgis-dashboards-questions/combining-and-or-filter-conditions/m-p/135...

For better or worse, sometimes we have to do the hokey pokey the way the machine has been programmed to run.

0 Kudos
mikaël
Frequent Contributor

Hi!

Yes the second type of statement solves my problem. However I must apply this condition for multiple fields, so it's rather long to do in the dashboards interface. Plus, everytime I edit my source (arcade expression), I have to start all over. I guess I'll do it in the JSON and then push it through the API.

Considering my first statement, it is mathematical and logical. You can do it in SQL:

select fields from table where field1 < 150 and field2 = 1 and (field3 = 100 or field4 = 200);

 

In map viewer, you can change the "levels" of the filters, so you can have nested AND and/or OR.

mikAMD_0-1705502942993.png

 

0 Kudos
DatXNguyen
New Contributor

Hi, all.

The best setup is supposed to let application's users DO THEIR OWN selection, not our own preset.  I managed to do some for my property's set for they to make choice of type, choice of total SQ FT, etc....  Well, it is OK to set for a few but if the selection choices are 4, 5 , quite a big mess on the header's bar

Dashboard Selectors.png 

mikaël
Frequent Contributor

Hi,

I was about to say that ther filters I'm trying to put up are for a table, so that only necessary information is shown.

But your comment has made me rethink my dashboard and I added another selector and I think I'll be able to do what I want and as you suggested, the user will choose what he/she wants to be shown.

I still think there we should be able to better combine AND and OR statements in filters, so I guess I'll leave the question open.

But I thank you very much!

0 Kudos