makeList
Makes a data list from zero or more input values.
The function differs from list because it creates and returns a proper list, whereas list takes the input values and presents them textually in list form — i.e. it returns a string.
To convert a non-list value (e.g. a column) to a list, use asList instead.
Parameters
VALUE 1 (any)
Optional. The first value to include.
VALUE 2 (any)
Optional. A second value to include.
VALUE N (any)
Optional. The next value to include.
You can include as many values as you like.
Examples
You can create a list with zero or more input values.
ATL in Script | Resulting List | Printed Result |
|---|---|---|
| ( ) | [No output text] |
| (1, 2, 3) | 1, 2 and 3 |
| (one, two, three) | one, two and three |
You can include nulls, but these don't appear when you print.
ATL in Script | Resulting List | Printed Result |
|---|---|---|
| (1, 2, null, 3) | 1, 2 and 3 |
Note
Nulls do count as values. Therefore, [[len(makeList(1, 2, null, 3))]] returns a value of 4.
If you input lists, the output is a list of lists. For example:
ATL in Script | Resulting List | Printed Result |
|---|---|---|
[[ list1 = makeList(1, 2, 3); list2 = makeList(4, 5, 6); makeList(list1, list2) ]] | ( (1, 2, 3), (4, 5, 6) ) | 1, 2 and 3 and 4, 5 and 6 |
To combine two lists into a single data list, use concat instead.
ATL in Script | Resulting List | Printed Result |
|---|---|---|
[[ list1 = makeList(1, 2, 3); list2 = makeList(4, 5, 6); concat(list1, list2) ]] | (1, 2, 3, 4, 5, 6) | 1, 2, 3, 4, 5 and 6 |
You might use makeList to create inputs for the createAtlObject function. For example:
[[
sumProfit = totalVal(Profit)
avgProfit = mean(Profit)
maxProfit = maxVal(Profit)
minProfit = minVal(Profit)
keyNames = makeList('totalProfit', 'averageProfit', 'maximumProfit', 'minimumProfit')
values = makeList(sumProfit, avgProfit, maxProfit, minProfit)
createAtlObject(keyNames, values)
]]