I am fairly new to TM1 so please bear with my very newbie scripting and question.
We have a cube which has not been maintained for a long time. It has accumulated a lot of of dimension elements which contains no values in any of the cube measures (i'm talking millions).
I have been researching online and it seems there are many different ways to tackle this. The approach I am attempting at the moment is to assign an attribute of "delete" to the elements I want removed and then using the element delete function. I have created a subset to assign as source and have run an ASCII output and can confirm ASCIIoutput contains items i want to delete.
I ran my TI on one of the smaller consolidations as a tester which has 10 elements (5 bad ones).However the issue is when I execute the query - it just keeps running. I can't quite figure out where I am going wrong
Source data: Dimension Subset
Prolog:
Code: Select all
vDim= cDimSKU;
SbDim=cSubSource;
If(SubsetExists(vDim,SbDim)=1);
SubsetDestroy(vDim,SbDim);
EndIf;
SubsetCreate(vDim,SbDim);
#
i=1; k=1; Nb=DimSiz(vDim);
While(i<=Nb);
Member=DimNm(vDim,i);
If( Ellev(vDim,Member)=0 & Elisanc(vDim,Parent',Member)=1);
SubsetElementInsert(vDim,SbDim,Member,k);
k=k+1;
EndIf;
i=i+1;
End;
#=== Set Data Source
DatasourceType = 'SUBSET';
DatasourceNameForServer = cDimSKU;
DatasourceDimensionSubset = SbDim ;
Metadata:
Code: Select all
if(sSubstring > 0 & sTotalRev = 0 );
AttrPutS('Delete', cDimSKU, vVariable, vAttribute1, '', '');
else;
itemskip;
endif;
#
delete = AttrS(cDimSKU, vVariable, vAttribute1);
if(delete @= 'Delete' & sTotalRev =0);
AsciiOutput ( FilePath,vVariable, delete, NumberToString(sTotalRev));
DimensionElementDelete(cDimSKU, vVariable);
else;
itemskip;
endif;
Any help on this or suggestion for a better approach would be really appreciated
![Smile :)](./images/smilies/icon_e_smile.gif)