Data mapping functions reference

Supported mapping functions

ADD function

Function Name Description Usage Input parameter Return value
ADD Adds the specified number to an existing number. ADD(value) Number to add. Sum of the two numbers.

Example: Add two integers

Sample data: $var1$ = 15

Usage: $var1$.ADD(5)

Add 5 to var1.

Output: 20

AND function

Function Name Description Usage Input parameter Return value
AND Performs the logical AND operation on the specified boolean values. AND(value) A boolean value. A boolean.

Example: Find the AND value of a boolean expression

Sample data: $var1$ = TRUE

Usage: $var1$.AND(TRUE)

Find the AND value of the boolean expression.

Output: TRUE

APPEND_ALL function

Function Name Description Usage Input parameter Return value
APPEND_ALL Appends all the specified values to an array. APPEND_ALL(value1, value2, ...) Values to append.

The data type of the value to append should match the data type of the array. For example, for a String array you can append only string values.

Array with the appended values.

Example 1: Append values to an integer array

Sample data: $var1$ = {3,6,8,1}

Usage: $var1$.APPEND_ALL(7,9,15)

Append values 7, 9, and 15 to var1.

Output: {3,6,8,1,7,9,15}

Example 2: Append values to a Boolean array

Sample data: $var1$ = {True,False,True}

Usage: $var1$.APPEND_ALL(False,True)

Append the values False and True to var1.

Output: {True,False,True,False,True}

Example 3: Append values to a String array

Sample data: $var1$ = {"Hello","Apigee"}

Usage: $var1$.APPEND_ALL("Integrations","Test")

Append the words Integrations and Test to var1.

Output: {"Hello","Apigee","Integrations","Test"}

APPEND_ELEMENT function

Function Name Description Usage Input parameter Return value
APPEND_ELEMENT Appends an element to a JSON array. APPEND_ELEMENT(value) Value to append. JSON array with the appended element.

Example: Append an element to a JSON array

Sample data: $var1$ = ["first", "second", "third", "fourth"]

Usage: $var1$.APPEND_ELEMENT("fifth")

Append element fifth to var1.

Output: ["first", "second", "third", "fourth", "fifth"].

APPEND function

Function Name Description Usage Input parameter Return value
APPEND Appends the specified value to an array. APPEND(value) Value to append.

The data type of the value to append should match the data type of the array. For example, for a Boolean array you can append only True or False.

Array with the appended value.

Example 1: Append a value to an integer array

Sample data: $var1$ = {3,6,8,1}

Usage: $var1$.APPEND(7)

Append the value 7 to var1.

Output: {3,6,8,1,7}

Example 2: Append a value to a Boolean array.

Sample data: $var1$ = {True,False,True}

Usage: $var1$.APPEND(True)

Append the value True to var1.

Output: {True,False,True,True}

Example 3: Append a value to a string array

Sample data: $var1$ = {"Hello","Apigee"}

Usage: $var1$.APPEND("Integrations")

Append the word Integrations to var1.

Output: {"Hello","Apigee","Integrations"}

AVG function

Function Name Description Usage Input parameter Return value
AVG Calculates the numerical average of all the values in an array. AVG() N/A Average of all the values in an array. The return value is of type Double.

Example 1: Calculate the average of all the values in an integer array

Sample data: $var1$ = {2,4,9,3}

Usage: $var1$.AVG()

Calculate the average of values in var1.

Output: 4.5

Example 2: Calculate the average of all the values in a double array

Sample data: $var1$ = {2.0,6.1,3.9}

Usage: $var1$.AVG()

Calculate the average of values in var1.

Output: 4.0

CEIL function

Function Name Description Usage Input parameter Return value
CEIL Computes the smallest integer that is greater than or equal to the given input. CEIL() N/A An integer.

Example: Find the ceiling of a number.

Sample data: $var1$ = {3.4}

Usage: $var1$.CEIL()

Find the ceiling of var1.

Output: 4

CONCAT function

Function Name Description Usage Input parameter Return value
CONCAT Concatenates the specified characters to an existing string. CONCAT(value) String of characters to concatenate. Concatenated string.

Example: Concatenate a string of characters to an existing string

Sample data: $var1$ = "HelloApigee"

Usage: $var1$.CONCAT("Integrations")

Concatenate the string Integrations to var1.

Output: HelloApigeeIntegrations

CONTAINS function

Function Name Description Usage Input parameter Return value
CONTAINS Checks the occurrence of the specified value in a given string or string array. CONTAINS(value) Value to search. A boolean. Returns TRUE if a match is found and FALSE otherwise.

Example: Check the occurrence of a sequence of characters in a string

Sample data: $var1$ = "Hello Apigee Integrations"

Usage: $var1$.CONTAINS("xyz")

Check the occurrence of xyz in var1.

Output: FALSE

DECODE_BASE64_STRING function

Function Name Description Usage Input parameter Return value
DECODE_BASE64_STRING Decodes a base64 string to UTF-8 charset. DECODE_BASE64_STRING() N/A A decoded UTF-8 string.

Example: Decode a base64 string

Sample data: $var1$ = "SGVsbG8gSW50ZWdyYXRpb24h"

Usage: $var1$.DECODE_BASE64_STRING()

Decode var1 from base64 format.

Output: Hello Integration!

DIVIDE function

Function Name Description Usage Input parameter Return value
DIVIDE Divides an existing number by the specified number. DIVIDE(value) Divide by number (divisor). Quotient of the division operation.

Example: Divide an integer by another integer

Sample data: $var1$ = 16

Usage: $var1$.DIVIDE(3)

Divide var1 by 3.

