Exporting Dimension into flatfile/SQL Server Datbase.
Posted: Thu Dec 13, 2012 6:30 am
Hello everyone,
I would like to export Dimension & Cubes to Relational Datbase to use for reporting purpose.
I am trying to export TM1 dimension to flatfile before exporting to SQL Server DB. Gatherd some code in this forum and modified it to use as unique code when I have different levels in the dimension.
Please provide your comments on below code.
Thanks,
Santosh
I would like to export Dimension & Cubes to Relational Datbase to use for reporting purpose.
I am trying to export TM1 dimension to flatfile before exporting to SQL Server DB. Gatherd some code in this forum and modified it to use as unique code when I have different levels in the dimension.
Please provide your comments on below code.
Code: Select all
Dim = 'Product';
Path = 'C:\Honey\TM1dim2.csv';
DimSize = DIMSIZ(Dim);
i = 1;
p = 1;
#Loop through each element
WHILE (i <=DimSize);
Element = DIMNM(Dim,i);
NumParent = ELPARN(Dim,Element);
IF (NumParent = 0);
ASCIIOUTPUT(Path,Element,Element);
ELSE;
#Ouput every parent in multiple hierarchies
WHILE (p<=NumParent);
Parent=ELPAR(Dim,Element,p);
parent1=elpar(dim,Parent,p);
parent2=elpar(dim,parent1,p);
if(ellev(Dim,parent2) = 3 ) ;
ASCIIOUTPUT(Path,Element,Parent,parent1,parent2);
endif;
p = p +1;
END;
p = 1;
ENDIF;
i = i +1;
END;
Santosh