Why would the ISBLANK not validate if I use this in a Error_Message_If_Invalid for a Phone Number? It allows the field to be empty The other parts of the formula of CONTAINS and the LEN of TEXT does validate
=IF(OR(CONTAINS([_THIS], " "), LEN(TEXT([_THIS])) <> 10, ISBLANK([_THIS])), โNo Spaces, Phone Number Length should be = 10, EXAMPLE 0821234567 OR 0125556666โ, โโ )
May I ask why do you need to write a formula there? Why donโt you just type โNo spaces,โฆ666โ?
@Aleksi_Alkio because I do not want the Users to capture โinvalidโ Phone numbers, meaning I do not want spaces in the phone number and I do not want the phone number to be shorter or longer than 10 numbers. I want to at the same time while doing those validations also want to check if it is left Blank as it is Required, but I want it to display as such as they Click to the next Field and not only when they Save
@praveen your statement:
The odd thing is โ if you have a blank entry, then LEN(TEXT([_THIS])) <> 10 will also be true : does not catch the Blank either, surely if it is Blank then Blank should equate to
<>10??
I think if it is blank, the Valid_If is just not being evaluated. Iโd recommend marking it as Required and that is the simplest solution. Required inputs are also marked with a star.
Many confusing and illogical situation can be found in AppSheet. This is one of its kind.
@praveen ok noted
One workaround is if you add a virtual column which will check the status and give you a note if itโs blank. You can write the formula likeโฆ IFS(ISBLANK([Phone Number]),โPhone number canโt be blankโ). You can do the same with the Show/Text field.
@Aleksi_Alkio let me try that tonight and give feedback on the User Experience
@Aleksi_Alkio The Valid_If is not Validating
the ISBLANK([_THIS]) of the formula. This is actually my question
=IF(OR(CONTAINS([_THIS], " "), LEN(TEXT([_THIS])) <> 10, ISBLANK([_THIS])), FALSE, TRUE)
Have you triedโฆ AND(NOT(CONTAINS([_THIS]," "),LEN(TEXT([_THIS]))=10, ISNOTBLANK([_THIS])) with the Valid_If?
@Aleksi_Alkio it still does not Validate the Phone number when left Blank and let the user continue to the Next Field.
It does validate the Spaces in the Phone number and it does Validate the length
Thatโs actually true. We are not very good to handle a blank value. When the columnโs value is blank, ISBLANK or ISNOTBLANK is giving the same result as true. Thatโs why it wonโt validate.
Iโm confused by this thread. @Henry_Scott, when you say โwont Validateโ, Iโm assuming the expression tester is validating the expression fine, but you mean when running the app, the Valid_If condition with ISBLANK([_THIS]) succeeds? or it fails? The odd thing is โ if you have a blank entry, then LEN(TEXT([_THIS])) <> 10 will also be true, so youโd never even get to the ISBLANK() part of the OR clause.
And @Aleksi_Alkio I didnโt understand your comment either :]. When a column value is blank, ISBLANK([_THIS]) will return true but ISNOTBLANK([_THIS]) will definitely return false.
@praveen If you type either ISBLANK([_THIS]) or ISNOTBLANK([_THIS]) into to Valid_If and you left the column as blank, you can save the record in both cases.
Ah got it. This is because when a field isnโt marked as Required, then it means we are willing to tolerate an unassigned (i.e. blank) value in it. Also, every new row starts out with blank values and we donโt want to go mark all of them as invalid right upfront. So we treat a blank value specially when it comes to whether or not to check the Valid_If condition. Adding @Adam_Stone_AppSheet to confirm this behavior.
@praveen @Aleksi_Alkio. I have marked the Field as Required and it catches if it is Blank on the Save, but the behaviour I explained above on the
Valid_If when you Click to the next Field
when I have the Formula above with the ISBLANK in the Valid_If does not display the
Error_Message_If_Invalid. So when Adam Stone confirms this what would the solution be? Or is it a case of not possible and catch it on the Save with the Required setting?
I want to show the same Invalid value error if:
The column is empty
OR
The value is not in a list
So I tried:
AND(
ISNOTBLANK([_THIS]),
IN([_THIS],Table[ID])
)
The list validation is working. But it does not validate if the column is blank.
I know I can use โRequireโ. And under Localize โThis entry is requiredโ I could enter the same message like I have in the ValidIf.
But I would like to handle it only with ValidIf.
Has anyone found a way?
Adding also @Steve
Thank you so much @Suvrutt_Gurjar this is answering my question.
So I will enable โRequiredโ.
Correct. If Required? is OFF and the column is blank, Valid If is not evaluated at all.
Steve, I become very sad as I waste a lot of time to use ISBLANK() in the Valid If Expression without any success. Because from normal logic it suppose to work as in some situation I may need to use this logic and it is not available when I search to see the function of the expression. In standard expectation any code word should be executed in any of the expression section. If it is not, it should be documented at first. Because it is not giving any error and it doesnโt executed. It should be mentioned in a place so that user get it when he search the basic functionalities of the expression. So far it is not there.
Sometimes thinking to leave it as in many of the cases AppSheet doesnโt follow the standard logic, SO FAR I THINK.
Thanks Steve as at least after long search I have been confirmed that it doesnโt work here. Just share my emotion.
Thanks again for your support.
I went through the same process and the same frustration as you, my friend.
User | Count |
---|---|
16 | |
13 | |
8 | |
7 | |
4 |