Onit Documentation

How to Create Groups on Show-If Formlets

by David Goldfarb Updated on

Show-if Formlet groups allow you to make powerful rules to support complex scenarios by grouping and combining AND and OR operators.

You can only use one rule per formlet per tab. Rules are saved at the app level so they can be used immediately, saved for later, or used on multiple forms. If you update an existing rule, it will apply changes to the rule in each instance that it is used in.

Before We Start...

This tutorial will assume you understand the following concepts:

Let's Get Started!

The Setup

In this tutorial, we will be creating a form that will show a formlet when a project involves the Product department or online advertisement. The app Documentation has a root form named Form 1 and a formlet named Department formlet.

The root form, Form 1, has four fields: Project Name (Text), Primary Department (Combo), Secondary Department (Combo), and Advertisement (MultiSelect). The two Combo fields, Primary Department and Secondary Department, use the same list of values: Marketing, HR, Sales, and Product. The MultiSelect Field, Advertisement, has the options of online and print.

The formlet, Department formlet, has two fields: Expected Revenue (Currency) and Request Summary (Textarea).

form 1
department formlet

How to

Opening the Show-If Formlet modal and the first few steps to creating a new rule are the same as outlined in How to Create a Show-If Formlet. Name the rule "(A & B) or (D or F)" and provide the description "Show this formlet if both rule A and rule B are true or if either rule D or rule F are true", as shown below. Click the Add group button (instead of the Add rule button).

A&B&(D|F)

Click the Add rule button from within the group box you just created. In this tutorial, the first rule we will create, Rule A, is: Project Name contains the word "Product"; so select Project Name from the field drop-down, Contains from the operator drop-down, and type in "Product" into the value textbox.

The formula for rules is: Rule = Field + Operator + Value. Field represents a field in your app. Operator is the logical action that creates a relationship between the Field and the Value. Value is the number or string that is being evaluated.

Your selection of the field impacts which operators are available and your selection of the operator impacts which value is needed to complete the rule. For example, if the Operator is set to Is Blank (or Is Not Blank) then the Value is predefined and does not require a value from you so it would not show in the Rule.

Click the same Add rule button from within the Group 1 box again in order to create the second part of the rule for this group.

1st rule in 1st group

For the second rule in the first group, Rule B, select Advertisment for the field, Includes any of for the operator, and online as the value.

What is the difference between "any of" and "all"? The operator Includes any of will evaluate as true if any of the values selected for the rule are chosen by an end-user on a form. The operator Includes all requires that all of the values selected for the rule are chosen by the end-user on a form for it to evaluate as true. The same logic is applied to the Excludes any of and Excludes all operators.

2nd rule in 1st group

We will now create a second group that will have two rules.

  1. Click the Add group button to create a second group that we will call Group 2.  
  2. Select OR as the condition between the two groups.
  3. Click the Add rule button from within the Group 2 box to create the first rule, Rule C, in Group 2.
  4. For the first rule in the second group, select Primary Department for the field, Equals for the operator, and Product as the value.
  5. Click the same Add rule button to create the second rule, Rule D, in Group 2.
  6. For the second rule in the second group, select Secondary Department for the field, Equals for the operator, and Product as the value.
  7. Select OR as the function between the two rules in Group 2.
  8. Click the Next button.
2nd group

Choose which formlet you want to show when the rule evaluates to true. In this tutorial we want the Department formlet to be included on the form when the Project Name has the word "Product" somewhere in the name and online is selected as one of the options for Advertisement or when either the Primary Department or the Secondary Department is Product. Click Save.

After you save you will see the Show-if Formlet container on the canvas. Preview or Publish the form.

Test out the functionality to ensure it works as expected!

The Department formlet still appears on the Quicklaunch form even when the Advertisement value is changed to print because of the OR condition between the groups.

Previous Article How to Create a Cascading List Combo (CLC) Backed Formlet
Next Article How to Add an Embedded Grid to Public Views

© 2024 Onit, Inc.

docs.onit.com contains proprietary and confidential information owned by Onit, Inc. that is subject to copyright. Onit presents it exclusively to you for your sole use in conjunction with using Onit products. No portion of the materials contained herein may be used for any other purpose. No portion of the materials contained herein may be shared with third parties or reproduced in any form.