TextOutput

TextOutput writes a comma-delimited record to a text file.

This is a TM1® TurboIntegrator function, valid only in TurboIntegrator processes.

By default TextOutput writes characters in the locale character set of the server machine. To create a file in a different character set, call the function SetOutputCharacterSetbefore calling TextOutput.

The text file is opened when the first record is written, and is closed when the TurboIntegrator procedure (Prolog, Metadata, Data, or Epilog) containing the TextOutput function finishes processing.

If you use the TextOutput function to write to the same file in multiple procedures (tabs) of a TurboIntegrator process, the file will be overwritten each time it is opened for a new procedure.

Each output record generated by TextOutput is limited to 8000 bytes. If an output record exceeds 8000 bytes, the record is truncated and a warning is logged in the TM1ProcessError.log file.

When TextOutput encounters a String argument that pushes the output record beyond the 8000 byte limit, it ignores that argument and any further arguments. For example, if there are 10 String arguments and output for the first seven arguments total 7950 bytes while the output for the eighth argument is 51 bytes, only the output for the first seven arguments will be written to the record. If there are ten String arguments and the first argument is over 8000 bytes, no output will be written to the record.

The TextOutput function generates a minor error if an error occurs while writing the text file. In addition, the function returns a value upon execution: 1 if the function successfully writes the text file and 0 on failure.

The error will be generated and the value returned only when TextOutput is writing to a disk other than the one that the server is running on. For example, if the server is running on the C: drive and TextOutput is writing to the F: drive, and the F: drive runs out of space, the error will be trapped and the server remains alive. If the server is running on the C: drive while TextOutput is also writing to the C: drive, and that drive runs out of space, the server will terminate (as expected).

Syntax

TextOutput(FileName, String1, String2, ...Stringn);

Argument

Description

FileName

A full path to the text file to which you want to write the record. Path must include a file extension.

String1...Stringn

A string that corresponds to each field you want to create in the text file. This argument can be a string or a TurboIntegrator variable for a string.

Example

TextOutput('NewCube.cma', V1, V2, V3, V4, V5 );

This example writes a record to the NewCube.cma file. Each field in the record corresponds to a variable assigned by TurboIntegrator to a column in your data source.