Conditional Processing Construct

The conditional processing construct of the Logic Template is used to determine whether or not a series of commands and assignments are to be processed. A conditional processing construct consists of an IF (x) statement (where x is a numerical expression to be evaluated), as the only item on a line, followed by one or more commands and/or assignments that are to be processed if the numerical expression x evaluates to anything other than zero, and an ENDIF statement, also as the only item on a line.

When the IF (x) statement is encountered, the expression x is evaluated as a numeric expression. If the expression evaluates to zero, everything after the IF (x) statement up to the matching ENDIF statement is ignored. If the expression evaluates to anything other than zero, everything after the IF (x) statement up to the matching ENDIF statement is processed. When the matching ENDIF statement is encountered, processing continues as it had before the IF (x) statement was encountered.

Multiple levels of nested parenthesis are supported within the numerical expression x. Within each pair of parenthesis can be any number of operands connected by any of the operators. Evaluation of the numerical expression x proceeds from the inner-most level of parenthesis outward, and then from left to right within each level. There is no precedence assigned to the operators.

Conditional processing constructs may be nested to any level and may be contained within and contain multiple choice constructs.

Format
IF
( cond )

list

ENDIF

Item

Description

cond

The condition to be evaluated.

list

List of commands and assignments to process if cond evaluates to anything other than 0.

Example
Use nested conditional processing constructs to select geo-spatial processing of the results from a search request.

//Sort results by distance from a location if a set of coordinates has been loaded
//into the variable "Center"

IF ( Center )

IF ( 0 < Radius )

GeoRadialSearch( RESTRICTIVE, LocIndex, Center, Radius, 1, 0, MILES );

GeoCircFilter( CIRC_AND_INT, Field_X, Field_Y, Center, Radius, MILES );

ENDIF

GeoSpatialSort( Field_X, Field_Y, Center, 1 );

ENDIF