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 | string | true | The prefix of the array in LogScale, for example for events with fields incidents[0], incidents[1], ... this would be incidents . [a] | |
as | string | false | The name of the output array. Default is to use the same as the input array. | |
function | string | true | The function to be applied to each element of the array. | |
var | string | true | The name of the variable to be used in the corresponding function. | |
array:eval()
Examples
To square the value of each item in the array:
logscale
values = [2,3,4]
Use the following query function:
logscale
array:eval(values, as=squared, var="x", function={x := x*x})
The expected output:
logscale
squared = [4, 9, 16]