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.

arraystringtrue The prefix of the array in LogScale, for example for events with fields incidents[0], incidents[1], ... this would be incidents. [a]
asstringfalse The name of the output array. Default is to use the same as the input array.
functionstringtrue The function to be applied to each element of the array.
varstringtrue The name of the variable to be used in the corresponding function.

[a] If an argument name is not given, array is the default argument.

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]