Filter a menu table with IN() error

Hi,

I’m trying to filter a menu view, the answer seem easy to me but the expression it’s not working… am I missing out something ?

I’m using a EnumList column of type Text in the User table to select a list of menu views the user is allowed to see. Then i’m trying an expression in the security filter of the Menu Table :

IN([Name]; User_Slice[View acces])

The result is always False. I don’t understand why.

Any thoughts ?

P.S. 1 User_Slice[View acces] alone give me the right list when I test it.

P.S. 2 The column View acces is type Text

As you mentioned, [View acces] is an enumlist. So the expression User_Slice[View acces] creates a list of lists. You can flatten such a list of lists into a normal list of single elements by using SPLIT(), something like below

IN([Name], SPLIT(User_Slice[View acces],“,”))

SPLIT() - AppSheet Help

2 Likes

Thanks for this tip, I didn’t know that.

This expression is working fine on the Test tab but when I use it as a security filter a don’t see any value (like if it was all FALSE).

Test before saving Test after saving, when the security filter is ON.

![VictorB_0-1662480173644.png
482x797](upload://wBuzr24NpfMLuwq27x3xolWO6bF.png)

Oh okay. Sorry that I concentrated only on syntactical part of the expression.

It is not clear how you are differentiating between different users by using the said expression. Could you elaborate? I believe somewhere the USEREMAIL() needs to come into picture.

2 Likes

Yes, in the present case i’m using it into the User_Slice, witch is a slice of the User table using this expression : USEREMAIL() = [Email]

I’ve just changed the punctuation and it’s working fine (add space before and after the split coma) :

IN([Name]; SPLIT(User_Slice[View acces]; " , "))

1 Like

Good catch. SPLIT() has peculiar requirements on the spaces in the comma. @Steve has nicely covered those different use cases in the help article.

Yesterday I inadvertently missed those spaces. Thank you for the update.

1 Like