Quickly delete elements from a hierarchy
Posted: Wed Sep 14, 2022 2:26 pm
Rather than code like this:
Consider:
Code: Select all
## Delete consolidated elements
####
iLoop=DIMSIZ(pDim);
WHILE(iLoop>=1);
vElement=DIMNM(pDim,iLoop);
IF(ELLEV(pDim,vElement)>=1);
DimensionElementDelete(pDim,vElement);
ENDIF;
iLoop=iLoop-1;
END;
iLoop=DIMSIZ(pDim);
WHILE(iLoop>=1);
vElement=DIMNM(pDim,iLoop);
IF(DTYPE(pDim,vElement)@='C');
DimensionElementDelete(pDim,vElement);
ENDIF;
iLoop=iLoop-1;
END;
Code: Select all
vDim = 'Customer';
vMDX = 'Except( TM1SubsetAll([' | vDim | ']), TM1FilterByLevel( TM1SubsetAll([ ' | vDim | ']), 0 ))';
SubsetCreateByMDX( 'tmp_', vMDX, vDim, 1 );
DimensionDeleteElements( vDim, 'tmp_' );