How to compare 2 choice fields (dropdown) using validation rule


Badge +4

Hi Team, I have a EventType choice (drop down) having values are following.

205675_pastedImage_2.png

and having one more choice (drop down).

205676_pastedImage_3.png

If it Event type is Root Loss, value should not be 0 - Not applicable in second drop down.

Is there any validate rule is there to achieve.


4 replies

Userlevel 4
Badge +12

You should be fine with this rule on your loss status field:

and(contains(EventType, "Root Loss"),contains(Lossstatus, "Not applicable"))

205679_pastedImage_5.png

Badge +4

Hi Enrico this is working.

Is it possible to do semicolon separated validation in the same rule like

and(contains(EventType, "Root Loss"),contains(Lossstatus, "Not applicable")) ; and(contains(EventType, "Root Loss"),contains(Lossstatus, "some other value"))

Userlevel 4
Badge +12

Great to hear it is working.

No this is not possible. The mechanism always has to validate to a single true or false. If you have multiple rules you may

- have one rule with an expression reach, in your case this would result in 2 rules or

- wrap your parts with an and or or depending on what is appropriate, like

or(and(contains(EventType, "Root Loss"),contains(Lossstatus, "Not applicable")), and(contains(EventType, "Root Loss"),contains(Lossstatus, "some other value")))

Badge +4

Hi Eric,

The rule provided is working for check 2 nested values. If more than 2 its not validation.

The following your rule i manipulated to achieve is follows

Formula Builder

and(contains(EVENTTYPE,"Recovery"),contains(BUSINESSFUNCTION,"Administration")) ||
and(contains(EVENTTYPE,"Recovery"),contains(BUSINESSFUNCTION,"Corporate finance")) ||
and(contains(EVENTTYPE,"Recovery"),contains(BUSINESSFUNCTION,"Trading and Sales - CM")) ||
and(contains(EVENTTYPE,"Recovery"),contains(BUSINESSFUNCTION,"Payments and settlements")) || and(contains(EVENTTYPE,"Recovery"),contains(BUSINESSFUNCTION,"Systems")) ||
and(contains(EVENTTYPE,"Recovery"),contains(BUSINESSFUNCTION,"Subscription")) ||
and(contains(EVENTTYPE,"Recovery"),contains(BUSINESSFUNCTION,"Outsourcing"))

Reply