Arithmetic expressions

Is the combination of numbers, operators and variables that results in a numeric value.

Generic Syntax:

| process eval("identifier = first_operand arithmetic_operator second_operand")

Addition (+)

Accepts numerical values as input for addition and generates the output in the destination field (identifier). It also accepts string values as input and returns the concatenation of values as the output.

Example:

| process eval("total_datasize=request_datasize+response_datasize")
| fields request_datasize, response_datasize, total_datasize

Here, the query calculates the value of the total_datasize identifier by adding the value of the request_datasize and response_datasize fields.

The fields command displays the corresponding values of all the three fields in a tabular form.

_images/addition.png

Using addition function

Subtraction (-)

Accepts numerical values as input for subtraction and generates the output in the destination field (identifier).

Example:

| process eval("difference_in_datasize=request_datasize-response_datasize")
| fields request_datasize, response_datasize, difference_in_datasize

Here, the query calculates the value of the difference_in_datasize identifier by subtracting the values of the response_datasize field from the request_datasize field.

The fields command displays the corresponding values of all three fields in a tabular form.

_images/substraction.png

Using subtraction function

Multiplication (*)

Accepts numerical values as input for multiplication and generates the output in the destination field (identifier).

Example:

| process eval("Revenue=unit_sold*Selling_price")
| fields unit_sold, Selling_price, Revenue

Here, the query calculates the value of the Revenue identifier by multiplying the values of the unit_sold and Selling_price fields.

The fields command displays the corresponding values of all the three fields in a tabular form.

_images/multiplication.png

Using multiplication function

Division (/)

Accepts numerical values as input for the division and generates the output in the destination field (identifier).

Example:

| process eval("price_per_unit=Selling_price/unit_sold")
| fields Selling_price, unit_sold, price_per_unit

Here, the query calculates the value of the price_per_unit identifier by dividing the values of the unit_sold and Selling_price fields.

The fields command displays the corresponding values of all the three fields in a tabular form.

_images/division.png

Using division function

Modulus (%)

Accepts numerical values as input for the division and generates the remainder of the division as the output in the destination field (identifier).

Example:

| process eval("modulo= Selling_price % cost_price ")
| fields Selling_price, cost_price, remainder

Here, the query calculates the value of the modulo identifier by finding the remainder after dividing the value of the Selling_price field by cost_price field.

The fields command displays the corresponding values of all the three fields in a tabular form.

_images/modulus.png

Using modulus function

Power (^)

Accepts numerical values as input for the power operation and generates the output in the destination field (identifier).

Example:

| process eval("area_square=length^2")
| fields length, area_square
_images/power.png

Using power function

Here, the query calculates the value of the area_square identifier by squaring the value of the length field.

The fields command displays the corresponding values of the two fields in a tabular form.


Helpful?

We are glad this guide helped.


Please don't include any personal information in your comment

Contact Support