Oracle® OLAP DML Reference 10g Release 1 (10.1) Part Number B10339-02 |
|
|
View PDF |
The AGGMAP ADD or REMOVE model command adds or removes a model from a previously defined aggmap object of type AGGMAP. Models are used in aggmap objects to aggregate data over a non-hierarchical dimension (such as line items), which has no parent relation and therefore cannot be aggregated by a RELATION (for aggregation) statement. See MODEL (in an aggregation) for details.
Syntax
AGGMAP {ADD model TO aggmap|REMOVE model FROM aggmap}
Arguments
Temporarily adds a model to an aggmap object. The model is attached to the aggmap only for the duration of the session. Even when the analytic workspace has been updated and committed, the model is discarded from the aggmap when the session is closed.
Removes a model from an aggmap.
The name of the model object that you wish to add to the specified aggmap.
The name of a previously defined aggmap object of type AGGMAP.
Notes
Most aggmap objects are defined to calculate variable values that are dimensioned by permanent dimension members (that is, dimension members that persist from one session to another). However, users might wish to create their own aggregates at runtime for forecasting or what-if analysis, or just because they want to view the data in an unforeseen way. Adding temporary members to dimensions and aggregating data for those members is sometimes called creating temporary or custom aggregates.
Examples
Example 6-34 Temporarily Adding a Model to an Aggmap
Assume for example, that you have an aggmap object named letter.aggmap
with the following definition.
DEFINE LETTER.AGGMAP AGGMAP AGGMAP RELATION letter.letter PRECOMPUTE ('AA') END
Assume also that you want to create summarized variable data for the cells that are dimensioned by the dimension values AAB
and ABA
. However, you do not want this data to be permanently stored in the analytic workspace. You just want to see the data during your session.
To perform this type of aggregation, you can take the following steps:
Create a dimension value for the custom aggregate. This dimension value will be the parent of the dimension values AAB
and ABA
. The following statement adds 'BB
' to the letter
dimension:
MAINTAIN letter ADD 'BB'
Create a MODEL
object that contains an AGGREGATION
function, which associates child dimension values with the new dimension value. The following model identifies BB
as the parent of AAB
and ABA
. Note that the parent dimension value (in this case, BB) cannot already be defined as a parent in the parent relation (letter.letter
).
DEFINE LETTER.MODEL MODEL MODEL DIMENSION letter BB=AGGREGATION('AAB' 'ABA')
Execute an AGGMAP ADD
statement to append the model to the existing AGGMAP
object.
AGGMAP ADD letter.model TO letter.aggmap
The aggmap now looks like this.
DEFINE LETTER.AGGMAP AGGMAP AGGMAP RELATION letter.letter PRECOMPUTE ('AA') END AGGMAP ADD letter.model
The model is executed only by the AGGREGATE
function like the one shown here; the AGGREGATE
command ignores it.
REPORT AGGREGATE(units USING letter.aggmap)
When you wish to remove the model from the aggmap during a session, use the AGGMAP REMOVE
statement.
To ensure that your aggmap does not become a permanent object in the analytic workspace, before you close your session issue the following statement to delete the dimension values that you added in Step 1.
MAINTAIN letter DELETE 'BB'
When your session ends, Oracle OLAP automatically removes the model added using the AGGMAP ADD statement. You do not have to issue an explicit AGGMAP REMOVE statement.