Expression to show specific list of values by one or multiple other values from different columns

I have a table with multiple columns. Important columns for this topic are โ€œCategoryโ€ (Values = โ€œTrailsโ€, โ€œNatureโ€, โ€œCultureโ€, โ€œServiceโ€), โ€œTrailsโ€ (Values = โ€œTreadโ€, โ€œBackslopeโ€, โ€œJumpโ€, โ€œFeatureโ€), โ€œNatureโ€ (Values = โ€œLakeโ€, โ€œProtected areaโ€, โ€œWildlife reservatโ€), โ€œMeasuresโ€ (only one Value: โ€œRecordโ€), โ€œM1โ€ (Values = โ€œA1โ€, โ€œA2โ€, โ€œA3โ€), โ€œM2โ€ (Values = โ€œB1โ€, โ€œB2โ€, โ€œB3โ€) and โ€œM3โ€ (Values = โ€œD1โ€, โ€œD2โ€, โ€œD3โ€). All these columns are EnumLists.
If these columns should be visible is defined by expression. However, there are multiple difficulties which do not work by now.

Measures: Show = OR([Category] = โ€œTrailsโ€, [Category] = โ€œNatureโ€)
โ†’ the Button Measures should only be visible if either Trails or Nature is selected

M1: Show = AND(IN([Trails], LIST(โ€œTreadโ€, โ€œOtherโ€, โ€œOtherโ€)), [Measures] = โ€œRecordโ€)
โ†’ M1 should only be visible, if Tread is selected (or Others)

M2: Show = AND(IN([Trails], LIST(โ€œJumpโ€, โ€œFeatureโ€, โ€œOtherโ€)), [Measures] = โ€œRecordโ€)
โ†’ M2 should only be visible, if โ€œJumpโ€ or Feature (or Others) is selected.
โ†’ If both Tread and Jump is selected, M1 and M2 should be visible.

M3: Show = AND(OR(IN([Trails], LIST(โ€œBackslopeโ€, โ€œOtherโ€, โ€œOtherโ€)), IN([โ€œTrailsโ€], LIST(โ€œProtected areaโ€, โ€œOtherโ€, โ€œOtherโ€)), [Measures] = โ€œRecordโ€)
โ†’ M3 should only be visible, if Backslope (or Others) or Protected area (or Others) is selected.

Rules (how they should work and how they do by now):
So, it is important, that it is shown as soon as at least one defined value is selected. If two are selected which refer to two different Mโ€™s, both Mโ€™s should be shown. By now itโ€™s only shown if the two values are in the definition of the same M. Otherwise no M is shown.
At the moment it is also like that, that M3 (which should be visible either by Trails or Nature is always shown (even if no defined value is selected).

How can I change my expressions that above rules do work correctly?

Solved Solved
0 9 200
1 ACCEPTED SOLUTION

Change AND() for OR() where that happens.


This should be working


Post the whole thing to help you with the expression. In general, it seems OK. M1 should be shown if the value inside [Trails] is one of the values from the LIST() you made and the value inside [Measures] is โ€œRecordโ€ (btw, why you have this column if only one value is available? Itโ€™s defined by an expression?)


This also seems ok.


Ok also.


This all boils down to this I think:

So if [Trails] is a list, you are comparing a list with another. IN() was not meant for this kind of things.
See:


Try replacing your IN() with this: (M1 for example)

ISNOTBLANK(
  INTERSECT(
    [Trails],
    LIST("Tread" , "Other", "Other")
  )
)

View solution in original post

9 REPLIES 9

I donโ€™t get why you are using AND() to wrap most of your stuff. IN() doesnโ€™t need that.
Also, always write textual values "Like this" instead of Like this.
Try that.

Very much true.

Sorry, yes, I do wrap text in โ€œtextโ€ normally. I was confused because of the * for bold text etc. And I also forgot to add [Measures] = โ€œRecordโ€) which is the reason why I use AND()

So, post here the actual config for us to see and help

I changed it in the first post!

Change AND() for OR() where that happens.


This should be working


Post the whole thing to help you with the expression. In general, it seems OK. M1 should be shown if the value inside [Trails] is one of the values from the LIST() you made and the value inside [Measures] is โ€œRecordโ€ (btw, why you have this column if only one value is available? Itโ€™s defined by an expression?)


This also seems ok.


Ok also.


This all boils down to this I think:

So if [Trails] is a list, you are comparing a list with another. IN() was not meant for this kind of things.
See:


Try replacing your IN() with this: (M1 for example)

ISNOTBLANK(
  INTERSECT(
    [Trails],
    LIST("Tread" , "Other", "Other")
  )
)

Hi @Phil!
Any comments about this?
Is IN() V2 in the works?

Thanks a lot, youโ€™re great! It was really only because IN() canโ€™t compare lists with another.
Using following code instead of IN() does what I want and solved all my problems.

ISNOTBLANK(
  INTERSECT(
    [Trails],
    LIST("Tread" , "Other", "Other")
  )
)

THANKS!!!

FYI: I use the column Measures because Iโ€™m not always using the Measures and it looks better if you have to press the button Measures in case you want to add some measures

Nice!
3X_0_b_0bffdf26e9f480f1ed89f126d4480046ae4b7171.gif