Jacada Interact supports using formulas as part of Interaction design. The Formula Definition dialog enables you to create and update formulas by defining the necessary calculations or operations in the Formula field.
The following default element types are listed in the Formula Definition dialog when an Interaction contains no other Interaction elements:
- Function Elements: Predefined functions (such as Round, Trim, etc.). Inputs must be supplied.
- Internal Value Elements: Variables that are known to the server (e.g., random number). No inputs are needed.
- Variable Elements: Interaction variables (user or system).
As an Interaction is built, the Interaction elements that make up the flow are added to the default types that can be used in formula construction. For example:
Any of these elements can be added to formulas by dragging and dropping them into the Formula field.
Once a formula is defined, it is listed under Formula Elements in the Element Explorer pane. The formula can then be used in the following ways:
- Interaction element design: The formula is included in one of the sections of an Interaction page, e.g., the header or footer of a Question or a Statement. Use the Interaction Designer Editor to build the design quickly and easily. In runtime, the formula's placeholder is replaced with the calculated value.
- Allocator definition: The formula is used to change the value of a variable. The relevant formula is selected from either the left-hand or right-hand dropdown list of the Allocator Definition dialog.
To create a formula:
- From the Insert menu of the Interaction Designer, select Formula.
The Formula Definition dialog opens. - In the Reference Name field, replace the default name (e.g., Formula 1) with a logical name for your new formula.
- Expand the Elements tree, and design your formula by dragging and dropping relevant elements into the Formula field, and building the required syntax (if necessary). For a summary of inputs and syntax for the different function elements, refer to Defining Function Elements (below).
- A formula may contain only one function element. However, internal value elements (Current Date, Empty String, and Random Number) and variable elements may be used as many times as necessary.
- Supported calculations are addition, subtraction, multiplication and division. Supported syntaxes are:
+,-,/,* [var 1]-[var 2] ()
- If desired, click Format to define the formatting of the displayed value in runtime. The format type available is based on the first function (return value) of the formula.
For more details about format design, refer to Working with Data Type Formatting.Note: If a formula contains an element that has a secured format (e.g., an Input question whose answer is secured), the return format of the formula needs to be secured (Secure Answer format). - Click OK.
The formula is saved.
Defining Function Elements
When you drag and drop a function element into the Formula field, the required syntax is displayed, but the inputs need to be provided. For example:
The figure below shows the function element with the inputs defined. In this example, the formula adds 14 days to the current date.
The following table summarizes each function, its syntax and output, and required inputs. After you define the formula, you may customize the format of the return value by clicking the Format button.
Function | Description/Notes | Inputs and Syntax | Output |
---|---|---|---|
ADDDAYS | Adds a specified number of days to a given date. | ADDDAYS(Date,Number) | Date |
ADDMONTH | Adds a specified number of months to a given date. | ADDMONTH(Date,Number) | Date |
CONCATENATE | Joins two texts. | CONCATENATE(Text1,Text2) | String |
DATETOTEXT | Converts a date variable to a desired date syntax. This function can be used to format a date within a system variable (where date formatting is not supported). |
DATETOTEXT(Date,syntax of text) Note: The syntax specified here is the format of the text output. |
String |
DAYSDIFF | Displays the number of days between two given dates. | DAYSDIFF(Date,Date) | Integer |
ROUND | Rounds off a given number to a specified number of decimal points. | ROUND(Number,decimal_places) | Number |
TEXTTODATE | Converts a string into a date variable according to a specified format. This function is generally used to convert a text variable (e.g., an input question response, an Integration Point response, etc.) into a date variable. Additional functions (e.g., ADDDAYS), can then be performed on the date variable. |
TEXTTODATE(Text,syntax of text) Note: The syntax specified here is the current format of the text input. |
Date |
TRIM | Removes white spaces from a text. | TRIM(Text) | Text |
Comments