Page 1 of 1

Clear Cube data partially based on dimensional values

Posted: Mon Nov 26, 2012 10:39 pm
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

Re: Clear Cube data partially based on dimensional values

Posted: Mon Nov 26, 2012 10:48 pm
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.

Re: Clear Cube data partially based on dimensional values

Posted: Tue Nov 27, 2012 2:26 am
by Martin Ryan
Plus a small example and some discussion of dates here: http://www.tm1forum.com/viewtopic.php?f=3&t=8248

Re: Clear Cube data partially based on dimensional values

Posted: Wed Nov 28, 2012 4:52 pm
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