eval

Evaluates a variable definition as if it were Idoc Script. Can be used to recursively evaluate a literal string.

Type and Usage

Parameters

The only parameter is a variable that defines a string to be evaluated as Idoc Script.

Output

Returns the parameter string, with any Idoc Script in the variable definition resolved.

Example

Variable one is assigned the string CompanyName, and variable two is assigned a string that includes variable one within Idoc Script delimiters. On a page, variable one presents the string CompanyName, variable two presents the string Welcome to <$one$> and eval(two) presents the string Welcome to CompanyName.

<$one="CompanyName"$>
<$two="Welcome to <$one$>"$>
<$one$><br>
<$two$><br>
<$eval(two)$>

Say you wanted to exclude all metadata fields that have the prefix xPrefix in their names. You could use the eval function to dynamically write and evaluate Idoc Script for this purpose:

<$loop DocMetaDefinition$>
<$if strIndexOf("xPrefix", dName) >= 0$>
    <$myScript = "<$" & dName & ":isExcluded=1$>"$>
    <$eval(myScript)$>
<$endif$>
<$endloop$>

See Also