Double Braces functions

Learn about Double Braces, an expression language developed by Digibee that users can take advantage of in order to reference and manipulate data within a pipeline

You can use Double Braces functions to manipulate data in a pipeline.

Syntax

Double Braces functions are enclosed within two sets of curly braces and a blank space, with the function name followed by a list of parameters enclosed in parentheses, like this:

{{ FUNCTIONNAME(param1, param2) }}

Double Braces functions are case-insensitive, but we recommend writing them in upper case as a best practice.

Nesting functions

You can use Double Braces function calls inside other functions, like this:

{{ OUTSIDEFUNCTION(INSIDEFUNCTION(param1,param2), param3) }}

When you do this, the functions are executed from the inside to the outside. That is, in the example above, INSIDEFUNCTION is executed first and its output is used as a parameter for OUTSIDEFUNCTION, which is executed last.

Unlike programming languages, Double Braces expressions executes all functions at the same moment, regardless of whether the IF condition is true or false. This differs from programming languages, which usually execute functions only after checking the IF condition.

Example

Input

{
    "date": "2022-10-26T03:00:00Z"
}

Double Braces expression

{
    "format": {{ IF(EQUALTO(SIZE(message.date),20),FORMATDATE( message.date, "yyyy-MM-dd'T'HH:mm:ss'Z'", "dd/MM/yyyy"),FORMATDATE( message.date, "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "dd/MM/yyyy")) }}
}

Output

{
  "success": false,
  "message": "Encountered a configuration error while generating JSON",
  "error": "com.digibee.pipelineengine.exception.PipelineEngineConfigurationException: com.digibee.doublebraces.service.DoubleBracesConfigurationException: Syntax error parsing double braces expression {{ IF(EQUALTO(SIZE(message.date),20),FORMATDATE( message.date, \"yyyy-MM-dd'T'HH:mm:ss'Z'\", \"dd/MM/yyyy\"),FORMATDATE( message.date, \"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\", \"dd/MM/yyyy\")) }}: Could not parse date/time evaluating function FORMATDATE. Error: Text '2022-10-26T03:00:00Z' could not be parsed at index 19"
}

Function list

Below, we have listed Double Braces functions by groups based on their usage.

COMPARISON

Used to compare booleans inputs. To learn more, read the article Comparison Functions:

  • AND

  • NOT

  • OR

  • XOR

NUMERICAL

Used to manipulate numeric values. To learn more, read the article Numerical Functions:

  • FORMATNUMBER

  • TODOUBLE

  • TOINT

  • TOLONG

  • TONUMBER

  • RANDOMNUMBERS

CONDITIONAL

The functions in this group return a value according to a specified criteria. To learn more, read the article Conditional Functions:

  • EQUALTO

  • GREATERTHAN

  • GREATERTHANEQUAL

  • IF

  • LESSTHAN

  • LESSTHANEQUAL

  • ISOBJECT

  • ISARRAY

  • ISBOOLEAN

  • ISSTRING

  • ISNUMBER

  • ISNULL

  • SWITCHCASE

DATE

Used to manipulate dates. To learn more, read the article Date Functions:

  • FORMATDATE

  • NOW

  • SUMDATE

  • TOISODATE

  • DIFFDATE

FILE

Used to query metadata and validate files. To learn more, read the article Comparison Functions:

  • FILEEXISTS

  • FILESIZE

JSON

Used to manipulate JSON objects. To learn more, read the article JSON Functions:

  • JSONPATH

  • TOJSON

  • UNESCAPEJSON

  • GETELEMENTAT

  • LASTELEMENT

  • REMOVEAT

  • NEWEMPTYOBJECT

  • NEWEMPTYARRAY

  • PUSH

  • POP

  • CARDINALITYONE

  • CARDINALITYMANY

MATH

Used to make mathematical operations. To learn more, read the article Math Functions:

  • ABS

  • CEIL

  • DIVIDE

  • LOG

  • MAX

  • MIN

  • MOD

  • MULTIPLY

  • POW

  • ROUND

  • SQRT

  • SUBTRACT

  • SUM

STRING

Used to manipulate strings. To learn more, read the article String Functions:

  • CAPITALIZE

  • CONCAT

  • ESCAPE

  • INDEXOF

  • JOIN

  • LASTINDEXOF

  • LEFTPAD

  • LOWERCASE

  • MATCHES

  • NORMALIZE

  • REPLACE

  • RIGHTPAD

  • SPLIT

  • SUBSTRING

  • TOSTRING

  • UPPERCASE

  • CONTAINS

  • DEFAULT

  • UNESCAPE

  • TRIM

  • STRINGMATCHES

  • RANDOMSTRINGS

UTILITIES

Used to make operations that do not fit the other categories. To learn more, read the article Utilities Functions:

  • BASEDECODE

  • BASEENCODE

  • UUID

  • TOBOOLEAN

  • SIZE

  • BASEURLDECODE

  • BASEURLENCODE

  • URIDECODE

  • URIENCOD

Last updated