Output: 5

EQUALS function

Function Name Description Usage Input parameter Return value
EQUALS Compares the specified value with the existing value. EQUALS(value) Value to compare. A boolean. Returns TRUE if the specified value matches the existing value and FALSE otherwise.

Example 1: Compare two strings

Sample data: $var1$ = "Apigee Integrations"

Usage: $var1$.EQUALS("Apigee Integrations")

Check if var1 equals "Apigee Integrations".

Output: TRUE

Example 2: Compare two integers

Sample data: $var1$ = 34

Usage: $var1$.EQUALS(23)

Check if var1 equals 23.

Output: FALSE

EQUALS_IGNORE_CASE function

Function Name Description Usage Input parameter Return value
EQUALS_IGNORE_CASE Compares the specified value with the existing value. EQUALS_IGNORE_CASE(value) Value to compare. A boolean. Returns TRUE if the specified value matches the existing value (ignoring case) and FALSE otherwise.

Example: Compare two strings

Sample data: $var1$ = "Apigee Integrations"

Usage: $var1$.EQUALS_IGNORE_CASE("apigee integrations")

Check if var1 equals apigee integrations.

Output: TRUE

EPOCH_TO_HUMAN_READABLE_TIME function

Function Name Description Usage Input parameter Return value
EPOCH_TO_HUMAN_READABLE_TIME Converts Unix epoch time (in milliseconds) to human-readable time format. EPOCH_TO_HUMAN_READABLE_TIME (value, value) This function takes the following arguments:
  • First argument (string): Timestamp format pattern such as hh:mm:ss.
  • Second argument (string): Target timezone.

    Valid values include UTC, UTC with offset, GMT, and other time zone names.

    Only the values UTC and GMT can be specified in the short form. For any other time zone, you must specify the full time zone name. For example, if you want to specify the "Australia/Melbourne" time zone, you must specify Australia/Melbourne as the value and not AEDT. For a full list of timezone names, see List of tz database time zones.

Converted timestamp in human-readable format.

Example: Convert an Unix epoch time (in milliseconds) to human-readable format.

Sample data: $var1$ = 1667494335011

Usage 1: $var1$.EPOCH_TO_HUMAN_READABLE_TIME("EEE, d MMM yyyy HH:mm:ss z","UTC")

Convert var1 to a human-readable timestamp of format EEE, d MMM yyyy HH:mm:ss z in UTC timezone.

Output: Thu, 3 Nov 2022 16:52:15 UTC

Usage 2: $var1$.EPOCH_TO_HUMAN_READABLE_TIME("EEE, yy-MM-dd HH:mm:ss,SSS","GMT")

Convert var1 to a human-readable timestamp of format EEE, yy-MM-dd HH:mm:ss,SSS in GMT timezone.

Output: Thu, 22-11-03 16:52:15,011

Usage 3: $var1$.EPOCH_TO_HUMAN_READABLE_TIME("EEE, yy-MM-dd HH:mm:ss,SSS ZZZZ","America/Los_Angeles")

Convert var1 to a human-readable timestamp of format EEE, yy-MM-dd HH:mm:ss,SSS ZZZZ in America/Los_Angeles timezone.

Output: Thu, 22-11-03 09:52:15,011 GMT-07:00

EXPONENT function

Function Name Description Usage Input parameter Return value
EXPONENT Calculates the value of an existing number raised to the specified power. EXPONENT(value) Power value. Value of the number raised to the specified power.

Example: Find the value of an integer raised to the power of 3

Sample data: $var1$ = 5

Usage: $var1$.EXPONENT(3)

Raise var1 to the power of 3.

Output: 125

FILTER function

Function Name Description Usage Input parameter Return value
FILTER Filters the array elements that satisfy a given filter condition.

Note that a filter condition must evaluate to TRUE or FALSE.

A filter condition includes one or more transformation functions applied on the current array iteration element.

FILTER(~objn -> Variable or Value)

Where ~objn indicates the current array element for which you want to apply the transformation functions. By default, the value for n starts from 1.

For JSON arrays with schema, you can use a dot (.) notation following the current array element to directly access the nested property of the that array element. For example, ~objn.PROPERTY.

A filter condition that evaluates to TRUE or FALSE. An array of elements that match the filter condition.

Example 1: Filter a string array.

Sample data: $var1$ = { "sara@example.com", "bola@example.com", "222larabrown@gmail.com", "dana@examplepetstore.com", "cloudysanfrancisco@gmail.com"}

Usage: $var1$.FILTER(~obj1-> ~obj1.CONTAINS("@gmail.com"))

Filter the string elements which contain @gmail.com in var1.

Output: {"222larabrown@gmail.com","cloudysanfrancisco@gmail.com"}

Example 2: Filter a JSON array.

Sample data:

  $var1$ = {
  "citynames": [
    {
      "city": "Abbeville",
      "state": "Louisiana"
    },
    {
      "city": "Aberdeen",
      "state": "Maryland"
    },
    {
      "city": "Benicia",
      "state": "California"
    },
    {
      "city": "Chehalis",
      "state": "Washington"
    },
    {
      "city": "Aberdeen",
      "state": "Washington"
    },
    {
      "city": "Aberdeen",
      "state": "Mississippi"
    },
    {
      "city": "Cheektowaga",
      "state": "New York"
    }
  ]
}

Usage:

var1.citynames
.FILTER(~obj1-> 
    ~obj1
    .GET_PROPERTY("city")
    .EQUALS("Aberdeen")
)

Filter the elements which have the city as Aberdeen in var1.

