eval

This command is experimental

Definition

eval calculates an expression and adds its result as a new table column.

Use =, +, -, *, / or evaluations to calculate the expression. Separate with a comma multiple expressions in one eval statement.

Examples

eval expression can contain either number or string values. Use quotation marks with string values.

%dpl
| makeresults
| eval firstValue = 10.5, secondValue = 62.9

Currently, eval supports only one expression per statement. To have several eval expressions, use following:

| eval firstValue = "value"
| eval secondValue = "value"
%dpl
index=example | eval City = "Town"
example of eval with a dataset

Calculating a Numeric Expression

You can make simple math calculations with eval by using +, -, * or / with variables.

%dpl
| makeresults
| eval decimal1 = 20.7, decimal2 = 28.9
| eval sum = decimal1 + decimal2, difference = decimal1 - decimal2, multiplication = decimal1 * decimal2, division = decimal1 / decimal2
The calculation order is currently literal, so it may not give you the correct result. This will be fixed before the community release.

Combining String Values

You can combine two or more string values with eval.

%dpl
| makeresults
| eval string1 = "this is text", string2 = " that continues with this"
| eval combineText = string1 + string2

Currently, eval doesn’t support this feature but instead gives an error. This will be fixed before the community release.

Evaluations

Use evaluation commands with eval to get more detailed results.

%dpl
index=example | eval CPI = if(_raw > 50.00, "↗ INCREASE", "↘ DECREASE")
example of evaluations with eval