Skip to main content

Logic

Using Jadu Central's logic functionality you can create formulae to calculate numeric and textual values. These values can then be used for a number of different purposes throughout your form, such as as a question prefill, as part of a form-level branching rule, sent to a third-party system as part of an action or used to determine whether to fire a particular rule.

Jadu Central provides four different logic types:

  • Predefined: reusable formulae that can be added to your form. A number of these are provided, some of which integrate with third party systems to retrieve data.
  • Mathematical: build up a mathematical formula that the application can evaluate.
  • Literal: build up any textual string of data.
  • Conditional: make decisions using IF/ELSE style logic.
note

The variable picker allows you to insert placeholder variables into mathematical or literal logics. These will be replaced by the corresponding proper value when the logic runs.

Adding logic to your form

  1. In your form, click the Logic tab in the top navigation bar.
  2. Click the Add Logic button. You will be taken to the logic designer, where you can build your logic.
  3. Enter a name for your logic, and select the type.
  4. The options available to define your logic will vary based on the type selected.
    • Predefined: Select a formula from the list. Some formulae require inputs. If the formula you choose is one of them, more input fields will show. Complete these by specifying questions, variables or other logic formulae. Alternatively, choose one of the set options for the input field if provided. You can enter manual text into most input fields, by typing in the search box and pressing the return key.
    • Mathematical: Enter a formula in the appearing box. Your formula must be a valid mathematical formula, or you will be unable to save it.
    • Literal: Enter a formula in the appearing box.
    • Conditional: Build out your logic using the rules engine.
  5. Click the Save to save your changes. You can now use this logic in your form.
tip

When creating a mathematical or literal formula:

  • You can drag and drop blocks from the toolbar, or type in the area where it says start typing.
  • Pressing enter will finish a block and start a new one
  • In mathematical formulae, the formula box will automatically finish some blocks for you and start a new one, for instance if you type '+'.
  • In literal formulae, blocks are not space separated - if you require a space, type one in your block
  • You can navigate the cursor between blocks with the arrow keys
  • Typing '[' in an empty block will open the variable picker
  • Blocks can be removed by deleting their content with backspace, or by dragging them to the trash can.

Conditional Logic

Often your forms will need to make a decision, whether that is to decide if a customer can continue with their submission or to determine how much the customer should pay for a service based on the questions they've answered. Other examples include being able to compare customer responses to known values or convert values to enable interoperability between different applications. Every form will require different decisions to be made.

Conditional logic allows you to make these decisions using IF/ELSE style logic within the Control Center. Using a combination of AND/OR and ELSE's complex logic can be built and used in your forms for a wide variety of different use cases.

A conditional logic must return a value when a condition has been met and when a condition is not met. Return is returned when the condition above it is met. Else Return is the default value that is returned if no conditions are met.

Expression types

There are 4 types of expression that can be used in a conditional logic:

  • Text: Static values, they can be strings or integers. To use, enter the value you want to compare in the text box.
  • Logic: Expressions that use the outcome of another logic; Predefined, Mathematical, Literal and Conditional. To use, choose the logic that you want to form part of the condition from the select list.
  • Definition: Reusable values that are defined across globally across your forms. They can be setup directly from the conditional logic setup pages or from their own pages. There are three types of definitions Constant, Date Calculation and Specific Date. See Logic Definitions for more information on setting up and using definitions.
  • Response: Responses provided by the customer filling in the form. To use, choose an answer from the drop down of questions.
danger

It is possible to setup a conditional logic that ultimately references itself creating an infinite loop situation. When this situation is encountered the conditional logic that is being referenced will return NULL.