Clear an entire cube

Introduction

It is possible to clear all data in a cube with 3 Turbo Integrator statements. Paste this code in the Advanced > Prolog tab and change the cube name:

VIEWCREATE('OPEX','MyZeroOut');
VIEWZEROOUT('OPEX','MyZeroOut');
VIEWDESTROY('OPEX','MyZeroOut');

Note that this is fast, yet possibly very dangerous. You could loose all data in the cube if you do not have decent backup mechanisms.

A new function

As from TM1 9.5, the function CubeClearData does the same:

CUBECLEARDATA('OPEX','MyZeroOut');

Note that in some TM1 versions, execution this function might crash the TM1 application, when rules are attached to the cube that is cleared.

No unnecessary logs

It might be wise to turn off temporarily the logging of changes to this cube in the clear process:

CUBESETLOGCHANGES('OPEX',0);
# your zero out code
CUBESETLOGCHANGES('OPEX',1);

A rule-based approach

Another alternative is to write a very simple rule. If you want to clear all data for 2012, you could use (provided elements are called like this):

['2012']=N:0;

Put this rules statement on top of the rules editor for the cube you want to zero out. Save the rules. Then, remove the line and again save the rules for that cube. Note: be sure to know what you are doing !




Homepage

Section contents

About Wim

Wim Gielis is a Business Intelligence consultant and Excel expert

Other links