Formulas

Just like in spreadsheets, formulas in Tines allow you to transform data. Where a cell in a spreasheet uses a formula to refer to other cells, a formula in a Tines action references upstream actions or other data sources throughout the platform.

Here are a few examples of what you can do with formulas:

# convert some text to uppercase
UPCASE(user.job)

# logic
IF(user.job = "Engineer", "likes code", "dislikes code")

# tap into our large library of powerful functions
CSV_PARSE(fetch_csv.body)

Adding formulas 

Formulas are most frequently used in actions. Add a formula expression to a text field inside a 'pill' using the inserter in action options:

Editing formulas 

Use the popup formula builder to author your formula expression. We’ll show in-line help and documentation as you type, and a preview of the result.

Formulas pills inside text fields: tags vs values 

There are two types of pill: values and tags.

Value pills are replaced with the result of their formula expression when the action runs.

Tags on the other hand control the flow of execution. Tags are particularly useful for doing things like building emails

Formula pills in text fields, vs formula fields 

When you use a pill within a piece of text, the value is converted to text and joined with any surrounding text. This isn't always what you want, sometimes you will want to add a complex object directly to a payload.

To do this you can use a formula field, instead of a text field:

Using a formula field will return the value directly, rather than converting it to text. This is useful for cases where you want to return a dynamic non-text value, like an array or an object.

Slugs 

Slugs are how we handle all references to specific objects in Tines: actions, resources, credentials, inputs and stories are all referenced via slugs. A slug is what you get when you "sluggify" an object's name, which involves a few steps:

  1. Converting all letters to lowercase.

  2. Replacing any series of special symbols (punctuation, whitespace, any character other than letters and numbers) that appears in the middle of a name with a single underscore. Special characters at the start or end of a name are deleted.

  3. If the name starts with a number, prepend it with an underscore

This is done to ensure that all names can be referenced through a combination of lowercase letters, numbers, and underscores. Here are some examples of sluggifications:

  • My action => my_action

  • Lots of spaces => lots_of_spaces

  • Series!!!!of!!!!special!!!!characters => series_of_special_characters

  • Japanese 日本語の文字 characters => japanese_characters

  • !!!Starts and ends with special characters!!! => starts_and_ends_with_special_characters

  • Numbers in middle 100 or end 200 => numbers_in_middle_100_or_end_200

  • 1 starts with a number => _1_starts_with_a_number

Occasionally, slugs will collide. If an upstream and downstream action have the same slug, the downstream action will get the reference. You cannot have a pair of resources or a pair of credentials on the same team with the same slug, as an error will be raised when you try to do so. However, it is possible to have a pair of matching resource or credential slugs across two separate teams.

Multipart slugs

Sometimes you may wish to reference the subfield of an object. This can be done using the following:

{
  "event":
  {
    "body": "foobar"
  }
}
  • event.body

If the keys contain spaces the following can be used:

{
  "event":
  {
    "body with spaces": "foobar"
  }
}
  • event["body with spaces"]

When passing in multipart slugs with spaces into a formulas function, use the following syntax:

{
  "array": 
    [
      {
        "Jira Team Name": "Accommodations Management",
      },
      {
        "Jira Team Name": "Travel Management",
      },
    ]
}
  • WHERE(array, "[\"Jira Team Name\"]", "Accommodations Management")

or

  • WHERE(array, "['Jira Team Name']", "Accommodations Management")

Was this helpful?