Filter Help setup

How can I setup a filter which returns all object with sizes L, XL & 2XL, but without the color “grey” & “red”?
Bildschirmfoto 2024-02-01 um 18.39.02

Hey @lukaas
Simply use these conditions in your filter:

Size = L
AND
Colour != Gray
AND
Colour != Red

OR

Size = XL
AND
Colour != Gray
AND
Colour != Red

OR

Size = 2XL
AND
Colour != Gray
AND
Colour != Red

For Size L:

For XL:

For XXL:

Using these conditions you can filter out easily you data.
If this solved your problem pleasse mark this as a solution.

1 Like

okay so you can implement a logic like this :

if size == L
and
if size == Xl
and
if size == 2 Xl
and
color!= grey
and
color != red

so by implementing this you will only pass the bundle which has the above size but not the color red and grey.

if this solved your problem please mark this as a solution for future reference .

if screenshot of module is required I’ll share with you just ping me .

2 Likes

Unfortunately your approach won’t work – size cannot be L AND XL for example in the same bundle and if you set the filters the way you propose no bundle will pass through ever.

The approach @sachinkadam5 proposes will work better because you can check for each size and the OR clause between each combination will allow each size to be checked as well as the colours in separate clauses.

3 Likes

@sachinkadam5 @alex.newpath Is not there a less cubersome way of setting this up?
I actually have more sizes and colors to filter. I was hoping to do something with Array and contains()?!

It doesn’t have to use arrays unless your colour and size data is inside arrays. If you have size and color set in text values, here is what could would work in the filter.

Let us set up an expression with an if() that evaluates to true if it passes the conditions, and false otherwise. Then in the filter condition I use the Boolean operator ‘equal to’ to check whether the expression is true to pass through the filter. If the if() expression evaluates to false it will fail and not pass through.

You can just adjust the if() expression to add more colours and sizes and even other conditions, being careful to ensure the boolean expression is logically correct to what you actually want to evaluate.

Here’s the expression

{{if((1.size = "L" | 1.size = "XL" | 1.size = "2XL") & (1.color != "red" & 1.color != "gray"); true; false)}}

You can copy and paste this right into the condition. Just make sure the color coding comes out ok because the operators must evaluate correctly. Don’t just type the value true but use the pink pill to enter it.

Note the use of the () to create the evaluation precedence between the and phrase. These operators are available on the gear tab of the variable/expression picker:

image

I setup a simple scenario to help you test the expression by setting 2 variables for color and size in the first module and then an increment module and put the filter between them to see if it passes/fails depending on the input values I can easily set in the first module.
blueprint (24).json (4.7 KB)

2 Likes

@alex.newpath Thanks a lot for your detailed answer, exactly what I needed. Just a little modified to use contains :slight_smile:

3 Likes

Ah so you’re storing the sizes and colours in arrays! That’s even a better way to maintain them. Well done.:+1:

2 Likes