add_to_output

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:

  1. outputdocument_to_be_produced, type TEXT.
    The name of the document that will be produced.
  2. path_folder_of_the_output_document, type TEXT.
    The path and name of the folder or folder in which the output document will be written.
  3. Overwrite Y/N, type TEXT.
    When you set this parameter to Y an already existing document is overridden, when you set this parameter to N the end user will be prompted to specify an alternative filename/folder. Note that interactivity is not possible in an ITP/Server environment.
  4. pagination, type TEXT.
    The value of this parameter is ignored.
  5. process_includes Y/N, type TEXT.
    Resolve __INC post includes in the result document. When you have enabled the check box 'Process includes' on the 'Run' tab of the ITP administration program, ITP will always resolve post includes.

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.