Skip to content

Functions

Functions play a key role in data manipulation and transformation in PandaSuite. They allow you to perform specific operations on different data types, such as numbers, strings, dates, and arrays.

Understanding the Role of Functions

A function takes parameters that determine its behavior. These parameters specify the data the function should act on and may include operation-specific options. Once executed, the function returns a result that can be used in the application.

Some functions are only compatible with specific data types. For example, a mathematical function cannot be applied to a string without prior conversion.

General Functions

Evaluate

Evaluates an expression and returns the result.

Parameter: Expression (string containing a mathematical or logical operation)

Returns: True or false

By Key

Returns the value of an item based on its key.

Parameter: Key

Returns: Value associated with the key

By Index

Returns the value of an item based on its index (the first element is indexed at 0).

Parameter: Index

Returns: Value at the given index

By Id

Returns the value of an item based on its unique identifier.

Parameter: Identifier

Returns: Associated value


Mathematical Functions

Mathematical functions operate on Number data types and perform arithmetic, trigonometric, and formatting operations.

💡 If you use the value from a Text Input component, be sure to use the Parse Number function to convert the value before performing operations.

Add

Adds a number to the input value.

Parameter: Number to add

Example: 10 + 5 returns 15

Subtract

Subtracts a number from the input value.

Parameter: Number to subtract

Example: 10 - 3 returns 7

Multiply

Multiplies the input value by a number.

Parameter: Multiplier

Example: 10 × 3 returns 30

Divide

Divides the input value by a number.

Parameter: Divisor

Example: 10 ÷ 2 returns 5

Round

Rounds to the nearest integer.

Example: 4.7 returns 5, 4.3 returns 4

Floor

Returns the largest integer less than or equal to a number.

Example: 4.7 returns 4

Ceil

Returns the smallest integer greater than or equal to a number.

Example: 4.3 returns 5

Sqrt

Returns the square root of a number.

Example: 16 returns 4

Cbrt

Returns the cube root of a number.

Example: 27 returns 3

Tan

Returns the tangent of an angle in radians.

Example: tan(π/4) returns 1

Cos

Returns the cosine of an angle in radians.

Example: cos(0) returns 1

Sin

Returns the sine of an angle in radians.

Example: sin(π/2) returns 1

💡 Trigonometric functions expect angles in radians. To convert degrees to radians, multiply by π/180.

Pow

Returns a number raised to a given power.

Parameters:

  • Base: The number to raise
  • Exponent: The power to raise to

Example: 2^3 (2 to the power of 3) returns 8

Abs

Returns the absolute value of a number.

Example: -5 returns 5

Format Number

Returns a number in the requested format.

Parameters:

  • Minimums (Fractions): The minimum number of decimals to use
  • Maximums (Fractions): The maximum number of decimals to use

💡 Reference documentation: NumberFormat

Parse Number

Converts a string to a number.

Parse Color

Transforms an integer or a string into a Color object.

Parse Coordinates

Parses a string containing coordinates and returns a Coordinate object.

Example formats: "48.8566, 2.3522" or "48.8566;2.3522"

Returns: Coordinate object

Useful when receiving coordinate data as strings from external APIs or CSV files.


Text Functions

These functions operate on Text data types for string manipulation, formatting, and parsing.

Truncate

Limits the number of characters in a text by adding ”…” at the end.

Parameter: Maximum length

Returns: Truncated text string

Split

Splits a string into sub-strings using a separator character.

Parameters:

  • Text: The string to split
  • Separator: Character to split on (e.g., , or ;)

Returns: Array of sub-strings

Example: "apple,banana,orange" with separator , returns ["apple", "banana", "orange"]

LowerCase

Returns a copy of the string with all characters converted to lowercase.

Example: "HELLO World" becomes "hello world"

UpperCase

Returns a copy of the string with all characters converted to uppercase.

Example: "hello World" becomes "HELLO WORLD"

Concat

Concatenates multiple string values together and returns a combined string.

Parameters: Multiple text values

Returns: Combined string

Markdown

Converts text written in markdown into rich, stylized text that can be displayed in Text components.

Example: "**bold** and *italic*" becomes formatted text with bold and italic styling.

Parse JSON

Parses a string containing JSON data and returns an object or array.

Parameter: JSON string

Returns: Object, array, or value

Stringify JSON

Converts an object or array to a JSON string representation.

Parameter: Object or array

Returns: JSON formatted string


Date and Time Functions

These functions operate on Date data types for formatting, parsing, and manipulating dates and times.

Format Date

Converts a date into a string according to a given format.

You can choose between predefined and custom date and time formats.

Predefined Types

Parameters:

  • Date Style: Formatting style for the date portion
  • Time Style: Formatting style for the time portion
  • Time Zone: Reference time zone

Date Style options (example: September 16, 2021):

StyleExample Output
None(no date)
Short9/16/21
MediumSep 16, 2021
LongSeptember 16, 2021
FullThursday, September 16, 2021

Time Style options (example: 4:53 PM and 15 seconds):

StyleExample Output
None(no time)
Short4:53 PM
Medium4:53:15 PM
Long4:53:15 PM GMT+2
Full4:53:15 PM Greenwich Mean Time+2

Custom Types

Parameters:

  • Date/Time Format: Custom format using timestamp codes
  • Time Zone: Reference time zone

Common format codes:

CodeDescriptionExample (Sep 16, 2021, 4:53:05 PM)
yyyyYear (4 digits)2021
yyYear (2 digits)21
MMMMMonth (full name)September
MMMMonth (short name)Sep
MMMonth (2 digits)09
MMonth (1-2 digits)9
ddDay (2 digits)16
dDay (1-2 digits)16
EEEEDay of week (full name)Thursday
EEEDay of week (short name)Thu
HHHour 24-hour (2 digits)16
HHour 24-hour (1-2 digits)16
hhHour 12-hour (2 digits)04
hHour 12-hour (1-2 digits)4
mmMinutes (2 digits)53
mMinutes (1-2 digits)53
ssSeconds (2 digits)05
sSeconds (1-2 digits)5
aAM/PM markerPM

