Concatenate values for dataset filtering

HI
Is it possible to concatenate several values of data sets to create one filter?
for example, I have a table that is built with a repeater. one of the columns is “Severity” with the values: High, Med, Low.
I want to create a combined filter so the page will present the High and Med values only. is it possible?
This syntax is not working: [[Item.severity==‘High’]] AND [[Item.severity==‘Med’]]

Thanks

Hi!

A filter is a single expression, so you will want only a single set of double brackets. Also, for AND you’ll need to use && and for OR you will need to use ||.

A quick note on filters: A filter is true/false test that is applied to every available row in the repeater. If a given row passes the test, it stays; if not, it goes.

A quick note on boolean (true/false) logic when using AND and OR. When using AND, all expressions must be true. When using OR, only one expression needs to be true. So…

True AND True equals True
True AND False equals False
False AND False equals False

True OR True equals True
True OR False equals True
False OR False equals False

AND-ing two expressions together means that both expressions must be true for the filter as a whole to be true for the given row. In your case, since no single row can be both ‘High’ and ‘Med’, AND won’t work here: it will return no rows.

What you want here is OR, which may not be intuitive, but it makes more sense if you look at it in the context of a single row. (Pretend you are the filter and apply yourself to each row. Sounds silly, but that’s what I do.)

So the filter you want is:

[[Item.severity == 'High' || Item.severity == 'Med']]

So…

On a High row, the expression above results in True OR False, which equals True
On a Med row, the expression is False OR True, which equals True
On a Low row, the expression is False OR False, which equals False

If you are trying to set up facet filters (e.g., filtering the repeater using checkboxes and the like), this post will get you going.

1 Like

Well, josephxbrick
YOU ARE THE MAN !!!

It works perfectly

Thanks
Barak

1 Like