Empty Dimension in TI Process

Post Reply
User avatar
damientaylorcreata
Posts: 86
Joined: Mon Apr 13, 2009 8:47 am
OLAP Product: Cognos TM1
Version: 9.4
Excel Version: 2003 and 2007
Location: Sydney, Australia
Contact:

Empty Dimension in TI Process

Post by damientaylorcreata »

Hi Guys,

Can anybody please let me know how to delete (Clear / Purge) all elements from a dimension:

a) via a manual process in Perspectives. I am unable to see an option that says delete all, empty or clear elements.

b) is there a command I can use within TI to empty all elements before importing the new elements.

I have tried looking through the documentation, but I am unable to find an answer.

Thanks
Damien Taylor
Alan Kirk
Site Admin
Posts: 6644
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Empty Dimension in TI Process

Post by Alan Kirk »

damientaylorcreata wrote:Hi Guys,

Can anybody please let me know how to delete (Clear / Purge) all elements from a dimension:

a) via a manual process in Perspectives. I am unable to see an option that says delete all, empty or clear elements.

b) is there a command I can use within TI to empty all elements before importing the new elements.

I have tried looking through the documentation, but I am unable to find an answer.
Search for the TurboIntegrator function DimensionDeleteAllElements.

According to the help if you recreate any existing elements in the same Metadata tab, then any cubes which use the dimensions will retain their data after the dimension is rebuilt.

I'm not sure I'd trust that (anything that can go wrong, etc), but if you want to dump the data as well this will do it for you. It depends on what your intention is.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
User avatar
damientaylorcreata
Posts: 86
Joined: Mon Apr 13, 2009 8:47 am
OLAP Product: Cognos TM1
Version: 9.4
Excel Version: 2003 and 2007
Location: Sydney, Australia
Contact:

Re: Empty Dimension in TI Process

Post by damientaylorcreata »

Hi Alan,

That was a quick reply and yes I have found the function: "DimensionDeleteAllElements"

Thanks
Damien
Damien Taylor
User avatar
Martin Ryan
Site Admin
Posts: 1989
Joined: Sat May 10, 2008 9:08 am
OLAP Product: TM1
Version: 10.1
Excel Version: 2010
Location: Wellington, New Zealand
Contact:

Re: Empty Dimension in TI Process

Post by Martin Ryan »

To echo Alan's warning, if your dimension rebuild fails for whatever reason, then you can potentially lose a lot of data.

In order to get around this, I would recommend a different approach, which is cycling through the dimension in the prolog and deleting all the consolidated elements, effectively removing your hierarchy, but leaving the N level elements intact. Then rebuild your hierarchy in the metadata tab, based on your source.

An optional extra is to call a process from the Epilog that cycles through the dimension and puts any orphans into an "Orphan" consolidation so you can check that the rebuild went successfully.

This means if it goes pear shaped then you will not lose any data, just the hierarchy.

Martin
Please do not send technical questions via private message or email. Post them in the forum where you'll probably get a faster reply, and everyone can benefit from the answers.
Jodi Ryan Family Lawyer
User avatar
Martin Ryan
Site Admin
Posts: 1989
Joined: Sat May 10, 2008 9:08 am
OLAP Product: TM1
Version: 10.1
Excel Version: 2010
Location: Wellington, New Zealand
Contact:

Re: Empty Dimension in TI Process

Post by Martin Ryan »

The function for my method, by the way, is DimensionElementComponentDelete. Some sample, untested code below

Note that when deleting elements it's best to start at the end of a dimension and work your way backwards, otherwise what was element n becomes element n-1 when you delete a preceding element. This means you can skip over elements easily.

Code: Select all

myDim='DimToPurge';
i=dimsiz(myDim);
while(i>0);
elem=dimnm(myDim, i);
numChild=elcompn(myDim, elem);
while(numChild>0);
  sChild=elcomp(myDim, elem, numChild);
  DimensionElementComponentDelete(myDim, elem, sChild);
  numChild=numChild-1;
end;
i=i-1;
end;
Please do not send technical questions via private message or email. Post them in the forum where you'll probably get a faster reply, and everyone can benefit from the answers.
Jodi Ryan Family Lawyer
Post Reply