Description:
Use a delimiter to concatenate values of an aggregation field.
concat(x;d)
Note:
The function concatenates values of aggregation field x using the delimiter d; concatenate them without using a delimiter when parameter d is absent. It can only work as the aggregate function in the groups() function.
Parameter:
x |
Aggregation field name. |
d |
A delimiter. |
Option:
@c |
Concatenate with the comma. |
@i |
Enclose each to-be-concatenated value with the single quotation marks. |
@q |
Enclose each to-be-concatenated value with the double quotation marks; won’t quote them when the option is absent. |
@0 |
Discard nulls and empty strings. |
Return value:
String
Example:
|
A |
|
1 |
=demo.query("select EID,NAME,DEPT from employee") |
Return a table sequence. |
2 |
=A1.groups(DEPT;concat(NAME;"_"):ALL_NAME) |
Group A1’s table sequence by DEPT field, concatenate NAME values in each group with the delimiter _ and return them to ALL_NAME column. |
3 |
=A1.groups(DEPT;concat@c(NAME):ALL_NAME) |
Work with @c option to use the comma as the delimiter. |
4 |
=A1.groups(DEPT;concat@q(NAME):ALL_NAME) |
Work with @q option to enclose each to-be-concatenated value with the double quotation marks. |
5 |
=A1.groups(DEPT;concat@i(NAME):ALL_NAME) |
Work with @i option to enclose each to-be-concatenated value with the single quotation marks. |
6 |
=A1.groups(DEPT;concat@i(NAME;"|"):ALL_NAME) |
Work with @i option to enclose each to-be-concatenated value with the single quotation marks, and use | as the delimiter. |
When @0 option is present:
|
A |
|
1 |
=create(id,num).record([1,11,1,,1,33,2,232,2,577,2,null]) |
Return a table sequence: |
2 |
=A1.groups(id;concat(num;";")) |
Group records of A1’s table sequence and perform an aggregation operation by id, and use semicolon to concatenate each aggregation field value: |
3 |
=A1.groups(id;concat@0(num;";")) |
With @0 option, nulls and empty strings are discarded when concatenating each aggregation field value: |