subset creation moved to epilog and worked

Post Reply
Analytics123
Posts: 128
Joined: Tue May 23, 2017 12:45 pm
OLAP Product: Tm1
Version: 9.5
Excel Version: 2010

subset creation moved to epilog and worked

Post by Analytics123 »

Hi Guys,

I had an issue with subset creation and when I moved a part of code to epilog it started working. Can you tel me if there was anything wrong having the code in prolog itself .

Prolog : Creating a subset through a mdx statement .
Subset Name : ALL X Customers

Now with All X customers subset as reference creating an another subset with some filter add to it .

vSize = SUBSETGETSIZE( vDimensionName, vSourceSubset );
WHILE( vSize > 0 );
vElement = SUBSETGETELEMENTNAME( vDimensionName, vSourceSubset, vSize );
vCustomerGrade = CELLGETS( 'AR History', vElement, 'US01', vPeriod, 'All Currencies', 'Local Currency', '120000', 'All Customer Types', 'Letter Grade' );

IF( vCustomerGrade @= 'F' );
SUBSETELEMENTINSERT( vDimensionName, vSubsetName, vElement, 1 );
ENDIF;

vSize = vSize - 1;
END;

Now both these subsets work great . I now add a third subset below this line of code in prolog which is also built from the 1 st subset as a base .

vSubsetName = 'All Y customers';
vSourceSubset = 'ALL X Customers';
vDimensionName = 'Customers SoldTo';
vSourceDim = 'Customers SoldTo Only';

IF( SUBSETEXISTS( vDimensionName, vSubsetName ) = 1 );
SUBSETDELETEALLELEMENTS( vDimensionName, vSubsetName );
ELSE;
SUBSETCREATE( vDimensionName, vSubsetName );
ENDIF;

vSize = SUBSETGETSIZE( vSourceDim, vSourceSubset );
WHILE( vSize > 0 );
vElement = SUBSETGETELEMENTNAME( vSourceDim, vSourceSubset, vSize );

IF( DIMIX( vDimensionName, vElement ) = 0 );
ITEMREJECT( 'The Specified Customer DNE in the Customers SoldTo Dimension: ' | vElement );
ELSE;
SUBSETELEMENTINSERT( vDimensionName, vSubsetName, vElement, 1 );
ENDIF;

vSize = vSize - 1;
END;



Now the subset All Y customers is partially created when the code is in prolog and is fully created when the code is in epilog(bold code in epilog now) .

Is the reference of the main subset not released in pro log . Not sure why this is happening .

Any suggestions are welcome .
Wim Gielis
MVP
Posts: 3103
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: subset creation moved to epilog and worked

Post by Wim Gielis »

ITEMREJECT in the Prolog tab is not the correct function here for you, I guess, given that it's the Prolog tab ?
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Analytics123
Posts: 128
Joined: Tue May 23, 2017 12:45 pm
OLAP Product: Tm1
Version: 9.5
Excel Version: 2010

Re: subset creation moved to epilog and worked

Post by Analytics123 »

let me check .

Thanks
lotsaram
MVP
Posts: 3651
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: subset creation moved to epilog and worked

Post by lotsaram »

Wim Gielis wrote: Mon Aug 14, 2017 7:06 pm ITEMREJECT in the Prolog tab is not the correct function here for you, I guess, given that it's the Prolog tab ?
ItemReject on the Prolog is quite fine. It is just that as Prolog has no data source and executes only 1x that the ItemReject will skip the rest of the Prolog code from that point.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
Wim Gielis
MVP
Posts: 3103
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: subset creation moved to epilog and worked

Post by Wim Gielis »

lotsaram wrote: Tue Aug 15, 2017 6:26 am
Wim Gielis wrote: Mon Aug 14, 2017 7:06 pm ITEMREJECT in the Prolog tab is not the correct function here for you, I guess, given that it's the Prolog tab ?
ItemReject on the Prolog is quite fine. It is just that as Prolog has no data source and executes only 1x that the ItemReject will skip the rest of the Prolog code from that point.
That's what I meant indeed. Potentially a lot of elements in the subset are skipped.
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Analytics123
Posts: 128
Joined: Tue May 23, 2017 12:45 pm
OLAP Product: Tm1
Version: 9.5
Excel Version: 2010

Re: subset creation moved to epilog and worked

Post by Analytics123 »

Yes that was the issue . Thanks All !!
Post Reply