The function add_to_output puts output in a document; multiple calls to add_to_output( ) will be concatenated into 1 output document.
add_to_output ( "outputdocument_to_be_produced";
"path_folder_of_the_output_document";
"Overwrite Y/N"; "pagination (ignored)";
"process_includes Y/N" )
The result of this function is of type TEXT, it is the path and name of the document produced. A txt model will produce a txt file; a Microsoft Word model will produce a Microsoft Word document. This function has five input parameters of type TEXT:
The function add_to_output( ) writes the ITP output to a document, and does not create a copy. Once written to a file the output is no longer available for the ITP Model. The reason for this is that ITP stores text that is produced in an internal buffer. When you call the function put_in_text_file ITP writes the content of the buffer into the file, this clears the internal buffers.
If you want to create multiple documents from one output you can use the open buffer mechanism.
Documents that ITP produces through the add_to_output( ) function are only available for opening after ITP successfully completed the model run.
Example
TEXT outputdocument_to_be_produced := "output.doc"
TEXT path_folder_of_the_output_document := "c:\temp\"
#
This is the first part of the result document that will be put in the output document.
#
TEXT doc := add_to_output(outputdocument_to_be_produced; path_folder_of_the_output_document; "Y"; "N"; "N")
#
This is the text that is produced after the first function call. It will also be placed in the output document by the next function call.
#
ASSIGN doc := add_to_output(outputdocument_to_be_produced; path_folder_of_the_output_document; "Y"; "N"; "N")
#
The file produced is @(doc).
#
Note
If you call the function add_to_output( ) in a Microsoft Word DOC model, you should be aware that the final output document must end with a paragraph ending. Otherwise the Microsoft Word DOC document you produce can cause errors in Microsoft Word.