Validations on Multiple Lookup Values

  • 21 February 2020
  • 3 replies
  • 5 views

Badge +1

Hello all,

I have a form that has a Status dropdown that is connected to a lookup list.  For every item within that Lookup list, I have a corresponding Date field.  So I have it set up like this:6541i041441256D73C16F.png

 

 

6542i35E22EACABC11D95.png

 

Using the following formula, I can get the Draft date to invalidate when Risk Status has be set to Draft.6543i2C844D6FEB8DC338.png

parseLookup(RiskStatus) === "Draft" && isNullOrEmpty({Control:Self})

So that's great!  That's exactly what I want. 6544i3DC3DBD3A12F1145.png

 

However, all these statuses should be visited in order during the course of my users' work.  So after Draft, this task should go into Pending Assignment.  But, I want to make it so that if a user tries to skip Draft and go directly to Pending Assignment, leaving the Draft Date field blank, it will invalidate the Draft Date field.  Every modifcation to this formula that I've tried has not worked.  It either doesn't honor the validation, or invalidates without me specifying the an additional status.  For example if I modify with just the additional next status:

 

parseLookup(RiskStatus) === "Draft", "Pending Assignment" && isNullOrEmpty({Control:Self})

The Draft Date field invalidates no matter what status I choose.

 

parseLookup(RiskStatus) === "Draft" || "Pending Assignment" && isNullOrEmpty({Control:Self})

Behaves the same way.

 

I'm thinking this is something simple, I'm just not thinking of.  I would greatly appreciate any help anyone can provide.

 

 

 


3 replies

Userlevel 6
Badge +22
If you want to make sure that the form is completed in order all you need to do is set a rule on each date control that says "If I am empty but the next control along is not" invalidate.
!isNullOrEmpty(Date2)&&isNullOrEmpty(Date1)
Badge +1

@SimonMuntz wrote:
If you want to make sure that the form is completed in order all you need to do is set a rule on each date control that says "If I am empty but the next control along is not" invalidate.
!isNullOrEmpty(Date2)&&isNullOrEmpty(Date1)

Thank you!  I'll give this a try and mark this as the solution if it ends up working for me.

Badge +1

So @SimonMuntz , I did used your idea and only modified it a little.  I have my original rules that strictly look at the status and validate the corresponding date field.  Then, for a second rule I used your formula and here's how I modified it:

 

!isNullOrEmpty(Date2) && isNullOrEmpty({Self})

And I just applied the same formula to every date field after, updating the date field name as I went.

 

Thanks for this!

Reply