Skip to main content

Hi everyone.

I am working to create a validation rule to require an answer of "N/A" on a dropdown list when the Signed Out dropdown is not "Yes".

The rule I wrte works, however it also trys to force an answer of "N/A" when the Signed Out choice is equal to "Yes".

 

The rule is: {ItemProperty: Signed_x0020_Out}!="Yes"&&{Self}!="N/A"

 

The following variations do not work at all:

not({ItemProperty: Signed_x0020_Out},"Yes")&&{Self}!="N/A"

and

and(not({ItemProperty: Signed_x0020_Out},"Yes"),{Self}!="N/A")

and

and(not({ItemProperty: Signed_x0020_Out},"Yes"),not({Self},"N/A"))

From what you described (must select "N/A" if Signed Out), then the logic you want is:

{ItemProperty: Signed_x0020_Out} == "Yes" && {Self} != "N/A"

That is, you should be checking for "Signed Out" equals "Yes" instead of not equals.


you say you have dropdown conrols - but are they dropdowns for choice control or lookup control?

the two needs to be treated differently.

 

you reference 'Signed out' item property - ie. you take the the value that's already stored in the list item.

so for NEW form form it's always empty (nothing stored yet in the list) for EDIT form it always evaluate to the value valid at the moment you opened the form and do not change throughout the form session.

 

if you want to evaluate/validate current form control value you have to reference 'Named control' variable in formula.


Signed Out is a dropdown for a choice control and has 4 choices.
I tried to change Signed Out to use Named control and that has the same effect of making any choice other than N/A invalid regardless of what Signed Out choice is.

No, Signed Out has 4 Choices, I want Self to be N/A if Signed out is anything but Yes.


ok.

then formula

Signed_Out !="Yes" &&  {Self} != "N/A"

should be correct.

 

if it causes validation to fail regardless of Signed_Out value then it means expression Signed_Out!="Yes" always evaluate to true, ie. none of options is exactly "Yes".

make sure you do not have a typo somewhere or there is not a leading/trailing space or any other unprintable character.

you may try to add a calculated value control(s) on the form and let it step by step evaluate (sub)expression from your formula so that you can see how exactly do they evaluate.


I used the calculated value control to see what was going on and ended up using the formula: startsWith(Signed Out,"N")&&{ Self }!="N/A".

 

The choices for Singed Out are:

Yes

No - exclude reason1

No - exclude reason2

No - exclude reason3

 

I still can't figure out why !="Yes" did not work. I looked in the control settings for Signed out and there is not a leading or trailing space.

 

Thank you for your help.


@engus13, glad you were able to get this resolved. can you mark which response if any were correct and or reply with what the correct solution/screenshot may be?



 



Thanks for helping others find solutions by posting questions.


Reply