Example formats:

  • yyyy-MM-dd2021-09-16
  • dd/MM/yyyy HH:mm16/09/2021 16:53
  • MMMM d, yyyy 'at' h:mm aSeptember 16, 2021 at 4:53 PM

💡 See all format codes in the Date/Time Formatting reference

Parse Date

Parses a string containing a date and returns the date.

Parameter: Date string

Returns: Date object

Subtract Date

Returns the difference between two dates.

Parameters:

  • First date: Start date
  • Second date: End date

Returns: Duration in milliseconds

Add Seconds/Minutes/Hours/Days/Months/Years

Adds or subtracts a specific duration from a date. To subtract, enter a negative number.

Parameter: Number (positive to add, negative to subtract)

Returns: New date

Example: Adding 7 days to today’s date returns next week’s date.

Set Seconds/Minutes/Hours/Days/Months/Years

Replaces a specific part of the date with a new value.

Parameter: New value (number)

Returns: New date with the specified component changed

Example: Setting the month to 12 on any date changes it to December while keeping other components (day, year, time) unchanged.

Get Seconds/Minutes/Hours/Day/Month/Year

Extracts a specific component from a date.

Returns: Number representing the extracted component

Example: Get Month from 15/06/2023 returns 6 (June)


Array and Collection Functions

These functions work with Arrays and Collections to manipulate, aggregate, and transform structured data.

Merge

Merges two collections into one.

Example: [1, 2] merged with [3, 4] returns [1, 2, 3, 4]

Count

Returns the number of elements in an array.

Example: ["a", "b", "c"] returns 3

Group By

Groups data according to a criterion, creating nested arrays organized by the specified property.

Parameter: Property name to group by

Returns: Object with grouped arrays

Categorize by

Categorizes data according to a criterion, similar to Group By but with a flattened structure.

Parameter: Property name to categorize by

Returns: Categorized collection

Uniq By

Removes duplicates from a collection based on a given criterion.

Parameter: Property name to check for uniqueness

Returns: Array with duplicates removed

Min

Returns the minimum value from an array of numbers.

Returns: Minimum number

Min By

Returns the object with the minimum value for a specified property.

Parameters:

  • Collection: Array of objects
  • Property name: Field to compare

Example: From [{price: 10}, {price: 5}, {price: 15}], MinBy on “price” returns {price: 5}

Max

Returns the maximum value from an array of numbers.

Example: [10, 5, 20, 15] returns 20

Max By

Returns the object with the maximum value for a specified property.

Parameters:

  • Collection: Array of objects
  • Property name: Field to compare

Example: From [{score: 10}, {score: 25}, {score: 15}], MaxBy on “score” returns {score: 25}

Mean

Returns the average value of an array of numbers.

Returns: Average number

Example: [10, 20, 30] returns 20

Mean By

Returns the average of values for a specified property in a collection.

Parameters:

  • Collection: Array of objects
  • Property name: Field to average

Example: From [{score: 12}, {score: 16}, {score: 14}], MeanBy on “score” returns 14

Sum

Returns the sum of all values in an array of numbers.

Returns: Total sum

Example: [10, 20, 30] returns 60

Sum By

Returns the sum of values for a specified property in a collection.

Parameters:

  • Collection: Array of objects
  • Property name: Field to sum

Example: From [{price: 10}, {price: 20}, {price: 5}], SumBy on “price” returns 35

Shuffle

Randomly shuffles the elements of an array. You can define a Maximum size to limit the number of elements in the result.

To learn more about Shuffle function : Random Numbers

Chunk

Splits an array into several sub-arrays of the specified size.

Parameter: Size of each chunk

Example: [1, 2, 3, 4, 5, 6] with size 2 returns [[1, 2], [3, 4], [5, 6]]

Distance

Calculates the distance between two Coordinate points.

Parameters:

  • First coordinate: Starting point
  • Second coordinate: Ending point

Returns: Distance in meters

💡 Useful for proximity features, finding nearest locations, or geo-fencing applications.

Join

Converts all elements in an array into a string separated by a separator.

Parameters:

  • Array: Array of values
  • Separator: String to insert between elements

Example: ["apple", "banana", "orange"] with separator ", " returns "apple, banana, orange"

Keys

Returns an array of a given object’s own enumerable property names (keys).

Parameter: Object (Key/Value type)

Returns: Array of keys

Example: From { name: "Paris", country: "France" } returns ["name", "country"]

Values

Returns an array of a given object’s own enumerable property values.

Parameter: Object (Key/Value type)

Returns: Array of values

Example: From { name: "Paris", country: "France" } returns ["Paris", "France"]

Expand

Returns the element(s) associated with one or more References, resolving them to retrieve the full objects they point to.

Parameter: Reference or Multi-reference field

Returns: Referenced object(s)

Find

Returns the first element in a collection that matches a condition.

Parameters:

  • Collection: Array to search
  • Condition: Expression to evaluate for each element

Returns: First matching element or undefined

Example: From [{age: 15}, {age: 25}, {age: 20}], find where age > 18 returns {age: 25}

Find Index

Similar to Find, but returns the index of the first element that matches the condition instead of the element itself.

Returns: Index number (starting at 0) or -1 if not found

Find Last Index

Similar to Find Index, but iterates over elements from right to left, returning the index of the last matching element.

Returns: Index number or -1 if not found