Filter Enum options

Hi,
is it possibile to filter enum options?
I have 4 choices, but only three of them always possibile, the forth only in a specific condition.
Can i hide this forth option?

column 1
Enum (A,B)
column 2
Enum (A,B,C,D)โ€ฆ

If column 1 is A, column 2 show A,B,C,Dโ€ฆ
If column 1 is B, column 2 show A,B,C.

thanks

Solved Solved
0 9 3,811
1 ACCEPTED SOLUTION

Because the current value is also included in table1[spot], so the current value is being removed from the list of allowed values.

Try this:

(
  coordinates[spots list]
  -
  select(table1[spot], ([_thisrow].[_rownumber] <> [_rownumber]))
)

which means โ€œthe entire listโ€-โ€œthe list of values already taken by other rowsโ€.

View solution in original post

9 REPLIES 9

Yes. This is possible. You need to make an expression like

if([Column 1]=A,{A, B, C, D},{A, B, C})

. . . and put that in the โ€œValid ifโ€ spot of your Enum column.

Iโ€™m not clear about the relationship between your columns one and two so the expression to create the appropriate list based on what is in column 1 may need to be tweaked but the idea is to make an expression that produces a โ€œlistโ€ based on the conditions you described and then to put that expression in the โ€œValid ifโ€ spot.

Hereโ€™s some discussion about how to use this feature:

This works for me, thanks.

I also have another scenario:
column [spot] (enum)
It is a very long list of spot like spreadsheet cell:
A1
A2
A3
B1
B2
B3
.
.
.
AA1
AA2
AA3
.
.

I have a static table where i just update things, and every day i change these Spots.
When i try to update one spot, i would like to filter the spots already occupied.
So, if A2 is already taken by another row, my dropdown would be A1,A3,B1โ€ฆ(not A2) cause i canโ€™t assing 2 items at the same spot.
@Steve @Kirk_Masden
thanks

Iโ€™m not sure that I understand your situation fully but can respond to this part:

if A2 is already taken by another row, my dropdown would be A1,A3,B1โ€ฆ(not A2)

If you have two lists, you can subtract on list from the other. So, if A2 were part of a list (or the only item in a list), subtracting that list from the list that contains A1, A2, A3, B1โ€ฆ should work for you.

This page should help:

I have one list
[Spot] is an ENUM dropdown
valid if: Coordinates[Spots list]
I would subtract from my dropdown all the spots already choosen in other rows of my table.
Itโ€™s the โ€œpreventing duplicateโ€ thing but i donโ€™t know how to write my own formula

EDIT: seems ok with a valid if coordinates[spots list]-table1[spot] that would means, โ€œthe entire listโ€-โ€œthe list of values already takenโ€.
I canโ€™t understand why whathever i choose using quick edit give me a "Unable to save, [spot] is invalid.
The same exact choice by ordinary edit works perfetcly.

Because the current value is also included in table1[spot], so the current value is being removed from the list of allowed values.

Try this:

(
  coordinates[spots list]
  -
  select(table1[spot], ([_thisrow].[_rownumber] <> [_rownumber]))
)

which means โ€œthe entire listโ€-โ€œthe list of values already taken by other rowsโ€.

It works, great.
Thanks to all!!

if([USO:] = โ€œGRANOโ€, {โ€œZ8โ€}, {โ€œRAYOโ€})

The expression is valid but its result type โ€˜Listโ€™ is not one of the expected types: Enum

It seems like it is not working with Enum.

Is this expression in the โ€œvalid ifโ€ spot?

The curly braces ({ and }) are used to denote a list. By enclosing a value in curly braces, youโ€™ve created a list containing that value:

  • {โ€œZ8โ€}: a list with one item, the Text value Z8.
  • {โ€œRAYOโ€}: a list with one item, the Text value RAYO.

The error you shared indicates a single value is expected rather than a list. To produce a single value rather than a list, remove the curly braces from your expression:

if([USO:] = โ€œGRANOโ€, โ€œZ8โ€, โ€œRAYOโ€)
Top Labels in this Space