Skip to main content

Build Complex Formulas

To take full advantage of the Tonkean platform's powerful formulas, you can move beyond simple formulas—or a sequence of simple formulas—and combine multiple operations into a single, complex formula to handle varied or complex data, clean your data, and generally simplify your workflow.

The most common use case for complex formulas is advanced string manipulation, where you may need to extract unwanted characters, reformat a string, and extract a converted value in the same formula field.

Order of Operations

Tonkean formulas evaluate outward—that is, they start with the innermost operation and then execute the operation wrapped around the innermost operation, and so on. In many cases, the order of operations doesn't have a significant impact on the resulting value, but as you build increasingly complex formulas, manipulating the same string in multiple ways, this order can matter. Keep in mind this outward evaluation as you build and test your complex formulas.

Remove Unwanted Characters with the Replace Formula

The Replace formula is commonly used to clean up strings by removing unwanted characters or characters not allowed by certain applications. You can use multiple Replace formulas to remove several unwanted characters with the same formula field. For example, if you're bringing in a JSON array containing a list of values, you can nest several Replace formulas to remove the brackets and quotation marks to convert the JSON to plain text in your preferred format:

nested_replace_strip_characters.png

See the video below for a brief walkthrough of how to build this complex formula:

Format Dates

The Date Format formula is popular as a standalone formula field, but you can combine it effectively with other operations to format dates where a specific structure is required. For example, if you're passing in a date-time value to an API endpoint that requires a formatted date with the timezone offset, you can wrap the Date Format formula with a Concat formula to pass in the timezone offset:

date_form___concat.png

Clean Up Email Lists

For email-centric processes, it's common to work extensively with long lists of emails, such as in an email thread or recipient lists. In some of these processes, an email recipient list may contain a request's key stakeholders that you must extract and use as part of your workflows. For these and similar use cases, it's helpful to cleanly extract the email addresses, remove unwanted addresses (like your Tonkean email inbox), and format them as needed to use in other parts of your workflow. A combination of Regex and Replace operations is a powerful way to return a clean list of email addresses:

nest_regex_replace.png