Functions

Functions play an essential role in manipulating and transforming data. Discover the different categories of functions and their usage. 

In this article

The role of functions

Functions allow you to perform specific operations on different types of data, such as numbers, strings, dates, and arrays. By using functions, you can modify, extract, or combine information to meet your needs.

Each function has a set of parameters that determine its behavior. These parameters specify the data on which the function should act, as well as other options or configurations necessary for the operation. Once the parameters are provided, the function performs its action and returns a result.

💡 It is important to note that functions can vary depending on the type and structure of the data on which they are applied. For example, a specific function may not work on a number but may be applicable to a string. Therefore, it is essential to understand the available functions and the types of data they accept in order to use them correctly.

General functions

By Key

The   By Key  function returns the value of an element from its key.

Parameter: Key

By Index

The  By Index function returns the value of an element from its index. The first element of an array is 0.

Parameter: Index 

By Id

The  By Id function returns the value of an element from its unique identifier.

Parameter: Identifier


Mathematical

All mathematical functions take a number as a parameter. If you are using the value from a Text Input component, be aware that this parameter is a string. Remember to use the Parse Number function to retrieve the number in the correct format before applying a mathematical function.

Add

The  Add  function adds the number specified in parameter and returns the value.

Substract

The   Substract function subtracts the number specified in parameter and returns the value.

Multiply

The   Multiply function multiplies by the number specified in parameter and returns the value.

Divide

The   Divide function divides by the number specified in parameter and returns the value.

Round

The  Round function rounds a numerical value to the nearest integer number.

Floor

The  Floor function returns the largest integer less than or equal to a specified number.

Ceil

The  Ceil function returns the smallest integer less than or equal to a specified number.

Sqrt 

The Sqrt function returns the square root of a number.

Cbrt

The Cbrt function returns the cube root of a number.

Tan

The Tan function returns the tangent of a number expressing an angle in radians.

Cos

The Cos function returns the cosine of an angle whose value is expressed in radians.

Sin

The Sin function returns the sine of a number.

Pow

The Pow function returns a number raised to a certain power.

Abs

The Abs function returns the absolute value of a number.

Format Number

The Format Number function returns a number in the requested format.

Parameters: 

  • Minimums (Fractions): the minimum number of fraction digits to be used
  • Maximums (Fractions): the maximal number of fraction digits to be used

Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat

Parse Number

The   Parse Number function parses a string with a number and returns the number.

Text and string of characters

Truncate

The function  Truncate limits the number of characters in a text by adding "..."

Split

The function  Split splits a string into substrings. This function returns the result as an array. The single separator parameter contains the character to split the string.


Date and time 

Date format

The function  Format Date returns a string expression based on the date, date format and language specified by the user. There are several date and time formats to choose from (none, short, medium, long, integer).

Learn more: Timestamp (Current Date & Time) 

Parse Date

The  Parse Date function parses a string with a date and returns the date.

Add Seconds

The function  Add Seconds returns a new date resulting from adding a given number of seconds to a date. To subtract seconds, enter a negative number.

Add Minutes

The function  Add Minutes returns a new date resulting from adding a given number of minutes to a date. To subtract minutes, enter a negative number.

Add Hours

The function  Add Hours returns a new date resulting from adding a given number of hours to a date. To subtract hours, enter a negative number.

Add Days

The function  Add Days returns a new date resulting from adding a given number of days to a date. To subtract days, enter a negative number.

Add months

The function  Add Months returns a new date resulting from adding a given number of months to a date. To subtract months, enter a negative number.

Add years

The function  Add Years returns a new date resulting from adding a given number of years to a date. To subtract years, enter a negative number.

Set seconds

The function  Set Seconds returns a new date with the seconds specified in the parameters. Accepts numbers from 0 to 59. If a number is given outside this range, the date will be returned with the seconds of the previous or next minute(s) accordingly.

Set Minutes

The function  Set Minutes returns a new date with the minutes specified in the parameters. Accepts numbers from 0 to 59. If a number is given outside this range, the date will be returned with the seconds of the previous or next minute(s) accordingly.

Set Hours

The function  Set Hours returns a new date with the time specified in the parameters. Accepts numbers from 0 to 23. If a number is given outside the range, it will return the date with the time of the previous or next day accordingly.

Set Days

The function  Set Days returns a new date with the day of the month specified in the parameters. Accepts numbers from 1 to 31. If a number is given outside the range, it will return the previous or next day of the month accordingly.

Set Months

The function  Set Months returns a new date with the month specified in the parameters. Accepts numbers from 1 to 12. If a number is given outside this range, it will return the month of the previous or next year accordingly.

Set Years

The function  Set Years renvoie une nouvelle date avec l'année spécifiée comme paramètre.


Array and Collection

Merge

The  Merge functions

Count

The Count function calculates the number of elements in an array.

Group by

The   Group by function groups the data according to a criteria.

Uniq by

The   Uniq by function removes duplicates according to a criteria.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.