SAND CDBMS Tools Reference Guide
NDL++ Functions:
Syntax and Examples

 

Previous Topic:
Custom Library Functions

Chapter Index
Next Topic:
NDL++ Operator Precedence

 

NDL++ Statement Operators


The following operators can be used in combination with constants, field references, NDL++ functions and variable declarations in the map specification section (table-name section) of the load specification script, as well as in NULLIF, MISSINGIF, and SKIPIF clauses. For information about the order of evaluation of NDL++ operators, see the Statement Operator Precedence table below.


Arithmetic Operators

* multiplication  
/ division   
% modulus A % B (“A modulo B”) returns the remainder of A / B (“A divided by B”).
+ addition  Can also be used to concatenate strings
- subtraction  


Comparison Operators

Comparative expressions evaluate to: 1 (TRUE) or 0 (FALSE). Any comparative expression containing a NULL will be treated as FALSE for the purposes of NULLIF, SKIPIF, and MISSINGIF clauses.

!= inequality
== equality
< less than
<= less than or equal to
> greater than
>= greater than or equal to


Logical Operators

! NOT

The NOT operator, when preceding another expression, inverts the expression.

Examples:
!(10==10) returns 0
!(10==5)
returns 1

&& AND Returns 1 (TRUE) if both sides of the expression are true; returns 0 (FALSE) if either side is false.

Examples: 
(10>5) && (5<10) returns 1 (TRUE)
(10>5) && (5>10) returns 0 (FALSE) 
(10<5) && (5>10) returns 0 (FALSE)

Note: Evaluation of equations containing && proceeds from left to right until a result is found.

|| OR Returns 1 (TRUE) if either side of the equation is true, and 0 (FALSE) if neither side is true.

Examples:
(10>5) || (5<10) returns 1 (TRUE) 
(10>5) || (5>10)
returns 1 (TRUE)
(10<5) || (5>10) returns 0 (FALSE) 

Note: Evaluation of equations containing | | proceeds from left to right until a result is found.



Conditional Operator

? : conditional statement Syntax:

(condition-statement) ? (if-true) : (if-false)

The (condition-statement) is evaluated; if it is TRUE, then the expression (if-true) is evaluated and returned as the value. If the (condition-statement) is FALSE, the expression (if-false) is evaluated and returned as the value. 

Examples: 
(10>5)?('true'):('false') returns 'true' 
(10<5)?(1900):(2000) returns 2000

 


Previous Topic:
Custom Library Functions
Chapter Index
Next Topic:
NDL++ Operator Precedence