Delete set of elements from Dimension

Post Reply
pradeep.k.jagadeesan
Posts: 28
Joined: Tue Jun 16, 2009 1:03 pm
OLAP Product: IBM Cognos TM1
Version: 9.5.1
Excel Version: 2007
Location: India

Delete set of elements from Dimension

Post by pradeep.k.jagadeesan »

I have a dimension in which i want to delete a set of elements that has strings '10RO' using TI process. How can I filter those elements and delete it?
Ex:
AllNode
AB10RONOMINALS
10ROWLedger
SYS

The TI has to delete first two elements.

Please help me. Thanks in advance.

Regards
Pradeep
David Usherwood
Site Admin
Posts: 1458
Joined: Wed May 28, 2008 9:09 am

Re: Delete set of elements from Dimension

Post by David Usherwood »

If (big if) I understand your requirement adequately, how about:

Data source is the All subset of your dimension, called say 'Mydim'
Variable holding element name is called (say) 'elem' and is set to type other
Metadata has code on the lines of

Code: Select all

if(scan('10RO' ,elem) > 0);
dimensionelementdelete('Mydim',elem);
endif;
??
MSidat
Community Contributor
Posts: 110
Joined: Thu Aug 26, 2010 7:41 am
OLAP Product: TM1, PA
Version: PAL 2.0.8
Excel Version: 2016
Location: North West England

Re: Delete set of elements from Dimension

Post by MSidat »

If its a one off exercise and dependant on the number of elements I would create:

1. A suitable MDX query to get the elements. (You could use this as a datasource in a TI, but I have found there to be performance/integrity issues when using a subset as a datasource and you delete an element which exists in that subset)
2. Copy and paste this list into Excel.
3. Create a suitable formula in Excel to generate the dimensionelementdelete statement for each of the elements.
4. Copy the list of statements and paste into a prolog of a TI and execute. (I had to do this once with nearly 15000 elements, was extremely fast!!!)

A more elegant option would be to:

1. Create a TI with a loop in the Prolog which loops through the whole dimension using the dimix and dimnm functions.
2. On each Element use the SCAN function to determine if it contains the relevant string and if so delete the element.
3. Make sure you dont get into an infinite loop by not adding onto the counter when you delete an element.
Always Open to Opportunities
Post Reply