make_list_with_nulls() (aggregation function)

Applies to: ✅ Azure Data ExplorerAzure MonitorMicrosoft Sentinel

Creates a dynamic array of all the values of expr in the group, including null values.

Note

This function is used in conjunction with the summarize operator.

Syntax

make_list_with_nulls(expr)

Learn more about syntax conventions.

Parameters

Name Type Required Description
expr string ✔️ The expression that to use to create the array.

Returns

Returns a dynamic JSON object (array) of all the values of expr in the group, including null values. If the input to the summarize operator isn't sorted, the order of elements in the resulting array is undefined. If the input to the summarize operator is sorted, the order of elements in the resulting array tracks that of the input.

Tip

Use the array_sort_asc() or array_sort_desc() function to create an ordered list by some key.

Example

The following example shows null values in the results.

let shapes = datatable (name:string , sideCount: int)
[
    "triangle", int(null),
    "square", 4,
    "rectangle", 4,
    "pentagon", 5,
    "hexagon", 6,
    "heptagon", 7,
    "octagon", 8,
    "nonagon", 9,
    "decagon", 10
];
shapes
| summarize mylist = make_list_with_nulls(sideCount)

Output

mylist
[null,4,4,5,6,7,8,9,10]