Creating temporary views
Creating temporary viewswhen creating views from the cube viewer, there is a hard limit to the size of the view displayed. It is 100MB (32bit) or 500MB (64bit) by default, it chan be changed with the MaximumViewSize parameter in the tm1s.cfg
But it is not practical to generate such large views manually.
An alternative is to do it from the Turbo Integrator:
- create a new TI process
- select "TM1 Cube view import"
- click browse
- select the cube
- click create view
from there you can create any view
however it can be more advantageous to create and delete views on-the-fly so your server is cleaner and users will be less confused.
The following code generates a view from the cube 'MyCube' including all elements of the cube.
You need to add some SubsetCreate/SubsetElementInsert in order to limit the view
/!\ remove all consolidations, in most cases they interfere with the import and you will get only a partial import or nothing at all.
--------prolog
CubeName = 'MyCube';
ViewName = 'TIImport';
SubsetName = 'TIImport';
i = 1;
#loop through all dimensions of the cube
while (tabdim(CubeName,i) @<> '');
ThisDim = tabdim(CubeName,i);
If(SubSetExists(ThisDim, SubsetName) = 0);
StringMDX = '{TM1FILTERBYLEVEL( {TM1SUBSETALL( [' | ThisDim | '] )}, 0)}';
#create a subset filtering out all hierarchies
SubsetCreatebyMDX(SubsetName,StringMDX);
EndIf;
i = i + 1;
end;
If(ViewExists(CubeName, ViewName) = 0);
ViewCreate(CubeName, ViewName);
Endif;
i = 1;
#loop through all dimensions of the cube
while (tabdim(CubeName,i) @<> '');
ViewSubsetAssign(CubeName, ViewName, tabdim(CubeName,i), SubsetName);
i = i + 1;
end;
ViewExtractSkipCalcsSet (CubeName, ViewName, 1);
ViewExtractSkipZeroesSet (CubeName, ViewName, 1);
--------------epilog
#cleanup view
ViewDestroy(CubeName, ViewName);
i = 1;
#loop through all dimensions of the cube
while (tabdim(CubeName,i) @<> '');
SubsetDestroy(tabdim(CubeName,i), SubsetName);
i = i + 1;
end;