601,100
562,"VIEW"
586,"Revenue"
585,"Revenue"
564,
565,"meSYUbz\:Dj^XaWd4vf<E30BmxrmB:IUeqoAW2Pc;UUwsRP1vf`mtDBPSlrMSv8M[kMwdJTaA6oc36rwNz`HI@::>gK1ik?f`j^TTz:pI]rCr7M:q?hqBaZA[:[sZNSc3CK3sWQ?U:`TY3kqnpwm\ZURF[Do?Dz<;oW_?7Evu7P8Edo7dqBo0?k<03VfqFt@k6[9S:jk"
559,1
593,
594,
595,
597,
598,
596,
800,
801,
566,0
567,","
588,"."
589,
568,""""
570,zSystemUseOnly
571,
569,0
592,0
599,1000
560,4
pVersionFrom
pVersionTo
pYear
pRegion
561,4
2
2
2
2
590,4
pVersionFrom,"Budget Entry"
pVersionTo,"Budget Approved"
pYear,"2010"
pRegion,"South Australia"
637,4
pVersionFrom,Version From?
pVersionTo,Version To?
pYear,Fiscal Year?
pRegion,Region?
577,13
Currency
Version
FiscalYear
Period
Region
Department
Channels
Products
RevenueMeasures
Value
NVALUE
SVALUE
VALUE_IS_STRING
578,13
2
2
2
2
2
2
2
2
2
1
1
2
1
579,13
1
2
3
4
5
6
7
8
9
10
0
0
0
580,13
0
0
0
0
0
0
0
0
0
0
0
0
0
581,13
0
0
0
0
0
0
0
0
0
0
0
0
0
582,10
VarType=32ColType=827
VarType=32ColType=827
VarType=32ColType=827
VarType=32ColType=827
VarType=32ColType=827
VarType=32ColType=827
VarType=32ColType=827
VarType=32ColType=827
VarType=32ColType=827
VarType=33ColType=827
572,153
#### Process Logging
#Variables
processName='COPY Revenue Version';
timeStart=NOW;
dateStart = TIMST(timeStart,'\Y \M \d - \h:\i:\s');
countRecords = 0;
status = 'Not Complete';
#Write status information for Start
CELLPUTS(status,'zProcessLogs',processName,'Status');
CELLPUTS(dateStart,'zProcessLogs',processName,'StartTime');

CELLPUTS('','zProcessLogs',processName,'FinishTime');
CELLPUTS('','zProcessLogs',processName,'ElapsedTime');
CELLPUTN(0,'zProcessLogs',processName,'Records');
#### Process Logging

#****Begin: Generated Statements***
#****End: Generated Statements****

#***********************************************
# Turn off Logging
#***********************************************
CubeSetLogChanges('Revenue', 0);

#***********************************************
# Zero out
#***********************************************
vCube = 'Revenue';
vDimName1 = 'Currency';
vDimName2 = 'Version';
vDimName3 = 'FiscalYear';
vDimName4 = 'Region';

vTemp = 'SystemUseOnly_' |  TIMST(Now, '\Y\M\D');
vViewName = vTemp;
vSubName = vTemp;

IF(ViewExists(vCube, vViewName) = 1);
  ViewDestroy(vCube, vViewName);
ENDIF;

IF(SubsetExists(vDimName1, vSubName) = 1);
  SubsetDestroy(vDimName1, vSubName);
ENDIF;
IF(SubsetExists(vDimName2, vSubName) = 1);
  SubsetDestroy(vDimName2, vSubName);
ENDIF;
IF(SubsetExists(vDimName3, vSubName) = 1);
  SubsetDestroy(vDimName3, vSubName);
ENDIF;
IF(SubsetExists(vDimName4, vSubName) = 1);
  SubsetDestroy(vDimName4, vSubName);
ENDIF;

SubsetCreate(vDimName1, vSubName);
SubsetCreate(vDimName2, vSubName);
SubsetCreate(vDimName3, vSubName);
IF(ELLEV('Region', pRegion) = 0);
  SubsetCreate(vDimName4, vSubName);
ELSEIF(pRegion @= 'TOTAL COMPANY');
  SubsetCreatebyMDX(vSubName,'{TM1SUBSETALL( [Region] )}');
ELSE;
  SubsetCreatebyMDX(vSubName, '{TM1FILTERBYLEVEL( {TM1DRILLDOWNMEMBER( {[Region].[' |
    pRegion | ']}, ALL, RECURSIVE )}, 0)}');
ENDIF;

SubsetElementInsert(vDimName1, vSubName, 'Local', 1);
SubsetElementInsert(vDimName2, vSubName, pVersionTo, 1);
SubsetElementInsert(vDimName3, vSubName, pYear, 1);
IF(ELLEV('Region', pRegion) = 0);
  SubsetElementInsert(vDimName4, vSubName, pRegion, 1);
ENDIF;

ViewCreate(vCube, vViewName);

ViewSubsetAssign(vCube, vViewName, vDimName1, vSubName);
ViewSubsetAssign(vCube, vViewName, vDimName2, vSubName);
ViewSubsetAssign(vCube, vViewName, vDimName3, vSubName);
ViewSubsetAssign(vCube, vViewName, vDimName4, vSubName);

ViewZeroOut(vCube, vViewName);

ViewDestroy(vCube, vViewName);

SubsetDestroy(vDimName1, vSubName);
SubsetDestroy(vDimName2, vSubName);
SubsetDestroy(vDimName3, vSubName);
SubsetDestroy(vDimName4, vSubName);

#****************************************************
# Create and Assign Data Source in Prolog
# Make sure DataSource is set to be a tiny
# view called SystemUseOnlyDummy
#****************************************************

vCube = 'Revenue';
vDimName1 = 'Currency';
vDimName2 = 'Version';
vDimName3 = 'FiscalYear';
vDimName4 = 'Region';

vTemp = 'SystemUseOnly_' |  TIMST(Now, '\Y\M\D');
vViewName = vTemp;
vSubName = vTemp;

IF(ViewExists(vCube, vViewName) = 1);
  ViewDestroy(vCube, vViewName);
ENDIF;

IF(SubsetExists(vDimName1, vSubName) = 1);
  SubsetDestroy(vDimName1, vSubName);
ENDIF;
IF(SubsetExists(vDimName2, vSubName) = 1);
  SubsetDestroy(vDimName2, vSubName);
ENDIF;
IF(SubsetExists(vDimName3, vSubName) = 1);
  SubsetDestroy(vDimName3, vSubName);
ENDIF;
IF(SubsetExists(vDimName4, vSubName) = 1);
  SubsetDestroy(vDimName4, vSubName);
ENDIF;

SubsetCreate(vDimName1, vSubName);
SubsetCreate(vDimName2, vSubName);
SubsetCreate(vDimName3, vSubName);
IF(ELLEV('Region', pRegion) = 0);
  SubsetCreate(vDimName4, vSubName);
ELSEIF(pRegion @= 'TOTAL COMPANY');
  SubsetCreatebyMDX(vSubName,'{TM1SUBSETALL( [Region] )}');
ELSE;
  SubsetCreatebyMDX(vSubName, '{TM1FILTERBYLEVEL( {TM1DRILLDOWNMEMBER( {[Region].[' |
    pRegion | ']}, ALL, RECURSIVE )}, 0)}');
ENDIF;

SubsetElementInsert(vDimName1, vSubName, 'Local', 1);
SubsetElementInsert(vDimName2, vSubName, pVersionFrom, 1);
SubsetElementInsert(vDimName3, vSubName, pYear, 1);
IF(ELLEV('Region', pRegion) = 0);
  SubsetElementInsert(vDimName4, vSubName, pRegion, 1);
ENDIF;

ViewCreate(vCube, vViewName);

ViewSubsetAssign(vCube, vViewName, vDimName1, vSubName);
ViewSubsetAssign(vCube, vViewName, vDimName2, vSubName);
ViewSubsetAssign(vCube, vViewName, vDimName3, vSubName);
ViewSubsetAssign(vCube, vViewName, vDimName4, vSubName);

ViewSetSkipCalcs(vCube, vViewName, 1);
ViewSetSkipZeroes(vCube, vViewName, 1);
ViewSetSkipRuleValues(vCube, vViewName, 0);

DatasourceCubeview = vViewName;
573,3

#****Begin: Generated Statements***
#****End: Generated Statements****
574,18
#### Process Logging
countRecords = countRecords + 1;
#### Process Logging

#****Begin: Generated Statements***
#****End: Generated Statements****

#*****************************************************************************************************************
# Send the data into the Cube
#*****************************************************************************************************************
vCube = 'Revenue';

IF(CellIsUpdateable(vCube, Currency, pVersionTo, FiscalYear, Period,Region, Department,Channels,Products, RevenueMeasures) = 1);

    CellPutN(Value, vCube, Currency, pVersionTo, FiscalYear, Period,Region,Department,Channels,Products,RevenueMeasures);

ENDIF;

575,32
#### Process Logging
#Variables
timeFinish=NOW;
elapsedTime=TIMST(timeFinish - timeStart,'\h:\i:\s');
dateFinish = TIMST(timeFinish,'\Y \M \d - \h:\i:\s');
status = 'Complete';
#Write status information for Finish
CELLPUTS(status,'zProcessLogs',processName,'Status');
CELLPUTS(dateFinish,'zProcessLogs',processName,'FinishTime');
CELLPUTS(elapsedTime,'zProcessLogs',processName,'ElapsedTime');
CELLPUTN(countRecords,'zProcessLogs',processName,'Records');
#### Process Logging

#****Begin: Generated Statements***
#****End: Generated Statements****

#****************************************************
# Clean up any Data Source in Eplilog
#****************************************************

ViewDestroy(vCube, vViewName);

SubsetDestroy(vDimName1, vSubName);
SubsetDestroy(vDimName2, vSubName);
SubsetDestroy(vDimName3, vSubName);
SubsetDestroy(vDimName4, vSubName);

#***********************************************
# Turn on Logging
#***********************************************
CubeSetLogChanges('Revenue', 1);

576,CubeAction=1511DataAction=1503CubeLogChanges=0
638,1
804,0
1217,0
900,
901,
902,
903,
906,
907,
908,
904,0
905,0
909,0
911,
912,
913,
914,
915,
916,
917,0
918,0
919,0
920,50000
921,""
922,""
923,0
924,""
925,""
926,""
927,""
