Idoc Script Application 2-13
2.4.1.1 exec Keyword
The exec keyword executes an Idoc Script expression and suppresses the output does not display the expression on the page. It is primarily used to set variables without
writing anything to the page.
In earlier versions of Idoc Script, the exec keyword was required to suppress the value of any variable from appearing in the output file. In the current version, the
exec keyword is needed only to suppress an expression from appearing in the output.
For example, the first line below is equivalent to the last two lines: varA=stringA, varB =stringB
exec varA=stringA exec varB=stringB
For more information, see exec
.
2.4.1.2 eval Function
The eval function evaluates an expression as if it were actual Idoc Script. In the following example, a variable named one is assigned the string Company
Name, and a variable named two is assigned a string that includes variable one. one=Company Name
two=Welcome to one onebr
twobr evaltwo
In the page output, variable one presents the string Company Name, variable two presents the string Welcome to one, and the function evaltwo presents the
string Welcome to Company Name.
Note that the string to be evaluated must have the Idoc Script delimiters around it, otherwise it will not be evaluated as Idoc Script.
Also note that too much content generated dynamically in this manner can slow down page display. If the eval function is used frequently on a page, it may be more
efficient to put the code in an include and use the inc Function
in conjunction with the eval function.
For more information, see eval
.
2.4.1.3 include Keyword
The include keyword is the standard way in which chunks of code are incorporated into the current page. Because include is a keyword, it cannot take a variable as a
parameter-the parameter must be the name of an include that already exists.
For more information, see Chapter 2.3.1, Includes
and include
.
2.4.1.4 inc Function
The inc function does the same thing as the include keyword, except that it can take a variable as the parameter. This function is most useful for dynamically changing
which include will be used depending on the current value of a variable.
2-14 Oracle Fusion Middleware Idoc Script Reference Guide
For example, say you want to execute some Idoc Script for some, but not all, of your custom metadata fields. You could dynamically create includes based on the field
names such as specific_include_xComments by executing this Idoc Script:
loop DocMetaDefinition myInclude = specific_include_ dName
exec incmyInclude endloop
Note the use of the exec Keyword
, which suppresses the output of the include specified by the inc function. If you do not use exec before the inc function, the
HTML inside the specified include will be displayed on the page. Note that if the specific_include_xComments does not exist, this code will not
throw an error because the output is not being displayed. For more information, see
inc .
2.5 Operators