Solved

Rules help for newbie

  • 23 November 2023
  • 4 replies
  • 70 views

Badge +1

Hi,

I am building a rule that invalidate form submissions if when:

  1. ChoiceA(Yes/No)
  2. ChoiceB(Yes/No)
  3. ChoiceC(Accept/Denial)

Rule: If(and(ChoiceA!=’Yes’,ChoiceB!=’No’),ChoiceC==’Denial’)

This is just not working and I’m not exactly sure why.

Rules help for newbie

Thanks for the help

icon

Best answer by BobR 23 November 2023, 11:44

View original

4 replies

Userlevel 2
Badge +6

You typically shouldn’t need if-statements directly in rules. There are exceptions but I don’t think this situation should call for it. Could you give an overview of exactly when you want to invalidate the form submission? And are ChoiceA-C choice fields or Yes/No pickers? The picture you pasted also doesn’t show where ChoiceC is. It’s not clear to me yet what exactly it is you want to do.

Already some guidelines:

  • Yes/no checkboxes automatically evaluate to boolean values for the purposes of rules, you don’t have to put = in the rule for them, just a not() surrounding them if you want to invert the boolean outcome. For choice fields (like dropdown or choice checkboxes) you need different syntax
  • The and-function in rules can only handle two inputs at a time, inputs beyond the 2nd are ignored. If you want to put in more conditions, chain the and-functions like and(and(BooleanA,BooleanB),BooleanC) which evaluates to true if all three booleans are true. The or-function works in the same way.
  • If typically doesn’t evaluate to a boolean value, a rule requires a boolean output. The if-statement works as if(boolean,output if true,output if false), you can just put true and false as outputs but that just gives you the input boolean back so there’s typically no point to doing that.
Badge +1

Hi BobR, Thanks for the guidelines.. Below is what I’m trying to accomplish.

  1. ChoiceA-C are choice fields
  2. I tried ChoiceA&B as choice fields and ChoiceC as Yes/No pickers but I didn't get any where.

I will greatly appreciate your further insights.

Userlevel 6
Badge +22

Hi @iShin32 

Add this formula to your start button as a validation rule.
ChoiceA=="Positive(Pink)" && ChoiceB=="Negative(Clear)" && Choice C=="Acceptable"

Badge +1

Thanks @BobR@SimonMuntz for great responses. Knowing I don’t “need if-statements directly in rules” was crucial to understanding how Nintex works. Really appreciate all the help.

Reply