Page 1 of 1

TI SunsetElementInsert help!

Posted: Wed Feb 08, 2012 6:45 pm
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}

Re: TI SunsetElementInsert help!

Posted: Wed Feb 08, 2012 7:36 pm
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

Re: TI SunsetElementInsert help!

Posted: Wed Feb 08, 2012 7:38 pm
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.

Re: TI SunsetElementInsert help!

Posted: Wed Feb 08, 2012 8:19 pm
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