Page 1 of 1

Delete set of elements from Dimension

Posted: Mon Jan 16, 2012 3:09 pm
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

Re: Delete set of elements from Dimension

Posted: Mon Jan 16, 2012 3:59 pm
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;
??

Re: Delete set of elements from Dimension

Posted: Mon Jan 16, 2012 4:01 pm
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.