Skip Headers

Oracle® OLAP DML Reference
10g Release 1 (10.1)

Part Number B10339-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

$NATRIGGER

The $NATRIGGER property specifies values to substitute for NA values that are in the object, but not in the session cache for the object (if any). To calculate the values, Oracle OLAP takes the steps described in "How Oracle OLAP Calculates Data for a Variable with NA Values". The results of the calculation are either stored in the variable or cached in the session cache for the variable as described in "How Oracle OLAP Determines Whether to Store or Cache Results of $NATRIGGER".


See:

The PROPERTY command for general information on using properties in the OLAP DML.

Syntax

You add or delete a $NATRIGGER property to the most recently defined or considered object (see DEFINE PROGRAM and CONSIDER) using a PROPERTY statement with the following syntax.

PROPERTY {addproperty | deleteproperty}

where

Arguments

value

A TEXT expression that is the value of the property. The text can be any expression that is valid for defining a formula

DELETE $NATRIGGER

Deletes the $NATRIGGER property.

Notes


How Oracle OLAP Calculates Data for a Variable with NA Values

When calculating the data for a dimensioned variable, Oracle OLAP takes the following steps for each cell in the variable:

  1. Is there is a session cache for the variable.

    • Yes. Go to step 2.

    • No. Go to step 3.

  2. Does that cell in the session cache for the variable have an NA value.

    • Yes. Go to step 3.

    • No. Go to step 7.

  3. Does that cell in variable storage have an NA value.

    • Yes. Go to step 4.

    • No. Go to step 7.

  4. Does the variable have an $AGGMAP property?

    • Yes. Aggregate the variable using the aggmap specified for the $AGGMAP property and, then, go to step 5.

    • No. Go to step 6.

  5. What is the value of the cell after aggregating the variable?

    • NA, go to step 6.

    • Non-NA, go to step 7.

  6. Does the variable have a $NATRIGGER property?

    • Yes. Execute the expression specified for the $NATRIGGER property and, then, go to step 7.

    • No. Go to step 7.

  7. Calculate the data.


Setting the $NATRIGGER Property on Objects that are not Dimensioned Variables

When you set the $NATRIGGER property on an object that is not a dimensioned variable, including a single-cell variable, then Oracle OLAP treats it as any other user-assigned property with no special meaning for NA values


Making NA Triggers Recursive or Mutually Recursive

You can make NA triggers recursive or mutually recursive by including triggered objects within the value expression. You must set the RECURSIVE option to YES before a formula, program, or other $NATRIGGER expression can invoke a trigger expression again while it is executing. For limiting the number of triggers that can execute simultaneously, see the TRIGGERMAXDEPTH option.


Using $NATRIGGER with Composites

You can set an $NATRIGGER expression on a variable that is dimensioned by a composite, but Oracle OLAP evaluates the $NATRIGGER expression only for the dimension-value combinations that exist in the composite. Suppose you had the following dimensions and variables defined.

DEFINE d1 DIMENSION INTEGER
DEFINE d2 DIMENSION INTEGER
DEFINE v1 DECIMAL <d1 d2>
DEFINE v2 DECIMAL <SPARSE <d1 d2>>
PROPERTY '$NATRIGGER' 'v1 + 500.0'
DEFINE v3 DECIMAL <SPARSE <d1 d2>>

The following statement is an example of looping over a composite.

v3 = v2 ACROSS <SPARSE <d1 d2>>

$NATRIGGER Takes Precedence over NAFILL or NA Options

Oracle OLAP evaluates an $NATRIGGER property expression before applying the NAFILL function or the NASKIP, NASKIP2, or NASPELL options. When the $NATRIGGER expression is NA, then the NAFILL function and the NA options have an effect.


$NATRIGGER Ignored by EXPORT, ROLLUP, and AGGREGATE

The ROLLUP command, AGGREGATE command, and the AGGREGATE function ignore the $NATRIGGER property setting for a variable during a rollup operation. The statements fetch the stored value only, and do not invoke the $NATRIGGER expression. The $NATRIGGER property remains in effect for other operations.

In executing an EXPORT (to EIF) command, Oracle OLAP does not evaluate the $NATRIGGER property expression on a variable when it simply exports the variable. However, Oracle OLAP does evaluate the $NATRIGGER property expression when the variable is part of an expression that Oracle OLAP calculates during the export operation. Suppose you had the following d1 dimension and v1 variable definitions.

DEFINE d1 INTEGER DIMENSION
MAINTAIN d1 ADD 2
DEFINE v1 DECIMAL <d1>
PROPERTY '$NATRIGGER' '500'

For the following statement, Oracle OLAP would not evaluate the $NATRIGGER property expression for the v1 variable. It would export the $NATRIGGER property as part of the description of the variable. The value in v2 would be NA.

EXPORT v1 AS v2 TO EIF FILE 'myeif.eif'

For the following statement, Oracle OLAP would evaluate the $NATRIGGER property expression for the v1 variable. The value in v1plus1 would be 501.

EXPORT v1 + 1 AS v1plus1 TO EIF FILE 'myeif.eif'

Examples

Example 6-5 Triggering Aggregation Using an $NATRIGGER

Instead of specifying the AGGREGATE function in every statement that you want to return aggregate data, you use the $NATRIGGER property to cause the aggregation to occur when a cell in the variable has an NA value. To use $NATRIGGER for this purpose, assign an $NATRIGGER property to the variable with a call to the AGGREGATE function specified as the $NATRIGGER expression.

The following statements add the $NATRIGGER property to the sales variable, so that unsolved data is aggregated using the sales.aggmap aggmap.

CONSIDER sales
PROPERTY '$NATRIGGER' 'AGGREGATE(sales USING sales.aggmap)'

Example 6-6 Adding an $NATRIGGER Property to a Variable

The following statements define a dimension with three values and define a variable that is dimensioned by the dimension. They add the $NATRIGGER property to the variable, then put a value in one cell of the variable and leave the other cells empty so their values are NA. Finally, they report the values in the cells of the variable.

DEFINE d1 INTEGER DIMENSION
MAINTAIN d1 ADD 3
DEFINE v1 DECIMAL <d1>
PROPERTY '$NATRIGGER' '500.0'
v1(d1 1) = 333.3
REPORT v1

The preceding statements produce the following output.

D1            V1
--------- ----------
        1     333.3
        2     500.0
        3     500.0