How export a dimension to SQL

Product:

Planning Analytics 2.0.9.19

TM1_version=TM1-AW64-ML-RTM-11.0.919.10-0
TM1_name=IBM Cognos TM1

Issue:

How export dim values to SQL?

Solution:

Create a TM1 TI process that have the dimension as a data source.  Set the variable name to account, and as string.  On the TM1 server create a ODBC connection to the SQL database.

Enter code similar to this:

#Section Prolog
sDimension = 'plan_chart_of_accounts' ;

sSource = 'OdbcDatabasename' ;
sClient = 'sql login user' ;
sPassword = 'sql login password' ;
sUseUnicodeODBC = 1 ;

ODBCOpenEx(sSource, sClient, sPassword, sUseUnicodeODBC) ;

#Section Metadata

#Section Data
sSQL = '';

CountofParent = ElParN( sDimension , Account);
ElementLevel = ElLev( sDimension , Account);
ParentCounter = 0;

WHILE (ParentCounter <= CountofParent);
ParentElement = ElPar( sDimension, Account ,ParentCounter);

sSQL = Expand('INSERT INTO dbo.AccountTable (Account, parentelement, countofparent, elementlevel) VALUES (''%Account%'',''%ParentElement%'',''%CountofParent%'', ''%ElementLevel%'')');

ODBCOutPut( sSource , sSQL );
ASCIIOutput( 'd:\temp\debug.txt', Account, ParentElement , NumberToString( CountofParent ) , NumberToString( ElementLevel ) );

ParentCounter = ParentCounter+1;
END;

#Section Epilog


 

You need to adjust the TM1 code to be working for you.

 

More Information:

https://itlink.com.sg/wp-content/uploads/2023/07/TA2019005-Extracting-TM1-Dimension-Hierarchy-using-TMVGate.pdf 

https://github.com/cubewise-code/bedrock 

https://cubewise.com/blog/mastering-hierarchies-in-ibm-tm1-and-planning-analytics/ 

https://everanalytics.wordpress.com/2015/12/02/closer-look-at-the-dimensionsortorder-function-in-cognos-tm1/ 

https://exploringtm1.com/unwinding-removing-the-structure-from-a-dimension/

https://lodestarsolutions.com/level-0-not-leaf-planning-analytics-tm1-set-editor/ 

https://cubewise.com/functions-library/tm1-function-for-rules-ellev/ 

https://cubewise.com/functions-library/tm1-function-for-ti-odbcopenex/ 

https://quebit.com/askquebit/how-to-speed-up-tm1-odbc-output/ 

https://jpbi.blogspot.com/2007/05/sql-trick-for-flattening-parent-child.html 

https://www.ibm.com/support/pages/ibm-planning-analytics-20-fix-lists