Page 1 of 1

Delete views and subsets using TI

Posted: Thu Apr 05, 2012 7:27 am
by holger_b
Dear forum,

thanks to ScottW I learned how to delete subsets in a TI bulk process: http://www.tm1forum.com/viewtopic.php?p=4107

Still, a subset can not be deleted in case a view uses it. So my aim is now to identify the obsolete subsets plus the views in which they are used so I can first delete the views and then the subsets.

I saw that the subsets used are actually mentioned in the .vue files, so one could basically scan the .vue files to identify the related subsets. Did anyone of you ever do that, and could you provide a code sample?

Thank you
Holger

Re: Delete views and subsets using TI

Posted: Thu Apr 05, 2012 10:46 am
by Wim Gielis
Hello

How do you define obsolete view and obsolete subset?

How do you decide what subsets and views to delete?

Re: Delete views and subsets using TI

Posted: Thu Apr 05, 2012 10:58 am
by holger_b
Hello Wim,

we have a naming policy which allows to understand from the name of a view or a subset whether it was created in a TI process (provided we all stick to the policy :-)). So I can take a view or a subset, cycle through the }Processes dimension and see if the name matches one of the process names. This is supposed to cater for elements which we forget to delete in the epilog.

Regards
Holger

Re: Delete views and subsets using TI

Posted: Thu Apr 05, 2012 6:10 pm
by Wim Gielis
holger_b wrote:Hello Wim,

we have a naming policy which allows to understand from the name of a view or a subset whether it was created in a TI process (provided we all stick to the policy :-)). So I can take a view or a subset, cycle through the }Processes dimension and see if the name matches one of the process names. This is supposed to cater for elements which we forget to delete in the epilog.

Regards
Holger
Sorry to be difficult on this one, but I would prefer cleaning up/correcting existing code rather than trying to clean up the mess of non-optimal code. With yet another TI process / scheduled chore.
This advice is based on your last sentence.

Re: Delete views and subsets using TI

Posted: Thu Apr 05, 2012 6:30 pm
by lotsaram
holger_b wrote:we have a naming policy which allows to understand from the name of a view or a subset whether it was created in a TI process (provided we all stick to the policy :-)).
If you have this naming convention presumably you apply it to views created by TI as well. And also presumably only TI created views should be using these subsets right? So simply apply the same logic as you have already found but first to views and then to subsets.

Or you can just download Bedrock.Cube.View.Delete and Bedrock.Dim.Subset.Delete where this is already baked right in.

Re: Delete views and subsets using TI

Posted: Fri Apr 06, 2012 7:51 am
by rmackenzie
holger_b wrote:we have a naming policy which allows to understand from the name of a view or a subset whether it was created in a TI process
The attached processes will delete views and subsets beginning with a 'z'. Perhaps you can adapt the code to work with your own convention?

Re: Delete views and subsets using TI

Posted: Mon Apr 16, 2012 2:59 pm
by holger_b
Dear all,

thanks a lot for all your contributions! Of course I agree with Wim, at a first glance I also intended to brush up the existing code to solve that, but I soon realized that this is really time consuming since I would have to dig through thousands of lines of code to understand what exactly to do in the epilog to have the desired effect. Not to forget subsets and views created in processes which have vanished somehow in the meantime. And for sure I was bound to mess processes up inadvertently.

So I decided to actually do it like this: Most of the objects I want to get rid of are named like the TI process in which they are created. So first I loop through all the existing subsets (with the help of WildcardFileSearch) and compare them with the elements of the }Processes dimension. Beyond that I can catch a few other categories like *test*, *check* and so on which are possibly not worth to survive. Together with the }Dimensions dimension, I build a cube to store the information where these subsets can be found.

Next thing I loop through the views in a similar manner: I read through the .vue files, comparing the subsets mentioned in them with the elements in the "subsets" dimension which I populated in the run mentioned before. Again, I fill a cube, one dimension is views, the other one is }Cubes.

So I end up with two cubes which allow me to look through them before I finally delete the views and subsets so to prevent the deletion of items one would prefer to keep. Took me two days to set that up, certainly less time consuming than scanning all those maybe 200 TI processes. And it was fun to do :-)

Regards
Holger