Negate ‘-‘

Unary operator ‘-‘ is used to negate a numeric value (integer or fractional).

  • If the operand evaluates to a valid numeric value, the result will be the negation of the evaluated value.

  • Otherwise the result will be undefined.

Operator Priority: 100

Operator Operands

  • Operand 1:
    • Type: any valid JsonQL expression (including invalid path).

    • Description: Any valid JsonQL expression.

Examples

{
  "UnaryOperator_-_1": "$value((-text1) is undefined)",
  "Comment_UnaryOperator_-_2": "(e.SalaryInvalid % 2 > 0) is evaluated to false for all employees",
  "UnaryOperator_-_2": "$value(Companies.Select(c => c.Employees.Where(e => -e.SalaryInvalid < -100000)))",

  "UnaryOperator_-_3": "$value(-1 + 17)",
  "UnaryOperator_-4": "$value(-Max(Companies.Select(c => c.Employees.Select(e => e.Salary))) + 100)"
}