Important
This function is considered experimental and under active development and should not be used in production.
The function must be enabled using the feature flag ArrayFunctions. See Enabling & Disabling Feature Flags.
Evaluates the function
argument on all values in the array under the
array
argument overwriting
the array. If an as
argument has been supplied, array:eval()
will save
the result in an array under the supplied prefix. This overwrites existing
arrays of that name.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
array [a] | string | required | The prefix of the array in LogScale, for example for events with fields incidents[0], incidents[1], ... this would be incidents . | |
as | string | optional[b] | The name of the output array. Default is to use the same as the input array. | |
function | string | required | The function to be applied to each element of the array. | |
var | string | required | Name of the variable to be used in function argument. | |
[b] Optional parameters use their default value unless explicitly set |
Omitted Argument NamesThe argument name for
array
can be omitted; the following forms of this function are equivalent:logscalearray:eval("value[]",var="value",function="value")
and:
logscalearray:eval(array="value[]",var="value",function="value")
These examples show basic structure only; full examples are provided below.
array:eval()
Examples
To square the value of each item in the array:
values = [2,3,4]
Use the following query function:
array:eval(values, as=squared, var="x", function={x := x*x})
The expected output:
squared = [4, 9, 16]