Related Information Examples & Tutorials

How To Print A File In A Report

Files stored in Collect! can be pulled and printed in your reports. Any ASCII text file can be parsed. Line for line, it is copied verbatim into the report as it is printed.

The code for this is:

@file

This statement in a report will insert a file into the print stream. The file is opened in shared mode, and is copied line by line. The statement is only recognized at the very beginning of a line. No other codes or text should be placed on that line.

* You can use a fixed filename, a path\filename, or create a filename from a database field or print variable.

* Text files stored as attachments in the Attachment, Transaction and Contact forms can be retrieved.

Example 1:

@file readme.txt
Collect! looks for this file in the root directory of your Collect! application, for example, C:\CV11\bin\readme.txt.

Example 2:

@file import\debtorcsv.csv
Collect! looks for this file in the import directory of your Collect! application, for example, C:\CV11\import\debtorcsv.csv. (Notice that Collect! will load, verbatim, any ASCII text file extension.)

Example 3:

@de.con where (@co.ty = Other)
@file demodb\attach\@co.at
@de.con

Collect! will look in the current debtor's contact list for a contact type "Other" and will load the file named in the contact's attachment field. The file must exist in the current debtor's attachment folder for this to work.

Example 4:

@de.tr where (@tr.ty = 196)
@file demodb\attach\@tr.at
@de.tr

Collect! will look in the current debtor's transaction list for a transaction type "196" and will load the file named in the transaction's attachment field. The file must exist in the current debtor's attachment folder for this to work.

Troubleshooting

If the file can't be found, the command is ignored. No error message is printed in the report, but if you have verbose and debug on, a message will be printed to the Application Log file, if the file doesn't exist.

You may need to set your printer to Default Printer Stream. Select Print from the top menu bar and then select Report and Printer Setup. When the Report And Printer Setup form is displayed, select Default Printer Stream.

If printing to the printer does not seem to format the file contents properly, try Print To Screen and then immediately choose Print a second time. This time, print to your printer and the file's format should be preserved.

When you use @file, text is copied verbatim into the report as it is printed. If you would like to include report writer codes in the file and have Collect! pull data from database fields, please see How to Use @Include In Reports.

Top of page.

See Also

- How To Use @Include In Reports
- Report Sample to view sample reports and letters
- Report Topics Index for a list of all report and letter topics
- How To Use Debugging Features

Top of page.

Was this page helpful? Do you have any comments on this document? Can we make it better? If so how may we improve this page.

Please click this link to send us your comments: helpinfo@collect.org