Creating a subset with a while loop
Posted: Mon Sep 14, 2020 12:57 pm
Hey guys, I have created filtered subsets using the code below (i am new to tm1 so it may be somehwat sloppy)
I was wondering if there is a way i could do this using a while loop?
I was wondering if there is a way i could do this using a while loop?
Code: Select all
IF(vCatDir @= 'Filter by Category' % Scan ('*',vCatDIR) =1);
ITEMSKIP;
ENDIF;
sSub ='zzzCD-CAT'| vCatDIR;
#=====Create Subset For CATDIR ----> Cat====
smdx = '{FILTER({DESCENDANTS([Products].[' | vCatDir | '])},[Products].[Lvl] = "Cat")}';
IF ( SubsetExists ( 'Products' , sSub) = 1);
SubsetDestroy ('Products', sSub );
EndIF;
SUBSETCREATEBYMDX(sSub, smdx);
smdxProd = '{FILTER({DESCENDANTS([Products].[' | vCatDir | '])},[Products].[Lvl] = "ProdUse")}';
sSubset ='zzzCD-PU'| vCatDIR;
IF ( SubsetExists ( 'Products' , sSubset) = 1);
SubsetDestroy ('Products', sSubset );
EndIF;
SUBSETCREATEBYMDX(sSubset, smdxProd);