Operators

Overview of operators that can be used in TARGIT calculations:

  • Arithmetic operators
  • Boolean operators
  • If-Then-Else statements
  • Labels

Arithmetic operators

Arithmetic operators follow standard rules for e.g., multiplication and division being "stronger" than addition and subtraction.

Operator

Description

-

Unary minus. Negates the expression.
Examples: -5;   -sum(d1, 0, m1)

^

Power. x to the power of y. Note that square root can be written as ^0.5 
Examples: 5^2 = 25;   5^3 = 125;   9^0.5 = 3

*   /

Multiplication and division.
Examples: 10 / 100 = 0.1

%

Division that multiplies result with 100.
Examples: 10 % 100 = 10

+   -

Addition and subtraction.

 

Boolean operators

Boolean operators are used for evaluating conditions and will return either or 0.

  • Will return 1 (non-zero, true) if condition is met.
  • Will return 0 (zero, false) if condition is not met.

Operator

Description

NOT

Negates expression.
Example: 3>2 returns true (1); NOT(3>2) returns false (0)

<

Less than

<=

Less than or equal to

>

Greater than

>=

Greater than or equal to

=

Equal to

<>

Different from

AND

X AND Y. Returns true (1) if X and Y both are true.

OR

X OR Y. Returns true (1) if X or Y or both are true.

 

If Then Else

Operator

Description
If Then ElseIf X Then Y Else Z. Evaluates to Y if X is true; evaluates to Z if X is false
Examples: if sum(d1, 0, m2) = 0 then 0 else sum(d1, 0, m1) / sum(d1, 0, m2)

 

Labels

Apply a label to an expression. The label can then be used to replace the expression if expression is repeated in same calculation. For calculation syntaxes with multiple occurrences of the same expression, using a label can easy the effort when changing the expression.

Note: Labels can only be declared and reused within each individual calculation.

Operator

Description
[Label]:[Label:](expression)
Examples:
   if Rev:(sum(d1, 0, m1)) >= 100 then Rev*1.1 else
   if Rev >= 200 then Rev*1.2 else
   if Rev >= 300 then Rev*1.3 else Rev
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.