In this article:
In Actionstep Builder, formulas help you create a flexible, dynamic set of templates. There are many uses for formulas, including performing simple and complex math calculations, grouping several lists together in one list, and testing several true/false conditions and condensing them into a single field—just to name a few.
Formulas contain expressions, which are the basic syntax used to combine or transform pieces of information.
Understanding Formula Syntax
When using variables or instructions in an expression, these fields are not enclosed between the field markers (i.e., {[ ]}). Additionally, instead of regular if instructions, expressions use conditional operators.
EXAMPLE:
In a Word or text template, you might see the following:
{[if Married]}{[Client.Name]} and {[Spouse.Name]}{[else]}{[Client.Name]}{[endif]}
However, in an expression, this would be written like this:
Married ? Client.Name + " and " + Spouse.Name : Client.Name
Essentially, the ? conditional operator tests the first condition you give it (the variable before the question mark), and if that condition is true it returns the first result (both the name of the client and the client's spouse). If the first condition is false, the else operator ( : ) merges a different value (just the client name).
Conditional operator can be nested. For example, you could use one salutation for married clients with the same last name, another salutation for married clients with different last names, and a third salutation for a single client:
EXAMPLE:
In a Word or text template, you might see the following:
{[if Married]}{[if Spouse.Last == Client.Last]}Mr. and Mrs. {[Client.Last]}{[else]}Mr. {[Client.Last]} and Ms. {[Spouse.Last]}{[endif]}{[else]}Mr. {[Client.Last]}{[endif]}
However, in a formula, this would be written like this:
Married ? Spouse.Last == Client.Last ? "Mr. and Mrs. " + Client.Last : "Mr. " + Client.Last + " and Ms. " + Spouse.Last : "Mr. " + Client.Last
Creating a Formula
You create formulas in the Builder Online Workspace. Once created, you can then use them wherever formulas can be inserted (like in your Word or text template, etc.)
To create a formula in Builder:
- Launch your Builder Online Workspace. (See Accessing the Builder Online Workspace for help.)
- Click the Designer tab and then choose the catalog you want the formula available to from the Elements list on the left side of the page.
- In the main area of the page, click the Formulas tab.
- Click Add a new formula. The New Formula window appears.
- Enter the formula Type and Formula Name and click OK. The page is updated so you can enter the expression you want used in the formula.
- In the Expression box, enter your formula:
- For a detailed list of possible filters, operators, and functions you can use, see these Knackly's help articles: Formula Reference and Advanced Operators and Expressions Guide.
- Select and drag variables from the variable list on the right side of the page into the Expression box. (If this pane is hidden, click the arrow near the top-right corner of the page.
- To save your changes, or undo any work you've performed, use the Save or the Revert changes icons.
Once you've created a formula, you can insert it. Just make sure it's visible in your variable list so you can work with it:
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article