Solved

Control validation based on values within control (multiple choice option)

  • 9 December 2019
  • 4 replies
  • 22 views

Badge +4

Looking for an idea to validate a column based on values picked within.  Right now i have it working so that if the 1st option is picked, a user cannot pick another option.  However, if option 1 is not picked, users can pick any variety of the remaning options. 

 

my set up repeats this for each of the options =contains([control],"option 1")&&contains([control],"option 2").  This will repeat 20 or so times to capture each option that may be picked with the 1st, and invalidate the conrol if this is done by the user.

 

Ideally, i would like to not hardcode the possible options and only state if option 1 is picked, nothing else can be picked with it but still keep this all in one control.

 

I can provide more information that would be helpful to explain the set up.  Thank you in advance for the tips!

icon

Best answer by zbean 13 December 2019, 19:28

View original

4 replies

Badge +7
Hi,

What problem are you trying to solve with this solution? If you can elaborate on your configuration with some screenshots that would be helpful!
Badge +4

Hi, 


 


Thanks for the reply! So my set up is similar to what you see below.  Option field is the field in question for the validation.  Option1 can be picked on its own, but never with any of the other 21 options. So this has numerous conditions to check for this, which work very well regardless of the combination picked in the form.  However, the issue is that this is a lookup feild that will grow with options and as of now each "option" value is typed into the formula.  It would be idea to have a way to check for other choices being picked if option1 is picked, but not have to call them out by name.  So in my head i am thinking more like this; =contains([option field],"Option1")+Option field has another choice picked.  That 2nd part is not something i am familiar with in Nintex.


 


original formula;


 


contains([option field], "Option1")&&contains([option field],"Option2")||contains([option field], "Option1")&&contains([option field],"Option3")
||contains([option field], "Option1")&&contains([option field],"Option4")||contains([option field], "Option1")&&contains([option field],"Option5")
||contains([option field], "Option1")&&contains([option field],"Option6")||contains([option field], "Option1")&&contains([option field],"Option7")
||contains([option field], "Option1")&&contains([option field],"Option8")||contains([option field], "Option1")&&contains([option field],"Option9")
||contains([option field], "Option1")&&contains([option field],"Option10")||contains([option field], "Option1")&&contains([option field],"Option11")
||contains([option field], "Option1")&&contains([option field],"Option12")||contains([option field], "Option1")&&contains([option field],"Option13")
||contains([option field], "Option1")&&contains([option field],"Option14")||contains([option field], "Option1")&&contains([option field],"Option15")
||contains([option field], "Option1")&&contains([option field],"Option16")||contains([option field], "Option1")&&contains([option field],"Option17")
||contains([option field], "Option1")&&contains([option field],"Option18")||contains([option field], "Option1")&&contains([option field],"Option19")
||contains([option field], "Option1")&&contains([option field],"Option20")||contains([option field], "Option1")&&contains([option field],"Option21")


 


hope this helps, reach out with any questions on it, thanks!

Badge +4

Hi, 


 


This is resolved.  Thanks for the reply on the 1st comment!  I ended up using;


 


contains([control],"option1")&&length([control])>1 - works like a charm and guessing i could add onto the 1st part with more contains in case i wanted to limit selections a bit more.

Badge +7

Good to hear that you've found an easy solution! This solution also enables you to add- or remove options without re-writing the whole code. 

Reply