Report templatesFunctions

implode

Join array elements or object values into a string with a delimiter

Usage

The implode function joins array elements or object values into a single string using the specified delimiter. It's similar to joinWith but also handles objects.

Syntax

{input | implode:delimiter}

Parameters

  • input (array/object/other): The collection to join
  • delimiter (string): The separator to place between elements

Returns

  • For arrays: String with all elements joined by delimiter
  • For objects: String with all values joined by delimiter
  • For other types: Returns the input unchanged

Examples

Array joining

{["apple", "banana", "orange"] | implode:", "}
// Returns: "apple, banana, orange"

Object values

{{"first": "John", "last": "Doe", "role": "Admin"} | implode:" "}
// Returns: "John Doe Admin"

Line breaks

{["Line 1", "Line 2", "Line 3"] | implode:"\n"}
// Returns: "Line 1\nLine 2\nLine 3"

No delimiter

{["A", "B", "C"] | implode:""}
// Returns: "ABC"

Semicolon separation

{["task1", "task2", "task3"] | implode:"; "}
// Returns: "task1; task2; task3"

Non-array input

{"simple string" | implode:", "}
// Returns: "simple string" (unchanged)

Object properties to CSV

{{"id": "001", "name": "Test", "status": "Active"} | implode:","}
// Returns: "001,Test,Active"

Use Cases

  • Creating comma-separated value strings
  • Building formatted lists from arrays or objects
  • Generating CSV-like output from object values
  • Creating readable lists in reports
  • Joining form field values for display

Differences from joinWith

  • implode handles both arrays and objects
  • implode extracts values from objects (ignoring keys)
  • implode returns non-collection inputs unchanged
  • joinWith is array-specific

Note

When used with objects, only the values are joined (keys are ignored). The order of values depends on the JavaScript engine's object property iteration order.