Clear Cube data partially based on dimensional values

Post Reply
LoganNSE
Posts: 22
Joined: Fri Nov 18, 2011 10:19 am
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2003 2007

Clear Cube data partially based on dimensional values

Post by LoganNSE »

Hi,

We have a requirement to clear/delete cube or dimension partially via TI - Cube have 3 dimensions Code, Item_nos and Measures.
Code - 01, 02, 03..99
Item_nos - 01_a1, 01_a2, 02_a1, 02_a2,...etc
Measures - m1, m2, m3, ...m123

REFRESH: On setting parameter pCode=01 in TI, we need to load new values for 01 i.e. delete item_nos 01_a1 & 01_a2 for code 01 for all measures and need to re-load them again. DimensionElementComponentDelete out of Item_nos (01_a1 & 01_a2 are child to 01) removes the entry in dimension and Cube however on adding 01_a1 again, I can see old data populated - I knew that the old data was there however I am not sure how to clear it out just for Item_nos 01_a1 & 01_a2. Can anyone guide me to clear Cube data for 01_a1 & 01_a2 if Code=01 was chosen (02_a1 & 02_a2 if Code=02 was chosen) for all measures?

NOTE: ViewZeroOut or ClearCubeData or CubeDestroy cannot be used as they will wipe out/delete whole Cube.

Searched forum however I am unable to find similar to this, please direct me if it has been already answered.

Happy Holidays!!!

Thanks,
Logan
Alan Kirk
Site Admin
Posts: 6647
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: Clear Cube data partially based on dimensional values

Post by Alan Kirk »

LoganNSE wrote: NOTE: ViewZeroOut or ClearCubeData or CubeDestroy cannot be used as they will wipe out/delete whole Cube.
As the name suggests, VIEWZeroOut zeroes out a VIEW, not the entire cube.
- Create subsets for each dimension that you want to select elements from (SubsetCreate);
- Assign the elements that you want to clear to those subsets (SubsetElementInsert);
- Create a view (ViewCreate and the three ViewExtractSkip functions);
- Assign the subsets that you have created to the view (ViewSubsetAssign);
- Pass the name of the view to ViewZeroOut.

You'll find all of the relevant functions in the Reference Guide, an on-line link to which you'll find in the FAQ thread.
"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
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: Clear Cube data partially based on dimensional values

Post by Martin Ryan »

Plus a small example and some discussion of dates here: http://www.tm1forum.com/viewtopic.php?f=3&t=8248
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
LoganNSE
Posts: 22
Joined: Fri Nov 18, 2011 10:19 am
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2003 2007

Re: Clear Cube data partially based on dimensional values

Post by LoganNSE »

Hi Alan/Martin,

Thanks a lot for your time and inputs - it worked, example mentioned in the link was really useful and I replicated part of it.

1. Create temp view/subset (ViewCreate & SubsetCreate)
2. Loop through the dimension and add item_numbers to temp subset (SubsetElementInsert)
3. Assign subset to the view (ViewSubsetAssign)
4. Zero out the view (ViewZeroOut)
5. Finally delete both the view and subset (ViewDestroy & SubsetDestroy)

Thanks,
Logan
Post Reply