What functions can be used - to concatenate fields, to convert data, to check for errors? Two simple and powerful features of RES-Reach make them mostly unnecessary: recursive evaluation of variables and nested SQL queries.
Rather than inventing a new set of functions and operators for you, you can use the ones you are most familiar with: the ones from your favourite database language. Simply put the operation into the SQL element of a DATA tag, and your results are available as a virtual database field. For example:
<DATA SQL="SELECT TOP 1 (ISDATE('{Date1}')) AS VAL1, (ISDATE('{Date2}')) AS VAL2, (VAL1 AND VAL2) AS ALL_VALID FROM Dummy;", DATABASE="dummy.mdb", CONNECT="", MODE="READONLY", ALIAS="Valid"> <RECORD> <IF VARIABLE="{[Valid.ALL_VALID]}" OPERATOR="NE" COMPARISON="0"> <!-- All fields are OK --> ... </IF> </RECORD> </DATA>
Another method is to use string concatenation to test for values. For instance:
<IF VARIABLE=";{Fld1};" OPERATOR="SS" COMPARISON=";;0;{Unknown};"> <![ Fld1 is not valid ]> ... </IF>
Yet another is to use recursive evaluation of variables. For instance, suppose that you have the following constants defined in the [VARIABLES] section of the NETBASE.INI file:
CHECKED:-0=
CHECKED:-1=CHECKED
You can concatenate a variable that evaluates to a boolean value (‘0’ or ‘1’) to the string "CHECKED:-" to determine which of the two variables will be replaced into the tag: the empty string or the one that says "CHECKED":
<INPUT TYPE="CHECKBOX" NAME="Box1" {CHECKED:-{[Currently_Selected]}}>
A note of caution: make sure that your user can not send a full variable name as a string that is then recursively evaluated; a malicious user could then get read or write access to variables or fields to which you did not intend to allow access. There are a number of features in the parser that limit the degree to which this type of syntax may be used.