Formula to make a field mandatory on condition A or B

  • 26 April 2018
  • 4 replies
  • 145 views

Badge +3

I tried this formula but it did not work to make a field mandatory on condition: it must have a value if Request type=Add New Supplier or Request Type=Activate Supplier.  

 

Formula Builder

isNullOrEmpty({Self}) and(equals(Request_Type, 'Add New Supplier')or(Request_Type, 'Activate Supplier'))

The form can be saved without having a value this field.

 

Can someone give me a tip how to correct that formula?

 

Thanks in advance!


4 replies

Userlevel 4
Badge +12

Hi Isabel,

the operators work a bit different.

Instead of [Condition 1]and[Condition 2] they work like and([Condition 1], [Condition 2])

so what should be working is

and(isNullOrEmpty({Self}), or(equals(Request_Type, "Add New Supplier"), equals(Request_Type, "Activate Supplier")))

For usage of other runtime functions this might help too: Runtime functions 

Best regards

Enrico

Badge +3

Thanks Enrico,  I got this to work.

But now I have a similar issue:  A control needs to be hidden if meet 3 conditions. I used this formula but only first two conditions work, the 3rd one has no effect:

Formula Builder

equals(Request_Type, 'Add New Supplier') || equals(Request_Type, 'Activate Supplier') || equals(Request_Type, 'Deactivate supplier')

Does OR only work for two not three?

Badge +3

I got this to work by using Not(equals(… )   there is only one value need to match for this control to display, so if value not equal this value then hide.

Badge +4

 


I have a Nintex form with two fields as follows:


Accessby : drop down field


Approval : people field (hidden by default, shown only based on the value of Accessby)


 



  1. I need to hide Approval by default and show Approval field only when Accessby is showing 3 values e.g. "Cat1" "Cat2" "Cat3" (applied hide rule which is working fine)

  2. When Approval field is shown, I want to make sure users fill in at least one person and not leave as empty field.


 


I tried the following at the Rule section of the Approval field, but the system does not do Step 2 above, what is the correct formula to ensure that the Approval field is not empty when shown? :



  1. and(isNullOrEmpty({Self}), or(equals(Accessby, "Cat1"), equals(Accessby, "Cat2"), equals(Accessby, "Cat3")))

  2. isNullOrEmpty({Self}) and (Accessby == "Cat1" or Accessby == "Cat2"or Accessby == "Cat3") 

  3. isNullOrEmpty({Self}) && (Accessby == "Cat1" || Accessby == "Cat2" || Accessby == "Cat3") 


 


When I tried isNullOrEmpty({Self}) alone, the system immediate prompt me that the Approval field is empty even though the Approval field is hidden (note that I did not tick the "validate when hidden")


 

Reply