Output:

  [{
    "city": "Aberdeen",
    "state": "Maryland"
  },
  {
    "city": "Aberdeen",
    "state": "Washington"
  },
  {
    "city": "Aberdeen",
    "state": "Mississippi"
  }]

Example 3: Filter a nested JSON array.

Sample data:

  $var1$ =
{
  "products": [
    {
      "PA": "Integrations",
      "users": [
        {
          "name": "Ariel",
          "role": [
            "editor",
            "approver"
          ]
        },
        {
          "name": "Dana",
          "role": [
            "admin",
            "deployer"
          ]
        },
        {
          "name": "Lee",
          "role": [
            "viewer"
          ]
        }
      ]
    },
    {
      "PA": "Apigee",
      "users": [
        {
          "name": "Mahan",
          "role": [
            "editor",
            "admin",
            "deployer"
          ]
        },
        {
          "name": "Quinn",
          "role": [
            "invoker"
          ]
        }
      ]
    },
    {
      "PA": "Connectors",
      "users": [
        {
          "name": "Kiran",
          "role": [
            "invoker",
            "admin",
            "deployer"
          ]
        },
        {
          "name": "Sasha",
          "role": [
            "admin"
          ]
        }
      ]
    }
  ]
}

Usage:

    var1.products
    .FOR_EACH(~obj1 ->
      ~obj1
    .SET_PROPERTY(
        ~obj1
      .GET_PROPERTY("users")
      .FILTER(~obj2 ->
        ~obj2
        .GET_PROPERTY("role")
        .TO_STRING()
        .CONTAINS("admin")
      )
       ,  
    "users"
    )
  )      

Filter the elements which contain admin in users of var1.

Output:

    [{
      "PA": "Integrations",
      "users": [{
        "name": "Dana",
        "role": ["admin", "deployer"]
      }]
    }, {
      "PA": "Apigee",
      "users": [{
        "name": "Mahan",
        "role": ["editor", "admin", "deployer"]
      }]
    }, {
      "PA": "Connectors",
      "users": [{
        "name": "Kiran",
        "role": ["invoker", "admin", "deployer"]
      }, {
        "name": "Sasha",
        "role": ["admin"]
      }]
    }]

FLATTEN function

Function Name Description Usage Input parameter Return value
FLATTEN Flattens a JSON array recursively to create a new one-dimensional array. FLATTEN() N/A A flattened JSON array.

Example: Flatten a nested JSON array

Sample data: $var1$ = [[1, 2], [3, 4]]

Usage: $var1$.FLATTEN()

Flatten var1.

Output: [1, 2, 3 ,4]

FLOOR function

Function Name Description Usage Input parameter Return value
FLOOR Computes the greatest integer that is less than or equal to the provided input. FLOOR() N/A An integer.

Example:

Sample data: $var1$ = {27.6}

Usage: $var1$.FLOOR()

Find the floor of var1.

Output: 27

FOR_EACH function

Function Name Description Usage Input parameter Return value
FOR_EACH Applies one or more transformation functions for each element in an array. FOR_EACH(~objn -> Variable or Value)

Where ~objn indicates the current array iteration element for which you want to apply the transformation functions. By default, the value for n starts from 1.

For JSON arrays with schema, you can use a dot (.) notation following to the current array element to directly access the nested property of the that array element. See example.
Transformation functions. An array of elements.

Example 1: Concat a value to all the elements of a string array.

Sample data: $var1$ = {"Alex","Bola","Charlie","Dana","Hao"}

Usage: $var1$.FOR_EACH(~obj1-> ~obj1.CONCAT("@gmail.com"))

Concat the value @gmail.com to var1.

Output: { "Alex@gmail.com", "Bola@gmail.com", "Charlie@gmail.com", "Dana@gmail.com", "Hao@gmail.com" }

Example 2: Given a JSON array without schema, add a property to all the JSON objects.

Sample data:

  $var1$ =
{
  "employeeDetails": [
    {
      "name": "Alex"
    },
    {
      "name": "Bola"
    },
    {
      "name": "Charlie"
    }
  ]
}

Usage: $var1$.employeeDetails.FOR_EACH(~obj1-> ~obj1.SET_PROPERTY("Google","company"))

Add the property company:Google to var1.

Output:

[
  {
    "name": "Alex",
    "company": "Google"
  },
  {
    "name": "Bola",
    "company": "Google"
  },
  {
    "name": "Charlie",
    "company": "Google"
  }
]

Example 3: Given a JSON array without schema, add a property to all the nested JSON objects.

Sample data:

  $var1$ =
{
  "employeeDetails": [
    {
      "name": "Alex",
      "details": [
        {
          "age": "27",
          "address": "1800 Amphibious Blvd. Mountain View, CA 94045"
        }
      ]
    },
    {
      "name": "Bob",
      "details": [
        {
          "age": "25",
          "address": "8 Rue du Nom Fictif 341 Paris"
        }
      ]
    }
  ],
  "deptDetails": [
    {
      "id1": "HR"
    },
    {
      "id2": "Finance"
    },
    {
      "id3": "Sales"
    }
  ]
}

Usage: $var1$.employeeDetails.FOR_EACH(~obj1-> ~obj1.GET_PROPERTY("details").FOR_EACH(~obj2-> ~obj2.SET_PROPERTY("dd/mm/yyyy", "dob")))

Add the placeholder property dob: "dd/mm/yyyy" to details in var1.

Output:

  [
    [
      {
        "age": "27",
        "address": "1800 Amphibious Blvd. Mountain View, CA 94045",
        "dob": "dd/mm/yyyy"
      }
    ],
    [
      {
        "age": "25",
        "address": "8 Rue du Nom Fictif 341 Paris",
        "dob": "dd/mm/yyyy"
      }
    ]
  ]

