Previous ION Script User's Guide: ION Script Tag Reference Next

ION_EVALUATE

The ION_EVALUATE tag evaluates expressions inside an ION Script document. It can simply evaluate an expression or output the result of the expression into the resulting document.

Syntax

<ION_EVALUATE
EXPR="expression"
[DISPLAY={"TRUE" | "FALSE"}]
[FORMAT="format string"] />

Attributes

EXPR

The expression to be evaluated by the parser. This attribute can contain a variable. See Variables, Expressions & Operators for details on writing ION Script expressions.

Note that the way you declare a variable is different from the way you use ION_EVALUATE to assign a value to a variable. When declaring a variable with VARIABLE_DECL, you do not prefix the variable name with the $ symbol. When you assign a variable a value using ION_EVALUATE, you do prefix the variable name with the $ symbol, regardless of whether or not the variable has already been declared. For example:

<ION_EVALUATE EXPR="$Temperature = 98.6"/>  

 


Warning
Assigning $Browser.REMOTE_USER as a string variable to the VALUE attribute can be dangerous because it is frequently an undefined system variable. When VALUE is undefined, IDL reports an error. However, it is possible that code that uses $Browser.REMOTE_USER could be implemented and tested without error on one system and fail if ported to another system.

DISPLAY

Determines whether or not to display the result of the expression in the outputted HTML page. The default value is FALSE.

FORMAT

Specifies the C-style printf() formatting string. The syntax for the FORMAT attribute is as follows:

FORMAT="%[flags][width][.precision][type length] specifier"

where

flags is one or more of the following characters:

Table 5-4: Format Flags 

Table 5-4: Format Flags 
Flag
Description
space
Precede the result with a space
-
Left-justify the result within the field if width is specified
+
Precede the result with a sign (+ or -). The default is to display only a minus sign.
#
  • If specifier is o, precede result with "0"
  •  

  • If specifier is x, precede result with "0x"
  •  

  • If specifier is X, precede result with "0X"
  •  

  • If specifier is e, E, f, g, G, the decimal point is always present in the result, even if no digits follow the decimal
  •  

  • If specifier is g, G, trailing zeros will display
0
Pad the result with leading zeros (if the specified width is greater than the width of the result).

width is an integer specifying the minimum field width. If the result has fewer characters than the field width, it is padded on the left (or right, if the - flag has been specified). The padding is done with spaces unless the first character of width is a zero, in which case the padding is done with zeros.

precision is an integer preceded by a decimal point specifying the minimum number of digits to appear for the d, o, or x format specifiers, or the maximum number of characters to be printed for the s format specifier. It is also the precise number of digits to display after the decimal (including trailing zeros) for the e, E, f, g, or G specifiers.

type length is one of the following:

Table 5-5: Type Length 

Table 5-5: Type Length 
Type Length
Description
h
For d, i, o, u, x or X specifiers: value is treated as a short or unsigned short.
l (lower case L)
The value is treated as a long or unsigned long
L
The value is treated as a long double

specifier is one of the following:

Table 5-6: ION Variable 

Table 5-6: ION Variable 
ION Variable Type
Valid Specifiers
BOOL, STRING
%s
INT
%d, %i, %o, %u, %x, %X
DOUBLE
%e, %E, %f, %g, %G


Note
For more information on using format specifiers, refer to a C programming manual.

HTML Mapping

The ION_EVALUATE tag inserts the result of EXPR directly into the HTML stream if DISPLAY="TRUE". If DISPLAY="FALSE", no HTML output is produced.

  IDL Online Help (March 06, 2007)