Oracle Waveset 8.1.1 Deployment Reference

Variables and Function Definition Expressions

Use the following functions to reference and define variables and functions within expressions.

ref Function

References the value of a variable. The variable can either be an external variable supported by the host application or an internal variable defined with <defvar>.

Example 1

<ref>waveset.role</ref>

Example 2

<defvar name=’milk’><s>milkvalue</s></defvar>
<defvar name=’shake’><s>milk</s></defvar>
<ref><ref>shake</ref>

evaluates to <s>milkshake</s>

defvar Function

Defines a new variable. The variable can then be referenced by any expression within and below the containing expression in which the variable was defined. The variable must be given a name using the XML attribute name.

A defvar statement should not reference itself. If it does, it will cause a loop.


Note –

Avoid the following constructions.

<defvar name=’fullname’>
   <ref>fullname</ref>
</defvar>

or

<defvar name=’counter’/>
   <add><ref>counter</ref>
      <i>0</i>
   </add>
</defvar>

Example 1

The following expression defines a variable and initializes its value to a list of two elements.

<defvar name=’theList’>
  <list>
     <s>apples</s>
     <s>oranges</s>
  </list>
</defvar>

Example 2

The following expression defines a variable and initializes its value to the integer zero.

<defvar name=’counter’>
   <i>0</i>
</defvar>

defarg Function

Defines an argument within a function defined with <defun>. Arguments are similar to variables, but they must be defined in the order in which arguments are passed to the function.

Example

<defarg name=’arg1’/>
<defarg name=’arg2’/>

defun Function

Defines a new function. The <defarg> function must be used to declare the arguments to a function. Use the <call> function to execute the function. Functions are typically defined within forms.

Example

<defun name=’add100’>
   <defarg name=’input’/>
    <add>
       <ref>input</ref>
       <i>100</i>
    </add>
</defun>

call Function

Calls a user-defined function. The arguments to call are assigned to arguments with <defarg> in the so-called function. The order of the call arguments must match the order of the <defarg>s. In previous releases, the call function could be used to call rules. Now, use the rule function for that purpose.

Example

The following expression returns 142.

<call name=’add100’>
   <i>42</i>
</call>

rule Function

Calls a rule. The arguments to rule are passed by name using the argument element. The value of an argument can be specified with the value attribute if it is a simple string. The argument value can also be calculated with an expression by omitting the value attribute and instead writing an expression within the body of the argument element.

A <rule> element can also call another rule that dynamically calculate the name of another rule to call.

For more information on creating or calling rules in forms and workflows, see the chapter titled Rules.

Examples

The following expression returns the employee ID of the designated user.

<rule name=’getEmployeeId’>
    <argument name=’accountId’ value=’maurelius’/>
</rule>

<rule name=’getEmployeeId’>
   <argument name=’accountId’>
       <ref>username</ref>
   </argument>
</rule>

The following expression calls another rule that calculates the returned value.

<rule>
    <cond>
      <eq><ref>var2</ref><s>specialCase</s></eq>
      <s>Rule2</s>
      <s>Rule1</s>
    </cond>
    <argument name=’arg1’>
      <ref>variable</ref>
    </argument>
</rule>