Example 4: Given a JSON array with schema, concat the nested properties of the JSON object.

Sample data:

      $var1$ =
      {"citynames": [
      {
        "city": "Abbeville",
        "info": {
                "pincode": 29620,
                "state": "South Carolina",
                "location" : {
                      "lat" : "50.1055 N",
                     "lon": "1.8368 E"  
                }     
         }    
      },
      {
        "city": "Aberdeen",
        "info": {
                "pincode": AB10,
                "state": "Scotland",
                "location" : {
                      "lat" : "57.1499 N",
                     "lon": "2.0938 W"  
                }     
         }    
      },
      {
        "city": "Benicia",
  "info": {
                "pincode": 94510,
                "state": "California",
                "location" : {
                      "lat" : "38.0494 N",
                     "lon": "122.1586 W"  
                }     
         } 
      }
    ]
  }

Usage: $var1$.citynames.FOR_EACH(~obj1-> ~obj1.city.CONCAT(",").CONCAT(~obj1.info.location.lat).CONCAT(",").CONCAT(~obj1.info.location.lon))

Concat the nested properties of city using a separator (,) in var1.

Output:

[
  "Abbeville,50.1055 N,1.8368 E",
  "Aberdeen,57.1499 N,2.0938 W",
  "Benicia,38.0494 N,122.1586 W"
]

Example 5: Resolve a JSON array object reference in a template JSON.

Sample data:

      $var2$ =
      {
        "cityName": "$~obj1.city$",
        "latitude": "$~obj1.info.location.lat$",
        "longitude": "$~obj1.info.location.lon$"
      }
    
      $var1$ =
      {"citynames": [
      {
        "city": "Abbeville",
        "info": {
                "pincode": 29620,
                "state": "South Carolina",
                "location" : {
                      "lat" : "50.1055 N",
                     "lon": "1.8368 E"  
                }     
         }    
      },
      {
        "city": "Aberdeen",
        "info": {
                "pincode": AB10,
                "state": "Scotland",
                "location" : {
                      "lat" : "57.1499 N",
                     "lon": "2.0938 W"  
                }     
         }    
      },
      {
        "city": "Benicia",
  "info": {
                "pincode": 94510,
                "state": "California",
                "location" : {
                      "lat" : "38.0494 N",
                     "lon": "122.1586 W"  
                }     
         } 
      }
    ]
  }
  

Usage: $var1$.citynames.FOR_EACH(~obj1-> $var2$.RESOLVETEMPLATE())

Resolves references of ~obj1 in var2, where ~obj1 is the current iterating element of var1.

Output:

[
  {
    "cityName": "Abbeville",
    "latitude": "50.1055 N",
    "longitude": "1.8368 E",
  }
  {
    "cityName": "Aberdeen",
    "latitude": "57.1499 N",
    "longitude": "2.0938 W",
  }
  {
    "cityName": "Benicia",
    "latitude": "38.0494 N",
    "longitude": "122.1586 W",
  }
    
]

GET_ELEMENT function

Function Name Description Usage Input parameter Return value
GET_ELEMENT Returns the element at the specified index in a JSON array. In the array, the first value is available at index 0 and the last value is available at index n-1 where n is the size of the array. GET_ELEMENT(value) Index value of the element. Value of the element.

Example: Get the value of an element in a JSON array

Sample data: $var1$ = ["first", "second", "third", "fourth"]

Usage: $var1$.GET_ELEMENT(2)

Get the element at index 2.

Output: third

GET_PROPERTY function

Function Name Description Usage Input parameter Return value
GET_PROPERTY Returns the value of the specified property in a JSON object. GET_PROPERTY(value) Property name. Value of the property.

Example: Get the value of a property in a JSON object

Sample data: $var1$ = {"productId": 23,"productName": "radio"}

Usage: $var1$.GET_PROPERTY("productId")

Get the value of the property productId.

Output: 23

GET function

Function Name Description Usage Input parameter Return value
GET Returns the value in an array at a specified index. In an array, the first value is available at index 0 and the last value is available at index n-1 where n is the size of the array. GET(value) Index value of type Integer. Value at a given index of an array. The return type depends on the data type of the array. For example, for an integer array, this function returns an integer value.

Example 1: Get the value at an index of an integer array

Sample data: $var1$ = {11,6,7,2,15,8}

Usage: $var1$.GET(3)

Return the value in var1 at index 3.

Output: 2

Example 2: Get the value at an index of a string array

Sample data: $var1$ = {"Hello", "Test", "Apigee", "Integrations", "API Trigger", "Cloud"}

Usage: $var1$.GET(5)

Return the value at index 5.

Output: Cloud

GREATER_THAN_EQUAL_TO function

Function Name Description Usage Input parameter Return value
GREATER_THAN_EQUAL_TO Checks if an integer is greater than or equal to the specified value. GREATER_THAN_EQUAL_TO(value) Integer value to check. A boolean. Returns TRUE if an integer is greater than or equal to the specified value, and FALSE otherwise.

Example: Check if an integer is greater than or equal to the specified value

Sample data: $var1$ = 35

Usage: $var1$.GREATER_THAN_EQUAL_TO(15)

Check if var1 is greater than or equal to 15.

Output: TRUE

GREATER_THAN function

Function Name Description Usage Input parameter Return value
GREATER_THAN Checks if an existing number is greater than the specified number. GREATER_THAN(value) Number to check. A boolean. Returns TRUE if the existing number is greater than the specified value, and FALSE otherwise.

