ON THIS PAGE
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Functions

Dynamic Expressions become more powerful with the use of functions. These built-in tools help you perform calculations, transform text, and format data, allowing you to create more dynamic and personalized content.

What Are Functions?

Functions in Dynamic Expressions are special commands that take input values (called arguments) and return a result. They can be used for math operations, text manipulation, and logic-based decisions.

Functions are written inside curly braces {{ ... }} and can be combined with data variables, literals, and operators.

Example: {{ ROUND(AVERAGE(sessionUser.stats.likes, 10)) }} - this example calculates the average between the user’s total likes and the number 10, and rounds the result to the nearest whole number.

Text Manipulation Functions

  • UPPERCASE(text): Converts the text to uppercase.
    • Example: {{ UPPERCASE("hello world") }} → "HELLO WORLD" (text)
  • LOWERCASE(text): Converts the text to lowercase.
    • Example: {{ LOWERCASE("HELLO") }} → "hello" (text)
  • CAPITALIZE(text): Capitalizes the first letter of the string.
    • Example: {{ CAPITALIZE("ideanote") }} → "Ideanote" (text)
  • TRIM(text): Removes leading and trailing whitespace from the string.
    • Example: {{ TRIM(" idea collection ") }} → "idea collection" (text)
  • REPLACE(text, search, replace): Replaces part of a string with another string.
    • Example: {{ REPLACE("Innovation Hub", "Hub", "Center") }} → "Innovation Center" (text)
  • TRUNCATE(text, length): Shortens a string to a specific length.
    • Example: {{ TRUNCATE("Welcome to the innovation program!", 10) }} → "Welcome to..." (text)
  • CONCAT(...strings): Combines multiple text strings into one.
    • Example: {{ CONCAT("Hello, ", "world") }} → "Hello, world" (text)
  • REPEAT(text, count): Repeats a string a specific number of times.
    • Example: {{ REPEAT("Hi! ", 3) }} → "Hi! Hi! Hi!" (text)
  • APPEND(text, suffix): Adds a suffix to the end of a string.
    • Example: {{ APPEND("hello", ", world") }} → "hello, world" (text)
  • PREPEND(text, prefix): Adds a prefix to the start of a string.
    • Example: {{ PREPEND("world", "hello, ") }} → "hello, world" (text)
  • STARTS_WITH(text, search): Returns whether a string starts with another string.
    • Example: {{ STARTS_WITH("hello", "he") }} → true (boolean)
  • ENDS_WITH(text, search): Returns whether a string ends with another string.
    • Example: {{ ENDS_WITH("hello", "lo") }} → true (boolean)
  • INCLUDES(text, search): Checks if a string contains another string.
    • Example: {{ INCLUDES("hello", "ell") }} → true (boolean)
  • LENGTH(text): Returns the length of the text.
    • Example: {{ LENGTH("Ideas") }} → 5 (number)

Math Functions

  • ABS(number): Returns the absolute (non-negative) value of a number.
    • Example: {{ ABS(-15) }} → 15 (number)
  • ADD(...numbers): Returns the sum of a list of numbers.
    • Example: {{ ADD(1, 2, 3) }} → 6 (number)
  • SUBTRACT(number, subtrahend): Returns the result of subtracting two numbers.
    • Example: {{ SUBTRACT(10, 2) }} → 8 (number)
  • MULTIPLY(number, multiplier): Returns the result of multiplying two numbers.
    • Example: {{ MULTIPLY(2, 3) }} → 6 (number)
  • DIVIDE(number, divisor): Divides one number by another.
    • Example: {{ DIVIDE(10, 2) }} → 5 (number)
  • MOD(number, divisor): Returns the remainder of dividing two numbers.
    • Example: {{ MOD(10, 3) }} → 1 (number)
  • ROUND(number): Rounds a number to the nearest whole number.
    • Example: {{ ROUND(4.7) }} → 5 (number)
  • CEIL(number): Returns the smallest integer greater than or equal to a number.
    • Example: {{ CEIL(1.5) }} → 2 (number)
  • FLOOR(number): Returns the largest integer less than or equal to a number.
    • Example: {{ FLOOR(1.5) }} → 1 (number)
  • MAX(...numbers): Returns the largest number from the list.
    • Example: {{ MAX(10, 20, 5) }} → 20 (number)
  • MIN(...numbers): Returns the smallest number from the list.
    • Example: {{ MIN(10, 20, 5) }} → 5 (number)
  • POW(number, exponent): Returns the result of raising a number to the power of another number.
    • Example: {{ POW(2, 3) }} → 8 (number)
  • AVERAGE(...numbers): Returns the average of a list of numbers.
    • Example: {{ AVERAGE(1, 2, 3) }} → 2 (number)

Formatting and Utility Functions

  • FORMAT(value): Formats a value (such as a number or date) based on user preferences.
    • Example: {{ FORMAT(10000) }} → "10,000" (text)
  • PREFIX(text, prefix): Adds a prefix to the start of a string.
    • Example: {{ PREFIX("world", "hello, ") }} → "hello, world" (text)
  • SUFFIX(text, suffix): Adds a suffix to the end of a string.
    • Example: {{ SUFFIX("hello", ", world") }} → "hello, world" (text)

Error Handling Tips

  1. Check for null values: Make sure variables you use exist.
  2. Avoid dividing by zero: Use MAX to ensure divisors are never zero, for example by writing {{ DIVIDE(10, MAX(value, 1)) }}.
  3. Match parentheses: Ensure all functions and conditionals have matching parentheses.
  4. Review error messages: Hovering over a "Not Calculated" value in your workspace can provide clues about the underlying cause.

By mastering these functions, you can transform your workspace into a fully dynamic, personalized, and efficient environment that adapts to user input and data.

How helpful was this article?
Thank you! Your feedback helps us improve.
Oops! Something went wrong while submitting the form.