Thanks Wim, Sorry for the delayed response, got caught up with other issues. Finally this is test scenario I have tried for copying the data from 7 dimensional source cube data to 9 dimensional test target cube. If it comes off correctly, I could finally implement the same with 14 dimensional target cube.
Since most of the dimensions defined in the cube as picklist exist in the model, I am using these existing dimensions, I have wrote the below code and process is copying the values fine when I define individual elements of the two new dimension using CellPutN statements in Data tab. The data is getting copied over correctly.
But when I try to substitute element name with dimension name in order to copy the data for all the elements of these two new dimensions it renders an error “Data Procedure line 33, Invalid key name and element name”.
As I have defined them (two new dimensions) as new variable for example V9=’Projection’; and V10=’Supplier Details’;
But taking it off and also didn’t work.
I have also checked the dimension order of both the cube, it is in same order.
Also, Created Zero level element subsets for the both dimensions and assigned it to the target view but to no avail.
I know the error means the dimension doesn’t consist the element in question doesn’t exist in the Projection Dimension.
I can't destroy and create these dimensions in metadata as they are used in other cubes.Moreso due to the fact pick list values being rendered upon the title dimension element selection and sometime it could be empty.
Apparently by defining this new dimension as variable I am not able to call it in the process and ending up with “Invalid key name and element name” Key
Three to four dimensions have quite a few elements and writing hundreds of CellGetS is practically not feasible.
Appreciate if gurus could please help me to resolve the issue, would be very much thankful for your help. Thanks in advance.
Code: Select all
Prolog
#Global Variables #
StringGlobalVariable('gErrMsg');
# Local Variables #
vNow = TimSt(Now(), '\Y\m\d\h\i\s');
#Defining Target Cube ,View and Target Dimension#
TCub='DU_SERVICES_REPORT_MASTER';
TDim='sa_period_master';
TVw='Target View';
#Switch off the logging for target cube#
CubeSetLogChanges(TCub, 0);
## Creating Target View##
IF (VIEWEXISTS(TCub,TVw)=1);
VIEWDESTROY(TCub,TVw);
ENDIF;
VIEWCREATE(TCub,TVw);
##Creating Subset for the Target cube##
IF (SUBSETEXISTS(TDim,'Tsub')=1);
SUBSETDELETEALLELEMENTS(TDim,'Tsub');
ELSE;
SUBSETCREATE(TDim,'Tsub');
ENDIF;
##Inserting Measure Elements in to the Subset#
SUBSETELEMENTINSERT(TDim,'TSub','Charged Current Year',1);
SUBSETELEMENTINSERT(TDim,'TSub','Charged Previous Year',2);
##Assigning Subset to the Target View#
VIEWSUBSETASSIGN(TCub,'TargetView','sa_period_master','TSub');
## ZeroOut Target View#
VIEWZEROOUT(TCub,TVw);
##Defining Source Cube,View and Dimension#
SCub='DU_SERVICES_REPORT';
SDim='sa_period';
SVw='Source View';
#Making sure Source View exists for the Process##
IF(VIEWEXISTS(SCub,SVw)=0);
VIEWCREATE(SCub,SVw);
ENDIF;
##Creating ubset for source view##
IF
(SUBSETEXISTS(SDim,'Ssub')=1);
SUBSETDELETEALLELEMENTS(SDim,'Ssub');
ELSE;
SUBSETCREATE(SDim,'Ssub');
ENDIF;
##Inserting measure elements in to the source view#
SUBSETELEMENTINSERT(SDim,'Ssub','Charged Current Year',1);
SUBSETELEMENTINSERT(SDim,'Ssub','Charged Previous Year',2);
#Defining the view setup#
#Since Source cube consists rule derived values I want to include it#
# VIEWROWSUPPRESSZEROESSET(SCub,'SVw',0);
VIEWEXTRACTSKIPCALCSSET(SCub,SVw,1);
VIEWEXTRACTSKIPRULEVALUESSET(SCub,SVw,0);
#-------Assign Data Source---#
DataSourceType='View';
DataNameForServer='DU_SERVICES_REPORT';
DataSourceNameForClient='DU_SERVICES_REPORT';
DataSourceCubeView=SVw;
Code: Select all
Data
****Begin: Generated Statements***
V9='Projection';
V10='Supplier Details';
#****End: Generated Statements****
## Retrieve Data from the source cube##
NVal= CellGetN('DU_SERVICES_REPORT',SCENERIO,SERVICES, RATE_TA, BUSINESSUNIT, PRODUCTSEQUENCE, PART,'Charged Current Year');
NVal1= CellGetN('DU_SERVICES_REPORT',SCENERIO,SERVICES, RATE_TA, BUSINESSUNIT, PRODUCTSEQUENCE, PART,'Charged previous Year');
#### ASCIIOUTPUT the data before the load
ASCIIOUTPUT('C:\Documents and Settings\Support\Desktop\TM1 Server Logs\OutPut1.CSV','Scenerio','Services', 'Rate_Ta', 'Business Unit', 'Product Sequence','Part', 'Charged Current Year','Medium','Rego');
ASCIIOUTPUT('C:\Documents and Settings\Support\Desktop\TM1 Server Logs\OutPut1.CSV','Scenerio','Services', 'Rate_Ta', 'Business Unit', 'Product Sequence', 'Part','Charged Previous Year','Medium','Rego');
##Copy source cube data to Target cube###
IF (CellIsUpdateable('DU_SERVICES_REPORT_MASTER',SCENERIO,SERVICES, RATE_TA, BUSINESSUNIT, PRODUCTSEQUENCE, PART,'Charged Current Year','Medium','Rego')=1);
CELLPUTN(NVal,'DU_SERVICES_REPORT_MASTER',SCENERIO,SERVICES, RATE_TA, BUSINESSUNIT, PRODUCTSEQUENCE, PART,'Charged Current Year','Medium','Rego');
ENDIF;
ASCIIOUTPUT('C:\Documents and Settings\Support\Desktop\TM1 Server Logs\OutPut3.CSV',SCENERIO,SERVICES, RATE_TA, BUSINESSUNIT, PRODUCTSEQUENCE, PART,'Charged Current Year','Medium','Rego');
IF (CellIsUpdateable('DU_SERVICES_REPORT_MASTER',SCENERIO,SERVICES, RATE_TA, BUSINESSUNIT, PRODUCTSEQUENCE, PART,'Charged Previous Year','Medium','Rego')=1);
CELLPUTN(NVal1,'DU_SERVICES_REPORT_MASTER',SCENERIO,SERVICES, RATE_TA, BUSINESSUNIT, PRODUCTSEQUENCE, PART,'Charged Previous Year','Medium','Rego');
ENDIF;
ASCIIOUTPUT('C:\Documents and Settings\Support\Desktop\TM1 Server Logs\OutPut4.CSV',SCENERIO,SERVICES, RATE_TA, BUSINESSUNIT, PRODUCTSEQUENCE, PART,'Charged Previous Year','Medium','Rego');
Code: Select all
EpilogEpilog
#****Begin: Generated Statements***
#****End: Generated Statements****
#Switch on the logging for target cube#
CubeSetLogChanges(TCub, 1);
#Clean up
VIEWDESTROY(TCub,TVw);
SUBSETDESTROY(TDim,'Tsub');