Example: Check if an integer is greater than the specified value

Sample data: $var1$ = 25

Usage: $var1$.GREATER_THAN(27)

Check if var1 is greater than 27.

Output: FALSE

LENGTH function

Function Name Description Usage Input parameter Return value
LENGTH Calculates the length of a string. The length of a string is the number of characters in the string. LENGTH() N/A Length of the string.

Example: Calculate the length of a string

Sample data: $var1$ = "Hello Apigee Test"

Usage: $var1$.LENGTH()

Calculate the length of string var1.

Output: 17

LESS_THAN_EQUAL_TO function

Function Name Description Usage Input parameter Return value
LESS_THAN_EQUAL_TO Checks if an integer is less than or equal to the specified value. LESS_THAN_EQUAL_TO(value) Integer value to check. A boolean. Returns TRUE if an integer is less than or equal to the specified value, and FALSE otherwise.

Example: Check if an integer is less than or equal to the specified value

Sample data: $var1$ = 35

Usage: $var1$.LESS_THAN_EQUAL_TO(15)

Check if var1 is less than or equal to 15.

Output: FALSE

LESS_THAN function

Function Name Description Usage Input parameter Return value
LESS_THAN Checks if an existing number is less than the specified number. LESS_THAN(value) Number to check. A boolean. Returns TRUE if the existing number is less than the specified number, and FALSE otherwise.

Example: Check if an integer is less than the specified value

Sample data: $var1$ = 25

Usage: $var1$.LESS_THAN(27)

Check if var1 is less than 27.

Output: TRUE

MAX function

Function Name Description Usage Input parameter Return value
MAX Finds the highest value in an array. MAX() N/A Highest value in an array.

Example 1: Get the highest value in an integer array

Sample data: $var1$ = {5,8,2,1}

Usage: $var1$.MAX()

Return the highest value in var1.

Output: 8

Example 2: Get the highest value in a double array

Sample data: $var1$ = {2.5,6.1,4.9}

Usage: $var1$.MAX()

Return the highest value in var1.

Output: 6.1

MERGE function

Function Name Description Usage Input parameter Return value
MERGE Merges two JSON variables (objects or arrays). If same value is present in both the variables, the function removes the duplicate value. MERGE(value) JSON value to merge. A JSON object or an array.

Example: Merge two JSON objects

Sample data: $var1$ = {"productId": 23}

Usage: $var1$.MERGE({"productName":"radio"})

Merge the value {"productName":"radio"} with var1.

Output: {"productId": 23,"productName": "radio"}

Example: Merge two JSON arrays

Sample data: $var1$ = ["first", "second", "third"]

Usage: $var1$.MERGE([4,5])

Merge the value [4,5] with var1.

Output: ["first", "second", "third",4,5]

MIN function

Function Name Description Usage Input parameter Return value
MIN Finds the lowest value in an array. MIN() N/A Lowest value in an array.

Example 1: Find the lowest value in an integer array

Sample data: $var1$ = {5,8,2,1}

Usage: $var1$.MIN()

Return the lowest value in var1.

Output: 1

Example 2: Find the lowest value in a double array

Sample data: $var1$ = {2.5,6.1,4.9}

Usage: $var1$.MIN()

Return the lowest value in var1.

Output: 2.5

MOD function

Function Name Description Usage Input parameter Return value
MOD Divides two values and returns the remainder of the division operation. MOD(value) Value of the divisor. Remainder of the division operation.

Example: Find the remainder of a division operation

Sample data: $var1$ = 90

Usage: $var1$.MOD(3)

Divide var1 by 3.

Output: 0

MULTIPLY function

Function Name Description Usage Input parameter Return value
MULTIPLY Multiplies an existing number by the specified number. MULTIPLY(value) Number to multiply. Product of two numbers.

Example: Find the product of two integers

Sample data: $var1$ = 10

Usage: $var1$.MULTIPLY(3)

Multiply var1 by 3.

Output: 30

NAND function

Function Name Description Usage Input parameter Return value
NAND Performs the logical NAND operation on the specified boolean values. NAND(value) A boolean value. A boolean.

Example: Find the NAND value of a boolean expression

Sample data: $var1$ = TRUE

Usage: $var1$.NAND(TRUE)

Find the NAND value of the boolean expression.

Output: FALSE

NOR function

Function Name Description Usage Input parameter Return value
NOR Performs the logical NOR operation on the specified boolean values. NOR(value) A boolean value. A boolean.

Example: Find the NOR value of a boolean expression

Sample data: $var1$ = FALSE

Usage: $var1$.NOR(FALSE)

Find the NOR value of the boolean expression.

Output: TRUE

NOT function

Function Name Description Usage Input parameter Return value
NOT Returns the opposite value of a boolean. NOT() N/A A boolean.

Example: Find the opposite value of a boolean

Sample data: $var1$ = FALSE

Usage: $var1$.NOT()

Find the NOT value of var1.

Output: TRUE

OR function

Function Name Description Usage Input parameter Return value
OR Performs the logical OR operation on the specified boolean values. OR(value) A boolean value. A boolean.

Example: Find the OR value of a boolean expression

Sample data: $var1$ = FALSE

Usage: $var1$.OR(TRUE)

Find the OR value of the boolean expression.

Output: TRUE

REMOVE function

Function Name Description Usage Input parameter Return value
REMOVE Removes the specified value from an array. REMOVE(value) Value to remove. Updated array after remvoing the specified value.

Example: Remove a string from a string array

Sample data: $var1$ = {"Hello","Apigee","Integrations"}

Usage: $var1$.REMOVE("Integrations")

