asList
Converts the input value to a list.
The function is typically used with concat to combine the values from two or more columns (or two or more arrays) into a single data list. An example using table columns is included below.
Parameters
X (any)
The value to convert
Examples
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:
Output 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, you must convert the columns to lists prior to joining them.
[[concat(asList(COGS), asList(otherExp))]]
Now, the return value is a single list.
Output 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
.