SubsetCreateByMDX
SubsetCreateByMDX creates a public subset based on a passed MDX expression.
When the AsTemporary
argument is set to 1, the subset is temporary and persists
during the TurboIntegrator process or a single-commit chore in which the subset is created. If a
parent TurboIntegrator process invokes child TurboIntegrator processes by using the
ExecuteProcess
or ExecuteProcessWithReturn
function, and the
temporary subset is created in one of these child TurboIntegrator processes, the subset persists
during the parent TurboIntegrator process.
This function is valid in TM1® TurboIntegrator processes only.
For TM1 Server version 11.2.0 and earlier, temporary views and subsets were visible and usable only by the process that created it and any of its child processes. Temporary views and subsets were not visible to the ancestor and sibling processes. You could create same-named subsets in sibling child processes with the same parent process.
For TM1 Server version 11.3.0 and later, these temporary subsets 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 subset S, the temporary subset S exists for the duration of the parent TurboIntegrator process A. You cannot create a temporary subset with the same name S in the sibling TurboIntegrator process A2 since the subset is visible and usable by siblings A1 and A2.
A chore is a special case of a parent TurboIntegrator process that invokes a child TurboIntegrator process. You can use two types of chores.
- Single-commit
- Within the scope / execution tree of a single-commit chore, a temporary subset of the same name can be created only for one child TurboIntegrator process.
- Multi-commit
- Within the scope / execution tree of a multi-commit chore, which commits after every child TurboIntegrator process, every child TurboIntegrator process can create a temporary subset of the same name because a temporary subset will not persist after a commit.
While a temporary subset exists, the temporary subset takes precedence over any same-named public or private subset. If another TurboIntegrator function references a subset that exists in both a temporary and permanent state, the function operates upon the temporary subset.
There is no locking associated with a temporary subset because a temporary subset 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 subset.
Syntax
SubsetCreateByMDX(SubName, MDX_expression, DimName, 1)
Argument |
Description |
---|---|
SubName | The name that you want to assign to the subset. |
MDX_expression | An MDX expression that returns a subset. |
DimName | The dimension name. Specify the dimension name to avoid errors if the subset that is being created is empty. |
AsTemporary | This is an optional argument that specifies whether the subset that is being
created is temporary. 1 indicates a temporary subset. 0 indicates a permanent subset. If this argument is omitted, the subset is permanent. |
Example
This example creates a temporary subset based on an MDX expression that returns a subset that consists of all the dimensions whose names start with "plan_".
SubsetCreatebyMDX ( SubName , '{TM1FILTERBYPATTERN( {TM1SubsetALL( [ "| DimName |" ] )}, “plan_.*” )}' ,1);
This example returns an empty set as the MDX tries to create a subset that consists of Engine size of 2.0 models. Since only models with an Engine size of 1.6 or 1.8 exist, an empty set returns.
SubsetCreatebyMDX ( SubName , '{FILTER({TM1SUBSETALL([model])}, [model].[Engine Size] = "2.0")}', 'model', 1);
Example of temporary subset used by parent process
In this example, two processes are created. The parent process, Process-A, calls the child process, Process-B. Process-B creates a temporary subset that Process-A uses as the data source.
Process-A/prolog:
ExecuteProcess('Process-B');
DatasourceDimensionSubset = 'My2003Months';
Process-B/prolog:
SubsetCreateByMdx('My2003Months', '{Descendants([plan_time].[plan_time].[2003], 3, LEAVES)}', 1);