Remove Integrations from var1

Output: {"Hello","Apigee"}

REMOVE_AT function

Function Name Description Usage Input parameter Return value
REMOVE_AT Removes an element from an array at the specified index. REMOVE_AT(value) Index value in the array. Updated array after remvoing the specified element.

Example: Remove an element from a string array

Sample data: $var1$ = {"Hello","Apigee","Integrations"}

Usage: $var1$.REMOVE_AT(1)

Remove string at index 1 in var1

Output: {"Hello","Integrations"}

REMOVE_PROPERTY function

Function Name Description Usage Input parameter Return value
REMOVE_PROPERTY Removes a property from a JSON object. REMOVE_PROPERTY(value) Property name. Updated JSON object after removing the specified property and its corresponding value.

Example: Remove a property from a JSON object.

Sample data:

$var1$ =
{
  "name": "Alex",
  "address": {
    "street": "1800 Amphibious Blvd",
    "city": "Mountain View",
    "state": "CA",
    "pincode": "94045"
  }
}  

Usage: $var1$.REMOVE_PROPERTY("address.street")

Remove the address.street property from the JSON.

Output:

{
  "name": "Alex",
  "address": {
    "city": "Mountain View",
    "state": "CA",
    "pincode": "94045"
  }
}

REPLACE_ALL function

Function Name Description Usage Input parameter Return value
REPLACE_ALL Replaces all the occurrences of a substring in a string. REPLACE_ALL(value, value) This function takes the following arguments:
  • First argument: String to match in the existing string.
  • Second argument: The replacement string.
Updated string with the replaced values.

Example: Replace all the occurrences of a substring with a new value.

Sample data: $var1$ = "HelloApigee"

Usage: $var1$.REPLACE_ALL("Apigee", "Google")

Return the current string "HelloApigee", with any substrings matching "Apigee" replaced with "Google."

Output: HelloGoogle

RESOLVE_TEMPLATE function

Function Name Description Usage Input parameter Return value
RESOLVE_TEMPLATE Resolves references in a template string that contains $variable$ references. RESOLVE_TEMPLATE() NA Resolved template with the reference variable value.

Example: Resolve a JSON reference in a template JSON that contains a $variable$ reference.

Sample data:

$var1$ =
{
  "name": "Alex",
  "address": "$var2$",
  "age": "25"
}
$var2$ =
{
  "street": "1800 Amphibious Blvd",
  "city": "Mountain View",
  "state": "CA",
  "pincode": "94045"
}

Usage: $var1$.RESOLVE_TEMPLATE()

Resolve var2 variable reference in var1.

Output:

{
  "name": "Alex",
  "address": {
    "street": "1800 Amphibious Blvd",
    "city": "Mountain View",
    "state": "CA",
    "pincode": "94045"
  },
  "age": "25"
}

Example: Resolve a string reference in a template string that contains a $variable$ reference.

Sample data:

  • $var1$ = Hello $var2$
  • $var2$ = World

Usage: $var1$.RESOLVE_TEMPLATE()

Resolve var2 variable reference in var1.

Output: Hello World

ROUND function

Function Name Description Usage Input parameter Return value
ROUND Rounds a number to the nearest integer. ROUND() N/A An integer.

Example: Round a number to the nearest integer

Sample data: $var1$ = 15.6

Usage: $var1$.ROUND()

Round var1 to the nearest integer.

Output: 16

SET function

Function Name Description Usage Input parameter Return value
SET Updates the value of a string array at the specified index. SET(value,value) This function takes the following arguments:
  • First argument (integer): Index of the string array where the value should be updated.
  • Second argument: The replacement string.
Updated string array.

Example: Update the value of a string array at an index

Sample data: $var1$ = {"Hello","World","Integrations"}

Usage: $var1$.SET(2,"Apigee")

Update var1 at index 2.

Output: {"Hello","World","Apigee"}

SET_PROPERTY function

Function Name Description Usage Input parameter Return value
SET_PROPERTY Adds or updates a property in a JSON object. SET_PROPERTY(value) Property name and value. A JSON object with the newly added or updated property.

Example: Add a property to a JSON object

Sample data: $var1$ = {"productId":23}

Usage: $var1$.SET_PROPERTY("radio","productName")

Add a property to var1.

Output: {"productId":23,"productName":"radio"}.

Example: Add a nested property to a JSON object

Sample data: $var1$ = {"productId":23}

Usage: $var1$.SET_PROPERTY({"productName","radio"},"productDetails")

Add a nested property to var1.

Output: {"productId":23,"productDetails":{"productName":"radio"}}.

Example: Update a property in a JSON object

Sample data: $var1$ = {"productId":23}

Usage: $var1$.SET_PROPERTY("34","productId")

Update the productId property in var1.

Output: {"productId":34}.

SIZE function

Function Name Description Usage Input parameter Return value
SIZE Counts the number of elements in an array. SIZE() N/A Total number of elements in an array.

Example 1: Find the size of a string array

Sample data: $var1$ = {"Hello", "Apigee", "Integrations"}

Usage: $var1$.SIZE()

Count the number of elements in var1.

Output: 3

Example 2: Find the size of an integer array

Sample data: $var1$ = {5,8,2,1,7}

Usage: $var1$.SIZE()

Count the number of elements in var1.

Output: 5

SPLIT function

Function Name Description Usage Input parameter Return value
SPLIT Splits a string based on the specified delimiter. SPLIT(value) A character or a sequence of characters to use to split the string. A string array.

Example 1: Split a string based on the space character

Sample data: $var1$ = "Hello Apigee Integrations"

