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.

If you like this post, please spread the love…

One comment on “Clear Cube Process

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.