How To Use @Include In Reports
The @include command is used
in reports to tell Collect! to include the contents of
a file when it parses a Report Body. The include files
are simple ASCII text, with a *.txt extension. You may
also embed database field printable information codes in
the text and Collect! will parse them correctly.
These files make it very easy to quickly
customize a whole series of letters or reports, as
changes to the text file will affect any report that
calls that file with the @include command. You may
use this for templates, styles, or for loading any
frequently used report component into your reports
before printing.
Place the @include command at the beginning of
a new line in the report. Do not place any other code
or text on the same line. Place the @include command
at the place in the report where you want the contents
of the include file to be placed.
Examples:
1. Simple letter header
Contents of sample include file, "header.txt"
@Line(73,935,730,935,0,1,0,0,0)
@T
@!@=@cd.na<@=@!
@H @=@cd.ph@=
@LM(124)
@e
@de.na
@de.ad< @de.a1<
@de.ci<, @de.st<
@de.zi<
To place this header in a report, place this line
at the top of the report body.
@include header.txt
2. Web Host report include file
Contents of sample include file, "buttonsearch.txt"
<div class="menu">
<table class="buttons" cellspacing="0" cellpadding="0">
<tr>
@varSearchType* = @tvarTitle
@varClass* = "tabon"
<td class="@varClass">
@varSearchType< |
</td>
@varClass* = "taboff"
<td class="@varClass">
<a href="search.html"> Search Again |</a>
</td>
@varClass* = "taboff"
<td class="@varClass">
</td>
</tr>
</table>
</div>
To use this code in a Web Host report, include
the following command in the report body.
@include buttonsearch.txt
The report system looks for include files in two ways,
depending on whether or not Web Host is serving the
report request.
1. When generating reports with the Web Host,
the system looks for the @include file in the HTML folder
hierarchy, starting with the operator's folder and moving up
to the User Level folder, and then finally, if the file is still
not found, into the global user folder. This allows you to
simplify and standardize your web page reports.
2. If reports are being run from Collect! when not in
Web Host mode, then the report system looks for include
files in the Collect! application's Styles folder. This allows
for common information on reports to be stored in one
file and used on various reports, for example, a
company letterhead.
Include With If Statements
You can use IF statements with the @include
command to load files conditionally when your report prints.
Example:
@include header1.txt if ( @de.cn = 92 )
@include header2.txt if ( @de.cn = 98 )
@include header3.txt if ( @de.cn = 101 )
This example loads a different header file depending
on the Debtor's Client.
Conditional @include
statements must be evaluated before the report is run.
This means you cannot put them inside a loop within
the report. For instance, if you printed a report to all
debtors and tried to put the example code shown
above inside the @de no total loop, it would not be able
to evaluate the different conditions. However,
conditional @include statements
work very well in batch letter processing, so that you
can output different headers for different clients'
debtors as shown in the example script above.
Summary
The @include command is used
in reports to tell Collect! to include the contents of
a file when it parses a Report Body. This make it very easy
to quickly customize a whole series of letters or reports,
as changes to the text file will affect any report that
calls that file with the @include command.
When using @include, keep include file
names simple like "header.txt." Do not include a full path
when using the command in your report. Simply place your
include files in the Styles folder of your Collect! application.
There are many examples of include *.txt files
included in your Collect! installation. Look in the Styles
folder for include files used in Collect! sample reports
and in the Html folders for include files used with
Web Host reports. Examine the sample reports
in the Report Definition Lists to see how these include
files are used.
See Also
- Report Sample to view sample reports and letters
- Report Topics Index for a list of all report and letter topics
- Web Host Topics
|
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