Recent

Rule Formula Examples for Nintex Forms

There are two different types of rules, Formatting rules and Validation rules.  Formatting rules either Disable or Hide the selected item when the rule condition is met.  Validation rules meanwhile will display an error message when it’s condition is met.  Since both types of rule perform their actions when the rule condition is met, any of the formula example below can be used for either Formatting or Validation rules.

If you are hiding a field(s) you should put the field(s) and the fields labels inside a panel and add the rule to the panel, see the Hiding Form Fields article for instructions.

This tutorial has sections for the following types of fields or values:

  • Text, Number, Dropdown/Radio button values or Form Mode (new, edit, view)
  • Checkbox values
  • Date and Time values
  • Format of the values entered (ensure email format, 10 digit number, etc)
  • Attachments (checking the number or or types of attachments)

**Important, all the formulas below only use single quotes (‘).  If you see ”, that means it’s two single quotes and not one double quote.   

 Text, Number, Dropdown/Radio button values or Form mode
 All Values in formulas are Case Sensitive
Field equals a specific value
-Condition is met when TextNumberDropRadio field equals Test.
Rule-Formula-1st-16-1 TextNumberDropRadio is a Named Control in the form
== is the symbol for Equals
‘Test’ is the value of the field (values must be enclosed with single quotes)
Field does not equal a specific value
-Condition is met when TextNumberDropRadio field does not equal Test.
Rule-Formula-1st-16-2 TextNumberDropRadio is a Named Control in the form
!= is the symbol for Not Equals
‘Test’ is the value of the field (values must be enclosed with single quotes)
Text or Number Field is blank 
-Condition is met when TextOrNumber field is blank.
Rule-Formula-1st-16-3 TextOrNumber is a Named Control in the form
== is the symbol for Equals
is two single quotes that means empty or null
Text or Number Field is not blank
-Condition is met when TextOrNumber field is not blank.
Rule-Formula-1st-16-4 TextOrNumber is a Named Control in the form
!= is the symbol for Not Equals
is two single quotes that means empty or null
Dropdown/Radio Field is blank  
-Condition is met when DropdownOrRadio field has no selected value
*Choice fields never have a blank value in the form
Rule-Formula-1st-16-5.jpg DropdownOrRadio is a Named Control in the form
== is the symbol for Equals
‘**SelectValue**’ is the value for choice fields when no value has been selected
Dropdown/Radio Field is not blank
-Condition is met when DropdownOrRadio field has a selected value.
*Choice fields never have a blank value in the form
Rule-Formula-1st-16-6 DropdownOrRadio is a Named Control in the form
!= is the symbol for Not Equals
‘**SelectValue**’ is the value for choice fields when no value has been selected
Using AND symbol to combine 2 conditions together
-Condition is met when ChoiceDropdown equals Urgent AND MultipleLineText field is empty
Rule-Formula-1st-16-7 ChoiceDropdown is a Named Control in the form
== is the symbol for equals
‘Urgent’ is a selected value for the Choice Dropdown
&& is the symbol for AND
MultipleLineText is a Named Control in the form
== is the symbol for equals
is two single quotes which signifies empty
Using OR symbol for 2 conditions
-Condition is met when ChoiceDropdown equals Urgent OR MultipleLineText field is empty
Rule-Formula-1st-16-8  ChoiceDropdown is a Named Control in the form
== is the symbol for equals
‘Urgent’ is a selected value for the Choice Dropdown
|| is the symbol for OR
MultipleLineText is a Named Control in the form
== is the symbol for equals
is two single quotes which signifies empty
Using AND and OR symbols together
-Condition is met when ChoiceDropdown equals Urgent AND
MultipleLineText field is empty, 
OR if ChoiceDropdown equals Critical
Rule-Formula-1st-16-9 Same as rule above except for either:
Urgent is selected for the ChoiceDropdown AND MultipleLineText is EmptyOR Critical is selected for the ChoiceDropdown
Form is in a specific Mode
-Condition is met when a New Form is being created
 Formula-Date-16-4c Is New Mode is a Common tab reference
Form is not in a specific Mode
-Condition is met when Editing or Viewing an existing form (not a new form).
Formula-Date-16-4dExample: This rule would run when the form is in View or Edit mode. not() is a Runtime Function

Is New Mode is a Common tab reference

Field is greater than a set value
-Condition is met when TextNumberDropRadio field is greater than 0 (zero).
 nf-rule-new-example-16-1 TextNumberDropRadio is a Named Control in the form
