GROUPCONCAT

GROUPCONCAT

Syntax

GROUPCONCAT(<any>; [<any>])

Description

Creates a list of all unique non-null values seen in a group (currently max. 1000 values are collected). The order of elements isn't stable when running on a cluster, because the elements for each group might be collected on different nodes. If the element order matters, provide an order by expression as a second (optional) argument. This could for example be a timestamp or ID column in your data set.

This is an aggregate function

Example

Given the following data:

Key

Value

Time_Stamp

Key

Value

Time_Stamp

group1

a

1

group1

b

4

group1

c

3

group1

d

2

group2

a

4

group2

b

3

group2

c

2

group2

d

1

First create a group, e.g. GROUPBY(#RawData!Key)

Groups

Groups

group1

group2

Then use the GROUPCONCAT(#RawData!Value;#RawData!Time_Stamp), and the result is a list ordered by the identifier in relation to the GROUPBY() column.

Groups

Value

Groups

Value

group1

[a, d, c, b]

group2

[d, c, b, a]

 This function returns a list. If you require a JSON represented as a string wrap this function in TOJSON (E.g., TOJSON(<function>(...)).