Usage: $var1$.SPLIT(" ")

Split var1 based on the space character.

Output: {"Hello","Apigee","Integrations"}

Example 2: Split a string based on the comma character

Sample data: $var1$ = "Test,Integrations"

Usage: $var1$.SPLIT(",")

Split var1 based on the comma character.

Output: {"Test","Integrations"}

SUBSTRING function

Function Name Description Usage Input parameter Return value
SUBSTRING Returns the substring of the current string from the start index inclusive to the end index exclusive. SUBSTRING(value, value) This function takes the following arguments:
  • First argument: Start index value.
  • Second argument: End index value.
String between the start and end indexes.

Example: Return the substring of the current string, beginning with the character at the start index number and ending prior to the character of the end index number.

Sample data: $var1$ = "HelloApigee"

Usage: $var1$.SUBSTRING(1, 5)

Return the substring of var1.

Output: ello

SUBTRACT function

Function Name Description Usage Input parameter Return value
SUBTRACT Subtracts the specified number from an existing number. SUBTRACT(value) Number to subtract. Difference of two numbers.

Example: Subtract an integer value

Sample data: $var1$ = 10

Usage: $var1$.SUBTRACT(15)

Subtract 15 from var1.

Output: -5

SUM function

Function Name Description Usage Input parameter Return value
SUM Adds all the values in an array. SUM() N/A Sum of all the numbers in an array. The return type depends on the type of the array. For example, for an array of type Double, the return type is a double value.

Example: Add all the values of an integer array

Sample data: $var1$ = {5,8,2,1}

Usage: $var1$.SUM()

Add all the values in var1.

Output: 16

TO_BASE_64 function

Function Name Description Usage Input parameter Return value
TO_BASE_64 Encodes a string to base64 format using the UTF-8 charset. TO_BASE_64() N/A A base64 encoded string.

Example: Encode a string to base64 format

Sample data: $var1$ = "Hello World!"

Usage: $var1$.TO_BASE_64()

Encode var1 in base64 format.

Output: SGVsbG8gV29ybGQh

TO_BOOLEAN_ARRAY function

Function Name Description Usage Input parameter Return value
TO_BOOLEAN_ARRAY Converts a JSON array to a boolean array. TO_BOOLEAN_ARRAY() N/A A boolean array.

Example: Convert JSON array to a boolean array

Sample data: $var1$ = ["true", "false", "false"]

Usage: $var1$.TO_BOOLEAN_ARRAY()

Convert var1 to a boolean array.

Output: {true, false, false}

TO_BOOLEAN function

Function Name Description Usage Input parameter Return value
TO_BOOLEAN Converts a string to a boolean data type. TO_BOOLEAN() N/A A boolean. If a string has the value true or false, this function returns the corresponding boolean value.

Example 1: Get the boolean value of a string

Sample data: $var1$ = "true"

Usage: $var1$.TO_BOOLEAN()

Get the boolean value of var1.

Output: TRUE

Example 2: Get the boolean value of a string

Sample data: $var1$ = "FALSE"

Usage: $var1$.TO_BOOLEAN()

Get the boolean value of var1.

Output: FALSE

TO_DOUBLE_ARRAY function

Function Name Description Usage Input parameter Return value
TO_DOUBLE_ARRAY Converts a JSON array to a double array. TO_DOUBLE_ARRAY() N/A A double array.

Example: Convert JSON array to a double array

Sample data: $var1$ = [1.3, 4.8, 7.9]

Usage: $var1$.TO_DOUBLE_ARRAY()

Convert var1 to a double array.

Output: {1.3, 4.8, 7.9}

TO_DOUBLE function

Function Name Description Usage Input parameter Return value
TO_DOUBLE Converts a string or an integer to a double. TO_DOUBLE() N/A A double.

Example 1: Convert a string to a double

Sample data: $var1$ = "2.5"

Usage: $var1$.TO_DOUBLE()

Convert var1 to double.

Output: 2.5

Example 2: Convert an integer to a double

Sample data: $var1$ = 22

Usage: $var1$.TO_DOUBLE()

Convert var1 to double.

Output: 22.0

TO_INT_ARRAY function

Function Name Description Usage Input parameter Return value
TO_INT_ARRAY Converts a JSON array to an integer array. TO_INT_ARRAY() N/A An integer array.

Example: Convert JSON array to an integer array

Sample data: $var1$ = [3, 8, 9]

Usage: $var1$.TO_INT_ARRAY()

Convert var1 to an integer array.

Output: {3, 8, 9}

TO_INT function

Function Name Description Usage Input parameter Return value
TO_INT Converts a string to an integer. TO_INT() N/A An integer.

Example: Convert a string to an integer

Sample data: $var1$ = "35"

Usage: $var1$.TO_INT()

Convert var1 to integer.

Output: 35

TO_JSON function

Function Name Description Usage Input parameter Return value
TO_JSON Converts the current value to a JSON object. TO_JSON() N/A A JSON object.

Example: Convert a string to a JSON

Sample data: $var1$ = "{product: "cake", id: 21, price: 5}"

Usage: $var1$.TO_JSON()

Convert var1 to JSON.

Output: {product: "cake", id: 21, price: 5}

TO_LOWERCASE function

Function Name Description Usage Input parameter Return value
TO_LOWERCASE Converts all the characters in a string to lowercase. TO_LOWERCASE() N/A A string with all characters in lowercase.

Example: Convert a string to lowercase

Sample data: $var1$ = "Integrations TEST"

Usage: $var1$.TO_LOWERCASE()

Convert var1 to lowercase.

Output: integrations test

TO_SET function

