Dynamically checking element exists and inserting it
Posted: Mon Mar 09, 2015 5:31 pm
I was copying data between two cubes ,there are some elements in source cube which doesn't exists in the target ,Which render "dimension name and element invalid key" error.
I wrote a process to check the each dimension and dynamically insert the element if it doesn't exist.I am struck how to map it with source cube for example
vEle= CellGetS(Scube,Dim1,Dim2,Dim3,Dim4....);
I could able to do it by writing multiple IF statements in the metadata tab:
But If I want make it dynamic by using while loop,Could gurus please correct me if heading wrong way .Thanks a lot.
I wrote a process to check the each dimension and dynamically insert the element if it doesn't exist.I am struck how to map it with source cube for example
vEle= CellGetS(Scube,Dim1,Dim2,Dim3,Dim4....);
I could able to do it by writing multiple IF statements in the metadata tab:
Code: Select all
sGl= CellGetS ( scube , Dim1 , Dim2 , Dim3 , Dim4,........);
IF(dimix('GL', sGl)=0);
DimensionElementInsert('GL', '', sGl, 'N');
ENDIF;

Code: Select all
iDimCount = 1 ;
vCub='Prod_Reporting';
While(iDimCount<=1);
DimNo=TABDIM(vCub,iDimCount);
EleCount=1;
While(EleCount<=1);
EleName=DIMNM(DimNo,EleCount);
IF
(DIMIX(DimNo,EleName)=0);
DIMENSIONELEMENTINSERT(DimNo,'',EleName,'N');
ENDIF;
EleCount= EleCount+1;
END;
iDimCount = iDimCount+1;
END;