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
Idoc Script supports several operators. This section describes the following:
■
Section 2.5.1, Comparison Operators
■
Section 2.5.2, Special String Operators
■
Section 2.5.3, Numeric Operators
■
Section 2.5.4, Boolean Operators
2.5.1 Comparison Operators
Use the following comparison operators compare the value of two operands and return a true or false value based on the result of the comparison. These operators can
be used to compare integers and Boolean values in Idoc Script.
If you are using Idoc Script in an HCSP or HCSF page, you must use special comparison operators. For more information, see Oracle Fusion Middleware Developers
Guide for Oracle Universal Content Management.
These are numeric operators that are useful with strings only in special cases where the string data has some valid numeric meaning, such as dates which convert to
milliseconds when used with the standard comparison operators.
■
For string concatenation, string inclusion, and simple string comparison, use the Special String Operators
.
■
To perform advanced string operations, use strEquals
, strReplace
, or other string-related global functions.
Operator Description
Example
== equality
if 2 == 3 evaluates to false =
inequality if 2 = 3 evaluates to true
less than if 2 2 evaluates to false
= less than or equal
if 2 = 2 evaluates to true greater than
if 3 2 evaluates to true =
greater than or equal if 3 = 2 evaluates to true
Idoc Script Application 2-15
2.5.2 Special String Operators
Use the following special string operators to concatenate and compare strings:
For example, to determine whether the variable a has the prefix car or contains the substring truck, this expression could be used:
if a like car|truck
The like operator recognizes the following wildcard symbols:
Operator Description Example
The string join operator performs string concatenation. Use this operator to
create script that produces Idoc Script for a resource include.
include VariableInclude evaluates to:
include VariableName like
The string comparison operator compares two strings.
■
The first string is compared against the pattern of the second string.
The second string can use asterisk and question mark characters as
wildcards.
■
This operator is not case sensitive.
■
Evaluates to FALSE: if cart like car
■
Evaluates to TRUE: if cart like car?
■
Evaluates to TRUE: if carton like car
■
Evaluates to TRUE: if Carton like car
| The string inclusion operator separates
multiple options, performing a logical OR function.
Evaluates to TRUE: if car like car|truck|van
Important: To perform advanced string operations, use
strEquals ,
strReplace , or other string-related global functions. For a list, see
Strings on page 4-20.
Wildcard Description
Example
Matches 0 or more characters.
■
grow matches grow, grows, growth, and growing
■
car matches car, scar, and motorcar
■
so matches so, solo, and soprano ?
Matches exactly one character.
■
grow? matches grows and growl but not growth
■
grow?? matches growth but not grows or growing
■
b?d matches bad, bed, bid, and bud
2-16 Oracle Fusion Middleware Idoc Script Reference Guide
2.5.3 Numeric Operators