Valid_if expression returning List

Hi everyone,
Can anyone tell me

Why is this Valid_if formula returning an Enum List?

The column type is set as Email.
I want to accept only those emails contained in Usuarios[Email]

Actually if wrapping the expression with NOT() it works fine, but it shows the Invalid Value error when the [Email] is in the list, not the other way around which is what I need.

Thanks!

Notice how above where you enter your expression, in parentheses at the end, it displays the data types that it expects your expression to return. You can create Dropdown lists by entering an expression that returns a List into Valid_If, regardless of the specified column type .

Additionally, Appsheet tries to be smart and give you what it thinks you want. You would have gotten the same results by just typing in Usuarios[Email]. They are essentially the same in this case, and Appsheet “knows” it, so has provided you with the dropdown.

If you do not want the dropdown, I believe you can make your expression more complex in order to “de-activate” Appsheet’s intuition. Try the following:

IN( [Ingresa tu correo electronico] , SELECT(Usuarios[Email] , TRUE) )

2 Likes

Thanks @Marc_Dillon , Great explanation!
I did try that too and it didn´t work either.

It´s still showing the dropdown…

That’s surprising. This one should work:

CONTAINS( CONCATENATE( Usuarios[Email] ) , [_THIS] )

3 Likes

Awesome, this worked!

Thanks so much! I´ve been going around this for hours! :sweat_smile:

1 Like

For future reference:

This explains what @Marc was saying:

Appsheet tries to be smart and give you what it thinks you want. You would have gotten the same results by just typing in Usuarios[Email]. They are essentially the same in this case, and Appsheet “knows” it, so has provided you with the dropdown.

But it doesnt explain what to do if you do not want a dropdown, and just want to check if a value is part of a list.

3 Likes

Using CONTAINS() is really not a good alternative here, generally speaking. Better:

AND(IN(...), TRUE)

or:

OR(IN(...), FALSE)
4 Likes

Yes, go with what @Steve suggested, if it works.

Interestingly, in this case, with an Email type column, you get the internal column type validity check as well which forces the correct structure of an email address, and allows the contains expression to work at least most of the time. If we’d used the same expression on a Text-type column, you could get “valid” inputs that were just a single letter.

2 Likes