Skip to main content

concat

Concatenates the input values into a single list.

The input values can be any type — numbers, strings, Booleans, datetime objects, etc. — but typically the function is used to join two or more lists to form a single data list.

The function also takes list-like objects such as a columns — see Using concat with table data.

Parameters

  • LIST OR OBJECT (any)

    The first input value or object.

  • LIST OR OBJECT (any)

    The next input value or object.

  • LIST OR OBJECT (any)

    Optional. The next input value or object.

Example

The function can create a single data list from multiple lists.

[[

list1 = makeList('Jacek', 'Chris')
list2 = makeList('Andy')
list3 = makeList('Mrunal', 'Dimitrios', 'Keerthana')

concat(list1, list2, list3)

]]

Concatenated List

Printed Result

(Jacek, Chris, Andy, Mrunal, Dimitrios, Keethana)

Jacek, Chris, Andy, Mrunal, Dimitrios and Keerthana

The Printed Result column shows how the result is displayed in the project output. The examples assume that Studio's defaults for list formatting apply. You can change the settings at Settings > List Formatting.

Using concat with table data

Assume a "Describe the Table" project with this data:

ID

Branch

Manager

Sales

COGS

otherExp

Profit

Row 1

01

Aberdeen

Andrew Gray

14000

8000

1500

4500

Row 2

02

Edinburgh

Emma Moore

33000

19000

3500

10500

Row 3

03

Inverness

Linda Barclay

16000

8250

1500

6250

Suppose you want to organize the COGS and otherExp values into a single data list.

You might try inputting column variables to the concat function. For example:

[[concat(COGS, otherExp)]]

The return value is:

Concatenated List

Printed Result

( (8000, 19000, 8250), (1500, 3500, 1500) )

8,000, 19,000 and 8,250 and 1,500, 3,500 and 1,500

Here, the return value is a list of lists — one inner list for the COGS values and another for otherExp.

To get a single list of values, first use asList to convert the columns to lists.

[[concat(asList(COGS), asList(otherExp))]]

Now, the return value is a single list.

Concatenated List

Printed Result

( 8000, 19000, 8250, 1500, 3500, 1500)

8,000, 19,000, 8,250, 1,500, 3,500 and 1,500

Note

In a "Describe Row in Context" project, the column variables are COGSColumn and otherExpColumn.