Clear multiple cubes

Introduction

While you can easily clear a cube’s data, clearing all application cubes in a TM1 database is the next step. Although I must admit that I have never used code like this in practice. In fact, you can loop through all (application) cubes, and perform the zero out on each of the cubes, one after the other.

Warning

WARNING: PAY ATTENTION - PLEASE KNOW WHAT YOU ARE DOING SINCE THIS CODE WILL CLEAR ALL DATA FROM ALL APPLICATION CUBES ON A CERTAIN TM1 SERVER!

Put the following code in the Advanced > Prolog tab of a TI process:

# Wim Gielis # http://www.wimgielis.com
##### # TI code to clear all application cubes # 07/11/09 #####
# loop over the cubes iCube = 1; WHILE( iCube <= DIMSIZ('}Cubes')); # the cube in the loop vCube = DIMNM('}Cubes', iCube); # exclude control cubes IF( SUBST( vCube, 1, 1) @<> '}'); CUBESETLOGCHANGES(vCube, 0); VIEWCREATE(vCube, 'MyZeroOut'); VIEWZEROOUT(vCube, 'MyZeroOut'); VIEWDESTROY(vCube, 'MyZeroOut'); CUBESETLOGCHANGES(vCube, 1); ENDIF; iCube = iCube + 1; END;

While looping over cubes, we exclude control cubes. The names of these internal TM1 cubes begin with }. It is advisable to not use this character } in the names of application cubes. You could also use a Dimension Subset on the dimension }Cubes as the Data source for the process.




Homepage

Section contents

About Wim

Wim Gielis is a Business Intelligence consultant and Excel expert

Other links