The eval statement

The eval statement is used to evaluate the value of a variable or a column within a record, and if necessary, convert it into another data type.

In stitchers, eval statements are used in combination with OQL to extract values from records in one database and insert those values into another database. The eval statement is used to evaluate specified fields within database records and assign those fields to variables or other database columns, if necessary.

Syntax

The evaluation declaration evaluates a given variable or database record and extracts it to a specified data type.

eval ( datatype , string_or_database_column )

Where

  • The first argument supplied to the eval statement is the data type into which the second argument is converted. The data type can be any of the OQL data types, such as text, int, list type text, or object type vblist. You can also use the multibyte data type to indicate data that might contain multibyte data. The multibyte data type is only available for use in eval statements and is not an OQL data type.

  • The second argument is the expression that is to be evaluated, which can include:
    • Variable references, that are preceded by a dollar sign. You can reference global variables like $HOSTNAME, product-specific-defined variables such as $BaseEntity, and all the environment variables of the shell within which the Network Manager processes are running, for example, the installation directory.
    • References to database columns known to the current scope or outside the current scope that are preceded by the appropriate number of ampersands. If the database column refers to an object, an entry within the object can be extracted using the target identifier ->.
    • A manipulative statement that can be used to modify complex data types (such as lists or objects), concatenate two items together, delete items from a list, and perform other functions.
    • A special expression using the THIS keyword to move in and out of the data containment model.
    • Combinations of multiple evaluation expressions.

Example

The example shows an eval statement which uses OQL.

m_CompareDb = eval( text, '&m_Creator' )
insert into kernel.activeModel values (eval( text, "$RECORD" ))
delete from kernel.activeModel where (ObjectId=eval ( text, "&ObjectId" ))