Problem with Validation rule

  • 25 October 2018
  • 7 replies
  • 0 views

Userlevel 2
Badge +9

I am attempting to set a validation rule against a control to prevent it from being blank unless another control equals "Instructor Substitute".  Here is what i have in the rule.

PaySchedule==""&&PositionTitle!="Instructor Substitute"

Now the control name i have the rule on is PaySchedule.  If I remove the section of PositionTitle, the rule functions correctly.  I've checked my spelling just to make sure somewhere I've made a stupid typo.  I've also tried removing the check against the control being blank and have it check on PositionTitle.  That check never seems to work.  For some reason, it cannot see what is actually in that control.  Not sure if it matters or not, but PositionTitle is a Sql Request Control.  Is there something here I'm missing?  


7 replies

Userlevel 5
Badge +14

- do not compare against empty string, use rathre IsNullOrEmpty() inline function: IsNullOrEmpty(PaySchedule) 

- I'd say SQL request control works similarly to lookups - it returns ID & value together, so you will have to use parseLookup() runtime function to get one or the other part out of it.

try to add calculated value control on the form and set its formula to PositionTitle to make sure how does it exactly evaluate.

Userlevel 2
Badge +9

Sorry it took so long for me to get back to you. Ok, that worked. Basically I had to create a calculated value field and do a parselookup on the Position title control. Now, I have another issue. So basically after the offer is approved by management, the position is offered. I have another place to insert the pay schedule. This allows the potential employee to negotiate for pay. I need to see if FinalStepSchedule is blank unless the offer was rejected or the position title is Instructor Substitute. See formulas:

=="1"&&isNullOrEmpty(FinalStepSchedule)&&(PositionStatus<javascript:void(0);>!="Rejected"||PositionCheck<javascript:void(0);>!="Instructor Substitute").

I’ve tried this a couple different ways. I tried

(=="1"&&isNullOrEmpty(FinalStepSchedule)&&(PositionStatus<javascript:void(0);>!="Rejected)||( =="1"&&isNullOrEmpty(FinalStepSchedule)&& PositionCheck<javascript:void(0);>!="Instructor Substitute").

But that didn’t work. I’m guessing my crafting of and/or statements is most likely my problem.

Nintex Community <https://community.nintex.com/?et=watches.email.thread>

Re: Problem with Validation rule

reply from Marian Hatala<https://community.nintex.com/people/emha?et=watches.email.thread> in Getting Started - View the full discussion<https://community.nintex.com/message/84965-re-problem-with-validation-rule?commentID=84965&et=watches.email.thread#comment-84965>

Userlevel 5
Badge +14

your formulas aren't syntactically correct, == comparison operator needs two arguments, ie. formula should look like A==B && C != D

not sure what you wanted to achieve with ">!=" but this is not valid operator at all

Userlevel 2
Badge +9

Sorry the ">" symbols were added when I responded via email.  Here is formula I have in currently. {ItemProperty:HR016_IsApproved}=="1"&&isNullOrEmpty(FinalStepSchedule)&&(PositionStatus!="Rejected"||PositionCheck!="Instructor Substitute")

Userlevel 5
Badge +14

and?

syntactically it seems correct now...

Userlevel 2
Badge +9

Sorry for the late response on this one.  After working on this to get it to work (above formulas worked), HR decided they did not want this functionality.  So all for naught happy.png.  Thank you Marian for your assistance.

Userlevel 5
Badge +14

don't mind wink.png

if above suggestion worked, consider selecting and marking a post as a correct answer. it may at least help others.

Reply