The XPRESS language makes no distinction between a function call and what languages such as C refer to as an expression operator. This results in a syntactical style known as prefix notation. Prefix notation differs from the more common infix notation in that the operator of an expression is written first, followed by the operands. For example, consider the following simple logical expression written in C using infix notation:
x == 42
If C used prefix notation, the previous statement would be written:
== x 42
If C provided no expression operators and instead supplied only functions, the statement could be written as follows:
Prefix notation is easily understood if you think in terms of calling functions rather than writing expressions.
XPRESS uses an XML syntax that is easy to parse and manipulate and can be embedded naturally in other XML vocabularies used within Identity Manager. The names of the XML elements are the names of functions to be called. Nested elements are the arguments to the function. In addition, there are beginning and end tags for each element (in this case, <add></add>).
<add> <ref>counter</ref> <i>10</i> </add>
In the preceding example, the <add> element represents a call to the function named add. This function is passed two arguments:
first argument– value is determined by calling a function named ref. The argument to the ref function is a literal string that is assumed to be the name of a variable. The value returned by the ref function is the current value of the variable counter.
second argument– value is determined by calling a function named i. The argument to the i function is a literal string that is an integer. The value that the i function returns is the integer 10.
The value returned by the add function will then be the result of adding the integer 10 to the current value of the variable counter. Every function call either returns a value or performs an operation on one of its arguments. For example, if the ref call returns the value of the counter, then the <i> call returns the integer 10, and the <add> call returns the addition of the two calls.
Another example is the classic Hello World program, which is written in XPRESS as follows:
Although XPRESS can be used with a standalone interpreter, it is typically embedded within an application that wants to use XPRESS statements to control or customize their behavior. This application is called the host application. Two of the more important host applications within the Identity Manager system are workflow and forms.
The host application makes calls to the XPRESS interpreter and supplies services to the interpreter. One of the more important services that the host application provides is the resolution of external variable references. Expressions often reference variables that are not defined within the expression, and the host application must then provide the values of these variables. In the case of the workflow host application, an expression can reference any variable defined within the workflow process. In the forms host application, an expression can reference the value of any form field or defvar whose value is set before the expression is evaluated.
Expressions are used primarily for the following tasks:
Customizing the User Interface and Administrator Interface forms. Forms use XPRESS to control the visibility of fields and to transform the data to be displayed.
Defining flow of control in workflow. Workflow uses XPRESS to define transition conditions, which determine the order in which steps in the workflow process are performed.
For information on using expressions in workflow scripts or editing forms, see Chapter 1, Workflow.