Exploring TM1 - a Chartertech Company
Search
Close this search box.

Clear Cube Process

It is good practice to create and destroy a view for clearing rather then leaving a large clear view sitting under the cube waiting for a user to click on it.

The code below creates a view and assigns subsets to that view, zero’s the view out then destroys the view and subsets.

Start with nothing, leave with nothing…

PARAMETERS
vCube
vVersionFrom
vVersionTo

 

### PROLOG ###
Cube = vcube;
ViewName = ‘Clearing_’ | vCube;
DimName = ‘Version’;
SubName = ‘Clearing_’ | vVersionTo;

IF(ViewExists(Cube, ViewName)=1);
ViewDestroy(Cube, ViewName);
ENDIF;
ViewCreate(Cube, ViewName);

IF(SubsetExists(DimName, SubName)=1);
SubsetDestroy(DimName, SubName);
ENDIF;
SubsetCreate(DimName, SubName);
SubsetElementInsert(DimName, SubName, vVersionTo, 1);
ViewSubsetAssign(Cube, ViewName, DimName, SubName);
ViewZeroOut(Cube, ViewName);

ViewDestroy(Cube, ViewName);
SubsetDestroy(DimName, SubName);

###################################

 

I hope this helps you in your development.

  • This field is for validation purposes and should be left unchanged.

Post Sections

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Log In