Thanks...however, I'm just having a lil confusion. I was expecting the loop to go through each element...but it ended up just putting data on the last. ( I tried this out with making my condition be
IF (CellGetS(vStatusCubeName,so,VersionNo,'STATUS')<>@'REJECT');
) When I expected it should put data on all elements that meet the requirements.
Sorry for asking too much help from you guys...never really done looping through an element and loading data. (Still haven't gotten used to the looping for TM1 or programming)
PROLOG
Code: Select all
######### DEFINE CONSTANT VARIABLES #############
index = 1;
pStatusDimension = 'base_submission_version';
vStatusCubeName ='worksheet_status';
vSourceCubeName = 'worksheet';
vTargetCubeName = 'version_worksheet';
pDimensionName = 'base_worksheet_account_manager';
p1DimensionName = 'base_worksheet_so_number';
vSubsetName = am;
v1SubsetName = so;
vViewName = useraccessed;
NoOfSubmission = DIMSIZ(pStatusDimension);
WHILE (index<=NoOfSubmission);
VersionNo = DIMNM(pStatusDimension, index);
IF (CellGetS(vStatusCubeName,so,VersionNo,'STATUS')<>@'REJECT');
ITEMSKIP;
ELSE;
#********TIDY UP VIEW**********
VIEWDESTROY(vSourceCubeName,vViewName);
SUBSETDESTROY(pDimensionName,vSubsetName);
SUBSETDESTROY(p1DimensionName,v1SubsetName);
#******CREATE SUBSET**********
SUBSETCREATE(pDimensionName,vSubsetName);
SUBSETELEMENTINSERT(pDimensionName,vSubsetName,am,1);
SUBSETCREATE(p1DimensionName,v1SubsetName);
SUBSETELEMENTINSERT(p1DimensionName,v1SubsetName,so,1);
#*******CREATE VIEW & ASSIGN SUBSET*********
VIEWCREATE(vSourceCubeName,vViewName);
VIEWSUBSETASSIGN(vSourceCubeName,vViewName,pDimensionName,vSubsetName);
VIEWSUBSETASSIGN(vSourceCubeName,vViewName,p1DimensionName,v1SubsetName);
IF(DTYPE(pDimensionName,am)@='C');
VIEWSETSKIPCALCS(vSourceCubeName,vViewName,0);
ENDIF;
IF(DTYPE(p1DimensionName,so)@='C');
VIEWSETSKIPCALCS(vSourceCubeName,vViewName,0);
ENDIF;
VIEWSETSKIPRULEVALUES(vSourceCubeName,vViewName,0);
ENDIF;
index = index +1;
END;
DATA
Code: Select all
IF(CELLISUPDATEABLE(vTargetCubeName,so,vdate,base_number,am,VersionNo,value_worksheet)=1);
##### Determines if the cube is updateable, 1 mean its cell can be updated else 0. If Value is 0, then the process will incur and error and will not
#pass through the succeeding syntax.
IF(VALUE_IS_STRING=0);
##### Determines if the value is numeric or string, 0 mean numeric else string.
CELLPUTN(NValue,vTargetCubeName,so,vdate,base_number,am,VersionNo,value_worksheet);
ELSE;
##### Base on the syntax above, the value is numeric therefore CELLPUTN states the value to be inputted is numeric
CELLPUTS(SValue,vTargetCubeName,so,vdate,base_number,am,VersionNo,value_worksheet);
ENDIF;
##### Base on the syntax above, numeric value is loaded first then the string.
ENDIF;
I just need the TI to check the status in this cube. If the first submission has a reject then it should use the empty status and load data there and I want the process to stop there. And when the 2nd submission has a reject status...when the process is ran again it should skip the first & second submission. Cause the data shouldnt be overwritten or anything.