arrayJoin
Description
Returns a single string by joining the elements of an array using the specified delimiter.
- The element type must be compatible with string conversion.
- Supported element types include
string,bool,number,interval,timestamp,regexp, andenum.
Syntax
Like many functions in DataPrime, arrayJoin supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
| array | array | true | The array of values to join |
| delimiter | string | true | The string delimiter used to join the array elements |
Example
Use case: Build a readable message from array values
Suppose you have a list of users who logged in. Consider the following input:
By joining the users array with a delimiter, you can generate a human-readable string that combines the array elements with other fields.
Example query
Example output
The result will include a new field msg with the joined string:
{
"users": ["Chip", "Ruby", "Glitch", "Cora"],
"action": "LOGIN",
"msg": "Users Chip,Ruby,Glitch,Cora performed action LOGIN"
}
Theme
Light