#set TITLE = CONDEX
#include top

#if @PL != 1
.SH NAME
condex
#endif

#include space

.SH CONDITIONAL EXPRESSIONS
Conditional expressions use a simple syntax made up of operators such as \fC=\fR and \fC!=\fR,
operands, and logical connectors such as \fC&&\fR and \fC||\fR.  
Operands may be literal numeric, alphanumeric, or text string values,
@variables, data field @numbers, or
#set FILE = functions.html
#set TAG = functions
#include link
\0.  In 
#set FILE = scripts.html
#set TAG = scripts
#include link
, literal string operands may be enclosed in double quotes (").
Parentheses have no special meaning in these expressions as there is
no hierarchy of presidence.
.LP

#if @PL = 1
\fBNote:\fR in ploticus \fB#if\fR statements, variables should
be preceded by one at-sign (@).  In \fBselect\fR attributes
or \fBgetdata filter\fR, variables should be preceded by two at-signs (@@@@).
#endif //PL

#include space

.SH EXAMPLES
.LP
- In a 
#set FILE = scripts.html
#set TAG = "script
#include link
, see if the value of the variable @SUM is greater than 100: 
.nf
	\0#if @SUM > 100
	...
	\0#endif
.fi
.LP
- Another example:
.nf
	\0#if @SUM > 100 && @STATUS = s
.fi
.LP
- Check to see if @description has any contents:
.nf
	\0#if $len(@description) > 0
.fi
.LP
- Check to see if @val is a valid number:
.nf
	\0#if $isnumber(@val) = 1
.fi
.LP
- See if @C does not countain a double quote:
.nf
	\0#if @C != "\\""
.fi
.LP
#if @TDH = 1
.LP
- Use the 
#set FILE = recsel.html
#set TAG = "recsel(1) command
#include link
to find data records where field 3 is either A, B, or C and field 4 greater than 80:
.nf
	cat myfile | recsel "@@3 in A,B,C && @@4 > 80"
.fi
.LP
- Use the 
#set FILE = recsel.html
#set TAG = "recsel(1) command
#include link
to find records having a lastname field beginning with \fCGr\fR: 
.nf
	cat myfile | recsel -r people "@lastname like Gr*"
.fi
#endif //TDH
.LP
Conditional expression for finding lastname beginning with \fCGr\fR, \fCGu\fR or \fCGy\fR:
.nf
	@lastname inlike Gr*,Gu*,Gy*
.fi

#include space

.SH OPERANDS
Operands may be 
.IP \(bu
@variables 
#if @CGIPAL != 1
.IP \(bu
@field numbers, e.g. @@1 = first data field
#endif
.IP \(bu
Literal values (numbers, alphanumerics, text strings, 
#set FILE = commalist.html
#set TAG = commalists
#include link
)
.IP \(bu
#set FILE = functions.html
#set TAG = Functions
#include link
.LP
In 
#set FILE = scripts.html
#set TAG = scripts
#include link
, literal alphanumeric, text string, or 
#set FILE = commalist.html
#set TAG = commalist
#include link
operands may be enclosed in double quotes (");
no variable evaluation occurs inside quoted strings.

#include space

.SH COMPARISON OPERATORS
.IP
.nf
\fB= \fR	Equal to.  This is case sensitive for strings. 
\fB!=\fR	Not equal to. 
\fB> \fR	Greater than.
\fB>=\fR 	Greater than or equal to. 
\fB< \fR 	Less than. 
\fB<=\fR 	Less than or equal to. 
.fi
.IP
If at least one operand is non-numeric, comparison
operators such as > will do an ascii value comparison.
.LP
\fBWild card matching\fR:  Wild card matching may be done
using \fBlike\fP.  Wild card characters are \fB*\fR which matches
any number of any character, and \fB?\fR which matches a single
instance of any character.  This matching is case-insensitive.
.IP
.nf
\fBlike\fR	Wild card match.  Example: \fChello like h*\fR (true)
\fB!like\fR	Not a wild card match.
.LP
\fBCommalist operators\fP: these take a
#set FILE = commalist.html
#set TAG = "commalist
#include link
on the right side.
By default, lists are delimited using commas.  If this is not convenient,
the list delimitation character may be changed using
#set FILE = control
#set TAG = "#control listsep
#include link
\0.
.IP
.nf
\fBin\fR	Member of list.  Example: \fCz in x,y,z\fR (true)
\fB!in\fR	Not a member of list. (Alt: \fBni\fR)
\fBinlike\fR 	Same as \fBin\fP but wild card matching is used.
		(Wild cards may be used in list members.)
\fB!inlike\fR	Same as \fB!in\fP but wild card matching is used.
.fi

#include space

.SH LOGICAL CONNECTORS
Individual conditional expressions may be connected together using
logical AND (\fB&&\fR) or OR (\fB||\fR).
An entire expression may be negated by putting \fBnot:\fR at the beginning
of the expression.
.LP
Because parentheses may not be used to establish presidence
mixing AND and OR in the same expression requires care.
When the expression is parsed, it is first
split into OR terms, then each of the OR terms is split into AND terms.
For example: \fCA = B and C = D or E = E of F = G\fR would evaluate to true,
because it is interpreted as if it were written 
\fC(a = B and C = D) or (e = e) or (f = g)\fR.
It may be best to avoid mixing AND and OR in the same expression 
and use multiple expressions instead.

#include space

.SH LIMITATIONS AND BUGS
.LP
Because parentheses may not be used to establish presidence,
the mixing of AND and OR in the same expression is problematic (see above).

#include bottom
