Say you only want to display a certain field or screen in your form if the response to a field is "No." With GoCanvas, mobile forms can be created that allow users to skip screens and fields in the normal work flow if certain user defined conditions are met. This feature of skipping screens and fields is called Conditions.
How Conditions works
The condition for displaying a screen or field is determined in the Settings on the left side of the Advanced Form Builder, under the Condition section. When defining the condition for displaying a screen or field, the condition operates on the value of a field that has happened prior to the screen or field where the condition is being applied.
The condition can be based upon the alphanumeric value of the field or based upon whether a checkbox is checked or not. If it is based upon a checkbox, the values to be used should be "True," for checked, or "False," for unchecked.
You can configure Conditions for: "Equal", "Not Equal", "Less Than", "Less Than or Equal", "Greater Than", "Greater Than or Equal", "Contains", "Starts With", "Ends With", "Does Not Contain", "Does Not Start With", and "Does Not End With."
How to set up a Conditional Screen
An example of Conditions can be seen in a form used to gather demographic information about people. On the first screen called Basic Information a checkbox exists called Retired. If the checkbox is checked, we want a second screen to be shown called Retiree Information which contains questions specific to a retired person. If the checkbox is not checked, we do NOT want to show the Retiree Information screen.
Example: Demographic Information Form
Follow the steps below to make the Retiree Information screen conditional on the Retired checkbox field:
- Click on the name of the screen you want to make conditional, in this case Retiree Information.
- If not already open, click the gear icon to open the Screen Settings.
- Click to open the Screen Condition(s) tab then select New screen condition.
- Select a Condition Screen. Choose the screen that has the field you want your Conditional Screen to depend on. For this form, select Basic Information.
- Select a Condition Field. This is the field that will be looked at to decide whether or not your Conditional Screen will be displayed. Choose the checkbox field, Retired.
- Finish the condition by putting in the Condition Value and Condition. The Condition Value is the value your Condition Field will be compared to. In this form we want our conditional screen (Retiree Information) to show if the checkbox (Retired) is true (checked).
- Once you’ve done that you can continue to edit your form as needed. Don’t forget to click Publish to device when finished!
Adding more than one condition
You can add multiple conditions to a single screen or field. In this example, say you want the Retiree Information screen to appear if the Retired checkbox is selected AND the applicant is at least 60 years old.
- Under the first condition that you set for this screen, select the Click to add field condition button.
- Make sure that the AND option is selected in the drop-down between each condition.
- Select Basic Information as the Condition Screen and Age as the condition field.
- Choose >= (Greater Than or Equal) as the Value since you want the field to appear if the applicant is 60 or older.
- Enter 60 as the Condition Value.
If you want the Retiree Information to appear if the Retired checkbox is checked OR if the applicant is 60 or older, follow the same steps but choose the OR option from the drop-down between conditions.
How to set up a Conditional Field
Conditional fields follow the same rules as conditional screens. To set up a condition field follow these steps:
- Click on the name of the field in your form.
- In the field settings that appear on the left, click the Field conditions tab.
- Click to add a new field condition and enter your condition screen, field, condition, and condition value.
In summary, Conditions allows your mobile users to skip screens and fields if certain parameters are met. It is set under the Condition section of a screen or field and is based on the value of a previous field in the form.
Comments
12 comments
Does it follow an order of operations if there are multiple "OR" and "AND" used?
Hi Chris,
It goes in the order of the condition, so the first condition in the list will go first, then the second, etc.
For conditional fields, suppose I have a field that may or may not get information dispatched into it. If information is not dispatched, I do not want the user to enter any information into that field. So, I have it set as "Read only". However, If I want to set up a condition for another field to pop up based upon that field being empty or blank.. is there a text 'value' for blank cells.. Similar to a checked or unchecked block using "TRUE" or "FALSE" as the value for the condition.. Can "TRUE" or "FALSE" be used against an empty short text or dropdown field? I have been using 'is equal to '0'. Seems to work.
Are there any other "text"values that can be used?
Also, are there other characters that can be used similar to SQL %XYZ%.. or XYZ% to catch anything that contains or starts with XYZ?
Hi Keith,
You can also do is not equal to and then leave the condition value blank.
The things that work are:
True/False
Yes/No
1/0
We don't have a wildcard (though there is a feature request for that: https://help.gocanvas.com/hc/en-us/community/posts/360015937774-Allow-use-of-wildcard-characters-in-field-conditions-to-reduce-quantity-of-field-conditions as well as for contains: https://help.gocanvas.com/hc/en-us/community/posts/360000480568-Add-Contains-To-Field-Conditions).
Great info! Thanks! Guess this answers Jason Good's original post above too. Sara is always watching. Lol.
Is it possible to have field conditions show up only if boxes are checked within a multiple choice drop down? Specifically, I have to select certain items in a list. If they are selected, I want another option to show up on the app to enter the calibration date of the item selected within the drop down.
Howdy Bob,
You can set field or screen conditions based on user input for most field types, including Drop Down fields and Multiple Choice fields.
Could you please share more specific details on your use case and the hurdles you have encountered when trying to set up Conditions? That way, other users in the Community can provide their insight on the matter.
Alternatively, you can submit a ticket to our Support Team for direct troubleshooting with your App and any issues you may have encountered.
This is the multiple choice checkbox.
If I select High Voltage Gloves, I want a new option for "Tested Date:" and if I choose Calibrated Meters and Test Equipment, I want a new option for "Calibration Date:" Currently i cannot choose those options as Yes/no, true/false or Greater than/equal etc. Am I suppose to use the CONTAINS function? If so, would it be the name of the option checked or something else? Thank you
Hi Bob,
Yes, in that case you'd use CONTAINS, and enter Calibrated Meters and Test Equipment. Then, even if users select that plus some other options, it should still trigger the conditional field.
The CONTAINS function worked perfectly. Thanks!
Glad to hear it, Bob!
Hi,
Is it possible to have a value in a field change depending on the condition - or using an alternative approach?
Specifically, I am trying to build an expenses claim form. The HMRC mileage rate is £0.45 per mile up to 10,000 business miles and then reduces to £0.25/mile above that. I thought the most appropriate way to calculate this would be for the number of miles claimed to date to be entered by the user. The person compiling their claim would then add each journey and the miles driven. The app would check if the total number of miles in this month + previous claim is </> 10k. Then the claim value can be calculated accordingly.
But, this requires a conditional IF(X<10000,0.45,0.25) or something along those lines.
I hope this makes sense and thanks for your help in advance.
Please sign in to leave a comment.