This article demonstrates the use of formula mode in Quickwork.
What you'll need:
Skill level: Intermediate
Time required: 3 minutes
- Skills of specifying a ternary condition for the input fields
You can conditionally execute formulas using Ruby's ternary syntax (popular shortcut for if-else statements). The syntax is as follows:
condition ? expression1 : expression2
Behavior
condition:
A boolean expression that evaluates to true or false.
expression1:
Returns/executes this expression if the condition is true.
expression2:
Returns/executes this expression if the condition is false.
Conditional formula example
In the following example, we conditionally pass in either the Full name or First name into the Message input field:

Note: Remember to keep the toggle field denoted above switched to Formula mode when using the formulas in your input fields.
Here is a detailed explanation of what the ternary formula does:
Full name.present?will check if theFull Namepill has a value. If it has a value, it evaluates totrue. If it has no value, it evaluates tofalse.- The second
?in the formula separates the condition to evaluate from the expressions to return. - If there is a value in the
Full Namepill when the job is run, the value forFull Namewill be mapped to the Message input. - If there is no value in the
Full Namepill when the job is run, the value forFirst Namewill be mapped to the Message input. Of course, if there's also no value in thisFirst Namepill, the job will fail at this step, as Message is a required input field.
For more information on ternary syntax, check out this article.
Comments
0 comments
Please sign in to leave a comment.