Articles in this section
Category / Section

How to configure and use formula fields in BoldSign

Published:
4 mins read

Formula fields automate calculations and display values derived from predefined formulas. These formulas are created using supported functions and fields, without storing static data.

Understanding Formula Fields

Before constructing a formula expression, it’s essential to understand the supported operators, functions, and form fields.

Supported Form Fields

  • Text Box: Ensure the text box is configured as “Number” for compatibility with formulas.
  • Dropdown: Configure options as “Number” to allow easy integration with formulas.
  • Date Picker: Used for date-based calculations with preformatted date values.
  • Editable Date: Allows custom date input; ensure the correct date format for proper functionality.

Supported Operators

Formula fields support a variety of operators for calculations and logic, facilitating mathematical, logical, and comparison operations.

1. Arithmetic Operators

Operator Formula Description Example
+ [TextBox1] + [TextBox2] Calculates the sum of values. TextBox1 = 100, TextBox2 = 50 → Result = 150.
- [TextBox1] - [TextBox2] Calculates the difference. TextBox1 = 200, TextBox2 = 50 → Result = 150.
* [TextBox1] * [TextBox2] Calculates the product. TextBox1 = 5, TextBox2 = 10 → Result = 50.
/ [TextBox1] / [TextBox2] Divides values. TextBox1 = 100, TextBox2 = 4 → Result = 25.

2. Comparison Operators

Operator Formula Description Example
> [TextBox1] > [TextBox2] Checks if TextBox1 is greater than TextBox2. TextBox1 = 100, TextBox2 = 50 → Result = true.
< [TextBox1] < [TextBox2] Checks if TextBox1 is less than TextBox2. TextBox1 = 30, TextBox2 = 50 → Result = true.
>= [TextBox1] >= [TextBox2] Checks if TextBox1 is greater than or equal to TextBox2. TextBox1 = 50, TextBox2 = 50 → Result = true.
<= [TextBox1] <= [TextBox2] Check if TextBox1 is less than or equal to TextBox2. TextBox1 = 50, TextBox2 = 50 → Result = true.

3. Logical Operators

Operator Formula Description Example
&& [TextBox1] > 100 && [Dropdown1] > 50 Checks if both conditions are true. TextBox1 = 150, Dropdown1 = 60 → Result = true.
|| [TextBox1] > 100 || [Dropdown1] > 50 Checks if one of the conditions is true. TextBox1 = 150, Dropdown1 = 40 → Result = true.

Supported Functions

Function Description Example
If(condition, true_result, false_result) Returns one value if the condition is true, another if false. If ([TextBox1] > 100, [TextBox1], [TextBox2]) returns TextBox1 if greater than 100, else TextBox2.
Floor(number) Removes the decimal part and gives you the first whole number. Floor([TextBox1] / 2) rounds the division result down to the nearest integer. If TextBox1 is 7, Floor(7 / 2) will return 3.
Ceil(number) Jumps to the next whole number if there’s any decimal part, even if it’s one. Ceil([TextBox1] / 3) rounds the division result up to the nearest integer. If TextBox1 is 25, Ceil(25 / 3) will return 9.
Year(date) Extracts the year from a date. Year([DatePicker1]) returns the year from DatePicker1.
Month(date) Extracts the month from a date. Month([DatePicker1]) returns the month from DatePicker1.
Days(date) Returns the number of days in the month of a given date. Days([DatePicker1]) returns the number of days in the month for DatePicker1.
Day(date) Returns the day of the month for a given date. Day([DatePicker1]) returns the day (e.g., 1, 15, 30) from DatePicker1.
DateDiff(end_date, start_date) Calculates the difference between two dates in specified units. DateDiff([DatePicker1], [EditableDate]) returns the difference in days between the two dates.
AddYears(date, number of years) Adds a specified number of years to a date. AddYears([DatePicker1], 2) adds 2 years to DatePicker1.
AddMonths(date, number of months) Adds a specified number of months to a date. AddMonths([DatePicker1], 6) adds 6 months to DatePicker1.
AddDays(date, number of days) Adds a specified number of days to a date. AddDays([DatePicker1], 10) adds 10 days to DatePicker1.

Dropdown fields can also be used for all supported operations, as illustrated in the examples above using textboxes.

How to Use Formula Fields

Follow the steps below to configure and use formula fields:

  • Click Create New and select Create New Document.
  • Fill in all the required fields in the Prepare document for signing page and click the Next button.

Next button

  • On the configure field page, add the required form fields (e.g., TextBox, Dropdown, Date Picker) before adding the Formula Field.
  • Use meaningful IDs for form fields to simplify formula creation.

ID field

  • Drag and drop the Formula Field into the desired location and its settings will opens on the right panel.

formula field

  • Enter the Formula Field ID and click Set Formula to open the Formula Builder.

set formula button

  • Use supported fields, operators, and functions to create your formula.

formula builder

  • Select from the suggestions in the dropdown for ease of use.
  • Validate the formula to check for errors.
  • After validating, click Save to finalize the formula.

Save button

  • Use the Preview option to test the formula and verify its behavior.

Preview page

Formulas can include other formulas within them to create more advanced expressions for detailed calculations and logic.

Creating Conditional Logic for Formula Fields

  • Drag and drop the Formula Field into the document.
  • Add supporting form fields near the Formula Field.
  • Open the Formula Settings panel and click Create Logic.

Conditions:

  • True Condition: A result of 1 shows the field.
  • False Condition: A result of 0 hides the field.
  • Numeric Values: Any other number you enter, like 10, will only show the field if the formula evaluates to 10. If the result is anything other than 10, the field will be hidden.
  • For instance, if you want the offer field to be visible only to attendees who have purchased at least 3 tickets, you can create conditional logic for that formula.

conditional logic

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Access denied
Access denied