Operators


 

Description

 

Operators are a form of functions which acts on one or two values and return a value. Very commonly used functions are given operator status and are invoked by special symbols such as '+' for addition, '-' for subtraction etc.

 

Example:

 

(7 * 7) + 4 = 53
Hello " + "world" = "Hello world"

 

 

Arithmetic Operators


An arithmetic operator, operates on one or two numeric value and returns a numeric value.

Binary Arithmetic Operators

 

It operates on two values and hence called binary arithmetic operators

 

Syntax


<op1> <Operator> <op2>

 

where, <op1> and <op2> are both numeric expressions. The table below lists the binary arithmetic operators and their functionality:

 

Operator Functionality
   + addition of <op1> and <op2>
   - subtracts <op2> from <op1>
   *

multiplies <op1> and <op2>

   / divides <op1> by <op2>
   %

remainder when dividing <op1> by <op2>

 

 

Unary Arithmetic Operators

 

It operates on single value.

 

Syntax

 

<operator> <op1>

 

where, <op1> is a numeric expression. The table below lists the unary arithmetic operators and their functionality:

 

 

Operator Functionality
   +
functionality wise, it has no effect
   -
negates the given value

Relational Operators

 

A relational operator compares two values and returns a boolean expression (true or false) depending on the relation between the two values.

 

Example

 

5 > 4 -> true
233.6 < 94.22 -> false

 

Syntax

 

<op1> <Operator> <op2>

 

The table below lists the binary arithmetic operators and their functionality:

 

Operator Functionality
   > <op1> is greater than <op2>
  >= <op1> is greater than or equal to <op2>
   <

<op1> is less than <op2>

  <= <op1> is less than or equal to <op2>
   ==

<op1> is equal to <op2>

  != <op1> is not equal to <op2>

 

 

Conditional Operators

 

Relational operator combined with conditional operators, make your decision making more powerful. A conditional operator operates on boolean expression and each boolean expression may contain relational operator or conditional operator, thus enabling us to write complex decision logics. Deluge supports the conditional operators '&&' , '||' and '!'.

 

Syntax


<boolean expression> && <boolean expression>
<boolean expression> || <boolean expression>
! <boolean expression>

 

where,

'&&' - returns true only if both the left and right boolean expressions are true.
'||' - returns true if atleast one of the boolean expression evaluates to true.
'!' - returns true if the boolean expression is false and vice-versa.

Operator Functionality
   &&
Both the left and right boolean expressions are true
  ll Atleast one of the boolean expression is true
  !


boolean expression is false

 

 

Datetime operators: The Datetime operators are used to manipulate date values.

 

1. Adding a delta time period to date

 

Syntax

 

<datetime expression> <Operator> <delta value>


where,

 

- A <datetime expression> is a fixed date and time in calendar.

 

- Operator

Operator Functionality
   +
adds a delta time to the specified date/time
  - subtracts a delta time to the specified date/time

 

- delta value is a quantity of time, say 1 hour, 3 week etc. The delta value should be given in single quotes.

 

Syntax

 

'nW:nD:nH:nM:nS'


where,

W - Weeks
D - Days
H - Hours
M - Minutes
S - Seconds
n is a positive number

All values are optional, but if given they should follow the above order.


Example


1 week and 80 minutes can be written as '1W:80M'
2 days, 40 minutes and 30 sec can be written as '2D:40M:30S'

 

Also refer FAQ -> Form Fields -> Date fields.