Product:
Planning Analytics 2.0.19
Microsoft Windows 2019 server
Issue:
How get the parent and child of a dimension to a text file?
Solution:
Create a new TM1 TI process with the data source to the dimension.
And a parameter where you enter the dimension:
And the TM1 code as below:
#Section Prolog # -- check the enter value to not be blank -- IF (LONG(pDimension) = 0 ) ; sDim = 'account' ; ELSE; sDim = pDimension ; ENDIF; sOutputFile = 'D:\temp\' | sDim | '.csv'; # -- set the dimension as source -- DatasourceNameForServer = sDim ; DatasourceNameForClient = sDim ; DATASOURCEDIMENSIONSUBSET = 'all'; #Section Metadata #Section Data # ----- export the dimension --- sElementType = DTYPE ( sDim, v1 ); # always output the element and its type AsciiOutput ( sOutputFile, sElementType , v1 ); # cycle through children if it is a consolidated element IF ( sElementType @= 'C' ); iCount = 1; iMax = ElCompN ( sDim, v1 ); While ( iCount <= iMax ); sChild = ElComp ( sDim, v1, iCount ); sWeight = NumberToString ( ElWeight ( sDim, v1, sChild ) ); AsciiOutput ( sOutputFile, '', sChild , sWeight ); iCount = iCount + 1; End; EndIf; #Section Epilog
This need to be adjusted to meet your needs.
More Information:
https://exploringtm1.com/how-to-use-a-dynamic-path-in-a-ti-for-a-data-source/
https://www.ibm.com/docs/en/cognos-tm1/10.2.2?topic=variables-datasourcedimensionsubset