Purpose
The HTML IF statement performs conditional string processing and is used in the HTML part of the Net.Data macro. You can use the HTML IF statement in the HTML block, the REPORT block, and the ROW block. Numeric values are treated as strings for comparisons.
Syntax
+-----------------------+
V |
>>-%if--| condition list |-----+--------------------++---------->
+-exec_sql statement-+
+-variable reference-+
+-function call------+
+-string-------------+
+-HTML statement-----+
>--| else_if spec |--%endif------------------------------------><
condition list
|--(--+-(--condition list--)----------------+-)----------------|
+-condition list--&&--condition list--+
+-condition list--||--condition list--+
+-!--condition list-------------------+
+-| condition |-----------------------+
+-| term |----------------------------+
condition
|--term--+-<--+-term-------------------------------------------|
+->--+
+-<=-+
+->=-+
+-!=-+
+-==-+
term
|--+-variable reference-+--------------------------------------|
+-"--string--"-------+
+-variable name------+
else_if spec
|--+----------------------------------------------------------------+->
| +-------------------------------------------------------+ |
| | +-----------------------+ | |
| V V | | |
+--+--%elif--(--condition_list--)----+--------------------++-+-+-+
| +-exec_sql statement-+ |
| +-variable reference-+ |
| +-function call------+ |
| +-string-------------+ |
| +-HTML statement-----+ |
| +-----------------------+ |
| V | |
+-%else----+--------------------++--------------------------+
+-exec_sql statement-+
+-variable reference-+
+-function call------+
+-string-------------+
+-HTML statement-----+
>--------------------------------------------------------------|
Parameters
Context
Can be found in these contexts:
Restrictions
Can contain these elements:
Examples
Example 1:
%IF ($RETURN_CODE) == $(failure_rc)) <P> The function call failed with failure code $(RETURN_CODE). %ELIF ($(RETURN_CODE) == $(warning_rc)) <P> The function call succeeded with warning code $(RETURN_CODE). %ELIF ($(RETURN_CODE) == $(success_rc)) <P>The function call was successful. %ELSE P>The function call returned with unknown return code $(RETURN_CODE). %ENDIF
Example 2:
%IF (name == "world!") <H2>Hello world!</H2> %ENDIF