> is the symbol for greater than
0 (zero) is the value of the field (numbers do not need to be enclosed with quotes)
Field is greater than or equal to a set value
-Condition is met when TextNumberDropRadio field is greater than or equal to 1.
 nf-rule-new-example-16-2  TextNumberDropRadio is a Named Control in the form
>= is the symbol for greater than or equal to
1 is the value of the field (numbers do not need to be enclosed with quotes)

 

 Checkbox Values
 **Currently there is an acknowledged bug in Nintex Forms which makes the inArray runtime not work when in View or Edit mode of a form.  As of version 2.9.0.0 this issue hasn’t been resolved.  Instead of inArray, use the Contains Runtime Function.
Checkbox does not contain a specific value
-Condition is met if RequestType field does not have Name Change option checked.
 Formula-Checkbox-16-1 not() is a Runtime Function
inArray() is a Runtime Function
RequestType is a Named Control in the form
Name Change‘ is the value of the checkbox
Checkbox contains a specific value
-Condition is met if RequestType field contains
Name Change option checked.
 Formula-Checkbox-16-2 inArray() is a Runtime Function
RequestType is a Named Control in the form
Address Change‘ is the value of the checkbox
 Checkbox contains a specific value
-Condition is met if RequestType field contains
Name Change option checked.
NF-rule-formula-0416-2 contains() is a Runtime Function
RequestType is a Named Control in the form
Address Change‘ is the value of the checkbox

 

 Date and Time
 Rules for Date and Date and Time fields
Date Field is less than
another Date Field

-Condition is met when the EndDate field is less than the StartDate field
Formula-Date-16-3b.jpg EndDate is a Named Control on the form
< is the symbol for less than
StartDate is a Named Control on the form
Date Field is greater than
another Date Field plus 7 days

-Condition is met when the EndDate field is greater than the StartDate plus 7 days
*End Date must be within 7 days of Start Date
NF-rule-formula-0416-1 EndDate is a Named Control on the form
> is the symbol for more than
dateAddDays() is a Runtime Function
StartDate
is a Named Control on the form
7 is the number of days to add to the Start Date
Date Field is empty and test/choice field equals a specific value
-Condition is met when the CompletedDate field is
empty and the Status field equals ‘Completed’
Formula-Date-16-4b Status is a Named Control on the form
== is the symbol for equals
‘Completed’ is the value for the Status field
&& is the symbol for AND
CompletedDate is a Named Control on the form
== is the symbol for Equals
is two single quotes which signifies empty
When comparing a date field to the ‘Current Date’ we also include ‘New Mode’ in the Rule.  This is because the current date will change as the item is viewed and edited later.
*You can’t use ‘Created’ date as this date is blank in new forms until item is submitted.
Date Field is less than the Current Date
-Condition is met when the StartDate field is less than today’s date AND it’s a new form entry.
 Rule-Formula-Date-16-1 StartDate is a Named Control on the form
< is the symbol for less than
Current Date is a Common tab reference
&& is the symbol for AND
Is New Mode is a Common tab reference
Date Field cannot be more than 7 days in the future
-Condition is met when the StartDate field is greater than 7 days in the future AND it’s a new form entry.
Formula-Date-16-1b StartDate is a Named Control on the form
> is the symbol for greater than
dateAddDays() is a Runtime Function
Current Date is a Common tab reference
7 is the number of days to add to the Current Date
&& is the symbol for AND
Is New Mode is a Common tab reference
Date Field cannot be more than 7 days in the past
-Condition is met when the StartDate field is greater than 7 days in the past AND it’s a new form entry.
*Use – since there is no dateSubractDays function
Formula-Date-16-12b StartDate is a Named Control on the form
< is the symbol for less than
dateAddDays() is a Runtime Function
Current Date is a Common tab reference
-7 is the number of days to subtract from the Current Date
&& is the symbol for AND
Is New Mode is a Common tab reference

Format of the values entered into fields

To check the format of data entered into fields (e.g. Email Address, Social Security Number, etc) instead of rules you have to use a Regular Expression validation.  See the Checking the format of fields tutorial for instructions.

Attachments

To check the number of or type of attachments in a Nintex forms Attachment Validation options tutorial.

About Nick Hurst (84 Articles)
SharePoint and Nintex developer who strives to find easy to deploy and maintain solutions for business problems.

4 Comments on Rule Formula Examples for Nintex Forms

  1. Great, this is what I was looking for the last days. Thank you so much 👍🏼👍🏼👍🏼 😊

    Like

  2. Thank you, finally I got the answer for choice control validation

    Like

  3. Great cheat sheet!!

    Like

  4. Dennis George // June 8, 2017 at 12:20 pm // Reply

    Wonderful !! Thank you…

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: