Debugging Turbo Integrator processes

Introduction

None of us writes perfect Turbo Integrator (TI) processes without at least some fair amount of trial and error. Trial and error will obviously decrease with TM1 seniority and general coding skills. Unfortunately, TM1 does not contain a native debugger. What hope is left?

Points to note

Here are a couple of points to take into account when debugging a TI process:

  • The most used debugging functions are ASCIIOUTPUT and TEXTOUTPUT.
  • The first argument of both functions should be the file name. If you do not specify the path location, the database directory of the TM1 server is used.
  • Separate with comma’s what you would like to output in the text file.
  • The CMA file extension is often used for this kind of files. If you do not specify the file extension, CMA is used. If you use CSV or TXT, opening up the resulting file in Excel is easy.
  • Numeric data should be converted to a string if you want to output them using ASCIIOUTPUT. Use for instance the NUMBERTOSTRING function.
  • Depending on the version of TM1, make sure the length of 1 sentence in the output file is not too long.
  • Any ASCIIOUTPUT statement in the Metadata or Data tab towards a certain file, will automatically overwrite (hence, delete) that file. This means that an ASCIIOUTPUT statement in the Prolog tab to the same text file will not have the intended purpose. Have a look at this page for a good workaround.
  • I regularly use a temporary cube or dimension to hold data, and be able to evaluate the process. Delete the cube or dimension afterwards, or clear the area in the cube. In those cases where I do not have access to the TM1 database directory, I could use a test cube or dimension to output results into. Note: as from TM1 version 10 onwards, the DIMENSIONELEMENTINSERTDIRECT function in TI lets you insert elements in a dimension in the Advanced > Data tab of a process. You do not have to duplicate your Data tab code in the Metadata tab to debug.
  • The PROCESSQUIT, ITEMSKIP, ITEMREJECT and LOGOUTPUT functions are also good tools to evaluate processes.
  • Probably the most frequent (and dangerous!) error is forgetting to increase the counter variable in a WHILE … END loop. It might hang the TM1 server and you will want to use TM1 Top to solve this annoying situation.
  • Turbo Integrator contains functions to format the output in the text file. Consider the DatasourceASCIIQuoteCharacter function as well as other DatasourceASCII functions.

Sample code

Below is an example of the ASCIIOUTPUT function. As can be seen, that function can handle text, converted numbers and other functions.

# Wim Gielis # https://www.wimgielis.com
##### # Example of the ASCIIOUTPUT function # 04/04/10 #####
i=1; WHILE(i<=DIMSIZ('P&L accounts')); ASCIIOUTPUT('April 2010 P&L data by account.cma', DIMNM('P&L accounts',i), 'has a value of', NUMBERTOSTRING(CELLGETN('P&L','2010','April',DIMNM('P&L accounts',i)))); i=i+1; END;




Homepage

Section contents

About Wim

Wim Gielis is a Business Intelligence consultant and Excel expert

Other links