AsciiOutput TM1 Function: Use and Syntax
Have you ever wanted an easy way to output data from TM1 so you could then either reload it back into TM1 or load it into your ERP system or load it to an external database for example? Well you can. The TM1 function ASCIIOUTPUT allows you to do exactly that.
Syntax of ASCIIOutput
The syntax is ASCIIOutput (FileName, String1, String2, …StringN); where
- FileName is the path and name of the file you want to create
- String1 is the first variable you want exported
- String2 is the second variable you want exported
- StringN is the Nth variable you want exported
Note: all output values must be strings, not values and the AsciiOutput must be on either the Metadata or Data tabs!
Set the variable vOutputFile to be ‘c:\test.txt’ and we’ll assume that sDate, sDayOfMonth, nExportValue contain values. We have a problem though as nExportValue is numeric and we cannot export a number to a text file. So we will convert it to sExportValue using NumberToString (nExportValue).
Thus the command is is AsciiOutput (vOutputFile, sDate, sDayOfMonth, sExportValue ); which will create the file ‘test.txt’ in the root of the “c” drive and then have the contents of the variables sDate, sDayOfMonth and the string converted value in sExportValue inserted the end of the row of data.
If you need to create a header record with column names in it, please see this post that will explain how to do it.
ASCIIOutput can be used in TM1 Turbo Integrator Processes only.