Function Name Description Usage Input parameter Return value
TO_SET Removes duplicate values in an array. TO_SET() N/A An array with unique values.

Example 1: Get unique values of a string array

Sample data: $var1$ = {"Hello","World","Apigee","World"}

Usage: $var1$.TO_SET()

Get unique values in var1.

Output: {"Hello","World","Apigee"}

Example 2: Get unique values of an integer array

Sample data: $var1$ = (2,6,9,12,6,8,10,6,12)

Usage: $var1$.TO_SET()

Get unique values in var1.

Output: 2,6,9,12,8,10

TO_STRING_ARRAY function

Function Name Description Usage Input parameter Return value
TO_STRING_ARRAY Converts a JSON array to a string array. TO_STRING_ARRAY() N/A A string array.

Example: Convert JSON array to a string array

Sample data: $var1$ = [[1, 2], [3, 4]]

Usage: $var1$.TO_STRING_ARRAY()

Convert var1 to a string array.

Output: ["[1, 2]", "[3, 4]"]

TO_STRING function

Function Name Description Usage Input parameter Return value
TO_STRING Converts a number or a JSON to a string. TO_STRING() N/A A string.

Example: Convert an integer to a string

Sample data: $var1$ = 235

Usage: $var1$.TO_STRING()

Convert var1 to a string.

Output: 235

Example: Convert a JSON to a string

Sample data:

$var1$ =
{
  "dbIntegers": [1.0, 2.0, 3.0, 4.0],
  "dbString": "test"
}

Usage: $var1$.TO_STRING()

Convert var1 to a string.

Output:

{
  "dbIntegers": [
    1,
    2,
    3,
    4
  ],
  "dbString": "test"
}
  

TO_UPPERCASE function

Function Name Description Usage Input parameter Return value
TO_UPPERCASE Converts all the characters in a string to uppercase. TO_UPPERCASE() N/A A string with all characters in uppercase.

Example: Convert a string to uppercase

Sample data: $var1$ = "Integrations Test"

Usage: $var1$.TO_UPPERCASE()

Convert var1 to uppercase.

Output: INTEGRATIONS TEST

XNOR function

Function Name Description Usage Input parameter Return value
XNOR Performs the logical XNOR operation on the specified boolean values. XNOR(value) A boolean value. A boolean.

Example: Find the XNOR value of a boolean expression

Sample data: $var1$ = FALSE

Usage: $var1$.XNOR(TRUE)

Find the XNOR value of the boolean expression.

Output: FALSE

XOR function

Function Name Description Usage Input parameter Return value
XOR Performs the logical XOR operation on the specified boolean values. XOR(value) A boolean value. A boolean.

Example: Find the XOR value of a boolean expression

Sample data: $var1$ = TRUE

Usage: $var1$.XOR(FALSE)

Find the XOR value of the boolean expression.

Output: TRUE

Supported base functions

GENERATE_UUID function

Function Name Description Usage Input parameter Return value
GENERATE_UUID Generates a random UUID. GENERATE_UUID() N/A A string

Example: Generate a UUID.

Usage: GENERATE_UUID()

Output: 57547434-b572-4aaa-8da6-e6768850baa3

GET_EXECUTION_ID function

Function Name Description Usage Input parameter Return value
GET_EXECUTION_ID Returns the execution ID of the current integration. GET_EXECUTION_ID() N/A A string

Example: Get the execution ID of the current integration execution.

Usage: GET_EXECUTION_ID()

Output: 83fb009a-0152-433d-a3b6-e38118335308

GET_INTEGRATION_NAME function

Function Name Description Usage Input parameter Return value
GET_INTEGRATION_NAME Returns the name of the current integration. GET_INTEGRATION_NAME() N/A A string

Example: Get the name of the current integration.

Usage: GET_INTEGRATION_NAME()

Output: demo_integration

GET_INTEGRATION_REGION function

Function Name Description Usage Input parameter Return value
GET_INTEGRATION_REGION Returns the region of the current integration. GET_INTEGRATION_REGION() N/A A string

Example: Get the region of the current integration.

Usage: GET_INTEGRATION_REGION()

Output: us-east1

GET_PROJECT_ID function

Function Name Description Usage Input parameter Return value
GET_PROJECT_ID Returns the Google Cloud project ID of the current integration. GET_PROJECT_ID() N/A A string

Example: Get the Google Cloud project ID of the current integration.

Usage: GET_PROJECT_ID()

Output: demo-gcp-ip

INT_LIST function

Function Name Description Usage Input parameter Return value
INT_LIST Returns an integer list between the specified values. The returned list is inclusive of the starting value and exclusive of the ending value. INT_LIST(value, value) This function takes the following arguments:
  • First argument: starting integer value
  • Second argument: ending integer value
An integer array

Example: Generate an integer array between 12 and 20.

Usage: INT_LIST(“12”, “20”)

Returns a list of integers between 12 and 20.

Output: 12, 13, 14, 15, 16, 17, 18, 19

NOW_IN_MILLIS function

Function Name Description Usage Input parameter Return value
NOW_IN_MILLIS Returns the current Unix epoch time of the integration in milliseconds. NOW_IN_MILLIS() N/A Unix epoch time in milliseconds

Example: Get the current Unix epoch time in milliseconds and convert it to human-readable format.

Usage: NOW_IN_MILLIS().EPOCH_TO_HUMAN_READABLE_TIME("d MMM yyyy HH:mm:ss:SSS z","GMT")

Returns Unix epoch 1657783580839 and converts it to human-readable format.

Output: 14 Jul 2022 07:26:20:839 GMT