Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Prerequisites

Info

Below snippets assume data source and data target of the TI process are cubes with a mapping existing between each parallel enabled source dimension and equal target dimension, other dimensions might differ.

Note

The source pDimPar and equivalent target dimension have to have total rollup containing all leaf elements in their structure, the name of the total rollup root element must be Total <dimension name>.

Info

You should define a process parameter allowing entry of a filter expression for each parallel enabled source dimension.

  • Prolog (after parameter tests)

Code Block
# Elements to allocate to threads - always will be used even in case when parallelism is not required
If( sParFilter @= '' );
    # MDX that is used by default to drive parallelization set when no filter is specified
    sDimClrMDX = Expand( 'TM1FILTERBYLEVEL(DESCENDANTS([%sDimParClr%].[Total %sDimParClr%]), 0)' );
Else;
    # We need to provide MDX out of Bedrock style filter depending on the threadID
    sFind = sParFilter;
    nTokens = 0;
    sElemMDX = '';
    While( sFind @<> '' );
        nToken = SCAN( cElementDelim, sFind );
        nToken = IF( nToken = 0, LONG( sFind ) + 1, nToken );
        sToken = TRIM( SUBST( sFind, 1, nToken - 1 ));
        sElemMDX = sElemMDX | If( nTokens = 0, '', '+' ) | Expand( 'TM1FILTERBYLEVEL(DESCENDANTS([%pDimPar%].[%sToken%]), 0)' );
        sFind = DELET( sFind, 1, nToken );
        nTokens = nTokens + 1;
    End;
    If( nElementReplace <> 0 );
        sDimClrMDX = Expand( 'GENERATE(%sElemMDX%, FILTER(TM1SUBSETALL([%sDimParClr%]), [%pDimPar%].CurrentMember.Properties(''%sDimParClr% ID'') = [%sDimParClr%].CurrentMember.Name))' );
    Else;
        #Note: sDimParClr = pDimPar makes this possible
        sDimClrMDX = sElemMDX;
    EndIf;
EndIf;

sSubClrLen = cSubSrc | '_CLR_LEN';
ExecuteProcess('}bedrock.hier.sub.create.bymdx',
  'pDim', sDimParClr,
  'pSub', sSubClrLen,
  'pMDXExpr', sDimClrMDX,
  'pConvertToStatic', 1,
  'pTemp', cTemp
);
nElementsClr = SubsetGetSize( sDimParClr, sSubClrLen );