TI SunsetElementInsert help!

Post Reply
tosca1978
Posts: 101
Joined: Thu Oct 20, 2011 6:53 am
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2007
Location: London, UK

TI SunsetElementInsert help!

Post by tosca1978 »

Hi,

I have a TI to create a Cost Centre Dim. In the prologue I have # IF SUBSET EXISTS, DELETE ALL ELEMENTS, OTHERWISE CREATE EMPTY SUBSET type logic.

In the Metadata tab I have:

DIMENSIONELEMENTINSERT('Cost Centre','',Totals,'c');

DimensionElementComponentAdd('Cost Centre',Totals,'Contingency',1.000000);
DimensionElementComponentAdd('Cost Centre',Totals,'Insurance',1.000000);
DimensionElementComponentAdd('Cost Centre',Totals,'Other Costs',1.000000);

SubsetElementInsert('Cost Centre','Daily Cost Report','Totals',1.000000);

After the TI has run and I open the subset "Daily Cost Report" the "Totals" element has been added circa 15k times. There are roughly 15,000 records in the source file so I am assuming it is running the SubsetElementInsert for every record. In the data Tab all I have are ATTRPUTS statements, nothing re the subset etc.

Any advice would be much appreciated.

Cheers

{Admin note: Moved to the correct forum. This does NOT belong in Useful Code, Tips and Tricks}
User avatar
Michel Zijlema
Site Admin
Posts: 713
Joined: Wed May 14, 2008 5:22 am
OLAP Product: TM1, PALO
Version: both 2.5 and higher
Excel Version: 2003-2007-2010
Location: Netherlands
Contact:

Re: TI SunsetElementInsert help!

Post by Michel Zijlema »

tosca1978 wrote:Hi,

I have a TI to create a Cost Centre Dim. In the prologue I have # IF SUBSET EXISTS, DELETE ALL ELEMENTS, OTHERWISE CREATE EMPTY SUBSET type logic.

In the Metadata tab I have:

DIMENSIONELEMENTINSERT('Cost Centre','',Totals,'c');

DimensionElementComponentAdd('Cost Centre',Totals,'Contingency',1.000000);
DimensionElementComponentAdd('Cost Centre',Totals,'Insurance',1.000000);
DimensionElementComponentAdd('Cost Centre',Totals,'Other Costs',1.000000);

SubsetElementInsert('Cost Centre','Daily Cost Report','Totals',1.000000);

After the TI has run and I open the subset "Daily Cost Report" the "Totals" element has been added circa 15k times. There are roughly 15,000 records in the source file so I am assuming it is running the SubsetElementInsert for every record. In the data Tab all I have are ATTRPUTS statements, nothing re the subset etc.

Any advice would be much appreciated.

Cheers

{Admin note: Moved to the correct forum. This does NOT belong in Useful Code, Tips and Tricks}
I'm not sure what you're exact question is and I don't have a clue on what your requirements are. But regarding the "Total" element being added 15k times to the subset - this is exactly what you've specified: on the MetaData tab, so for every record in your data source, add the element "Total" to the subset "Daily Cost Report".

Michel
Wim Gielis
MVP
Posts: 3241
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: TI SunsetElementInsert help!

Post by Wim Gielis »

You can put the same statement in the Advanced > Prolog tab:

SubsetElementInsert('Cost Centre','Daily Cost Report','Totals',1);

This tab is executed only once.

Insert that element Totals also in the Prolog tab.
Best regards,

Wim Gielis

IBM Champion 2024-2025
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
tosca1978
Posts: 101
Joined: Thu Oct 20, 2011 6:53 am
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2007
Location: London, UK

Re: TI SunsetElementInsert help!

Post by tosca1978 »

Michel/Wim,

Thanks and apologies for a the lack of clarity in my post and b posting to the incorrect board. It's been a long day and I'm under a lot of time pressure!

I was basically trying tidy up my dimension and move the static subsets (which I created in subset editor) to the TI which updates the dim from the source data. In doing so I created a mess. I was trying to achieve each element being added to the subset only once. I was following these instruction from IBM which stated to write the SubsetElementInsert statement in the metadata tab:

http://publib.boulder.ibm.com/infocente ... C112F.html

The process took over an hour to run and ruined my subsets. I have since re-created them manually.

Wim, I will try moving these to the Prologue tomorrow after my presentation of the model - I'm sure it will work but I don't want to risk losing all of my subsets again tonight!

Cheers
Post Reply