ViewCreateByMDX

ViewCreateByMDX creates a view with a specified MDX expression.

When the optional AsTemporary argument is set to 1, the view is temporary and persists only for the duration of the TurboIntegrator process or chore in which the view is created.

Note:

For TM1® Server version 11.2.0 and earlier, temporary views were visible and usable only by the process that created it and any of its child processes. Temporary views were not visible to the ancestor and sibling processes. You could create same-named views in sibling child processes with the same parent process.

For TM1 Server version 11.3.0 and later, these temporary views are visible to the ancestor and sibling processes. If a parent TurboIntegrator process A invokes two child TurboIntegrator processes A1 and A2, and the child TurboIntegrator process A1 creates a temporary view S, the temporary view S exists for the duration of the parent TurboIntegrator process A. You cannot create a temporary view with the same name S in the sibling TurboIntegrator process A2 since the view is visible and usable by siblings A1 and A2.

While a temporary view exists, the temporary view takes precedence over any same-named public view. If another TurboIntegrator function references a view that exists in both a temporary and permanent state, the function operates upon the temporary view.

Temporary objects have transaction scope. When a transaction is committed, all temporary objects are cleaned up. If a chore is run in single-commit mode where all processes in the chore are logically run within the context of one transaction, then temporary objects that are created in a process still exist, visible, and available for use, in subsequent processes run by the chore. However, in multi-commit mode, these processes are cleaned up at commit time of the transaction that wrapped the execution of the process that created the temporary object.

There is no locking associated with a temporary view, as a temporary view is never saved. This can result in improved performance because there is no need for TurboIntegrator to wait for locks to be released before operating upon a temporary view.

This function is valid in TM1 TurboIntegrator processes only.

Syntax

ViewCreateByMDX(Cube, ViewName, MDX_expression , <AsTemporary>);

Argument

Description

Cube

The parent cube of the view you are creating.

ViewName

The name you want to assign to the view.

MDX_expression

A string value containing a valid MDX view expression.

AsTemporary

This is an optional argument that specifies whether the view being created is temporary. 1 indicates a temporary view; 0 indicates a permanent view.

If this argument is omitted, the view is permanent.

Example

This example, based on the Planning Sample database, creates a temporary view named Account in the plan_BudgetPlan cube.


ViewCreateByMDX('plan_BudgetPlan', 'Account', 
    'select {[plan_version].[FY 2003 Budget]} on 0,
    {[plan_business_unit].[10300]} on 1 from plan_budgetplan where
    [plan_department].[200][plan_chart_of_accounts].[41101][plan_exchange_rates].[local][plan_source].[goal][plan_time].[Jan-2003]'
    ,1);