|
|
Crystal Reports:
How to email report data
in a table in an HTML edited message
HTML includes a useful TABLE feature where you can load
multiple columns and rows, and we already had some useful table
formatting logic in our
Grid UFL.
So we’ve now combined that grid logic into a new set of
functions in our
SendMail UFL.
It lets you build a table of data to insert into the HTML
message. It works really well in a subreport and does support multiple
tables in one HTML message.
A formula in a header section creates the work area for the
table:
WhilePrintingRecords;
SMTPTableClear;
SMTPTableBuildNew (Count({Table.RecID}) + 1, 2);
SMTPTableLoadCell (0, 0, “Date”,"");
SMTPTableLoadCell (0, 1, “Activity”,"");
The grid can be built up with a formula in the details section:
WhilePrintingRecords;
SMTPTableLoadCell (RecordNumber, 0, ToText({Table.RecDate}),"" );
SMTPTableLoadCell (RecordNumber, 1, {Table.RecText},"");
And then the grid will be saved into the HTML file and replace a tag in
the template file.
WhilePrintingRecords;
SMTPTableSave ("{Customer Activity}", "")
Here's some more information on GRID UFL.
With GRID UFL, you can export structured data to Excel or
another application.
Main features:
-
Absolute control over grid size, format, and content.
-
Control over individual cell entries.
-
Export file is created while viewing the report.
-
Can create multiple files from one report.
-
Works with a range of Crystal Reports versions.
-
Easy installation.
-
Easy administration.
Grid UFL provides you the proper control of your Crystal Reports
Export. The ability to export your reports to another application or format is
one of the really useful features of Crystal Reports. But when you do this, you
run into the limitations of both Crystal Reports and the other application. Grid
UFL helps you overcome those limitations.
A really useful UFL:
Grid UFL allows you to treat your saved data as a Grid. To do this, you use the
GridCellClear (rows,cols) to declare a work area of a predetermined size. This
formula should normally be in your report header section. Then use other
formulas in your group and details section to save values in the grid.
You can use GridCellLoadRawValue (row, col, value) to store a value in the
working area. You could also use GridCellLoadDelimitedValue(row, col, value,
delimiter) to automatically put quote marks or some other field delimiter around
the value.
You can save it all to the disk file with GridCellSave(Filename,Separator). Use
a comma, tab character or any other ASCII value to separate each value on each
line of your disk file.
Think of the possibilities. Grid UFL opens an enormous number of them.
Just for example, consider:
-
Use the GridCellClear (rows,cols) to declare a work area of
a predetermined size. This formula should normally be in your report header
section.
-
Then use other formulas in your group and details section to
save values in the grid.
-
Use GridCellLoadRawValue (row, col, value) to store a value
in the working area. You could also use GridCellLoadDelimitedValue(row, col,
value, delimiter) to automatically put quote marks or some other field
delimiter around the value.
-
Then save it all to the disk file with
GridCellSave(Filename,Separator). Use a comma, tab character or any other
ASCII value to separate each value on each line of your disk file.
This article is copyrighted by
Crystalkeen, Mindconnection, and Chelsea Technologies Ltd. It may be
freely copied and distributed as long as the original copyright is
displayed and no modifications are made to this material. Extracts are
permitted. The names Crystal Reports and Seagate Info are trademarks owned
by Business Objects.
|