Creating MDX views for the data source to a TI process in PAW
Posted: Tue Feb 21, 2023 10:12 am
Hi all,
The title sums it up I guess. For all application cubes, create a view that can be used in the Data source.
It should avoid issues with messed up variable orderings in PAW.
The title sums it up I guess. For all application cubes, create a view that can be used in the Data source.
It should avoid issues with messed up variable orderings in PAW.
Code: Select all
## Create an MDX view for the data source of TI processes
vColumn_Selections = '';
vRow_Selections = '';
vView = 'ZZZ_tmp';
cMDX_Template_View = 'SELECT ' | vColumn_Selections | ' ON 0, ' | vRow_Selections | ' ON 1 FROM [' | vCube | ']';
cMDX_Template_OneElement = '{[%vDimension%].[%vHierarchy%].[%vElement%]}';
c = 1;
While( c <= Dimsiz( '}Cubes' ));
vCube = Dimnm( '}Cubes', c );
If( Subst( vCube, 1, 1 ) @<> '}' );
# loop over the cube dimensions and add to the MDX view
vColumn_Selections = '';
d = 1;
While( d <= CubeDimensionCountGet( vCube ));
vDimension = Tabdim( vCube, d );
vHierarchy = vDimension;
vElement = ElementFirst( vDimension, vHierarchy );
If( d < CubeDimensionCountGet( vCube ));
vColumn_Selections = vColumn_Selections | If( d = 1, '', '*' ) | Expand( cMDX_Template_OneElement );
Else;
vRow_Selections = Expand( cMDX_Template_OneElement );
EndIf;
d = d + 1;
End;
vMDX = Expand( cMDX_Template_View );
ViewCreateByMDX( vCube, vView, vMDX );
EndIf;
c = c + 1;
End;