Overview
This article discusses the Contact Database with Sample Report Applet available in the HanDBase Gallery.
The applet includes a Sample Report that shows how the Print Report function of the HanDBase Desktop works.
It pulls data from the Contact Report database, Contact_Report.PDB, and displays it in the report in a more usable
format. You can then save or print that report to have a better formatted hard copy.
Sample Files
Click the following link to download this applet from the Gallery.
Contact Database with Sample Report Download
The file is a ZIP file. Once you've downloaded it you'll need to un-zip it first.
Getting Started
In order to use this report, or any reports you create, first make sure you have the latest build of the HanDBase software on your
computer. Since the Reporting function was released the location of the reports has changed a few times. The latest version of the software, at the time of this writing/posting, properly references the current location
that the .htm Report files need to be in. Once you have the latest version of the software installed you will want to save or copy the
ContactReport.htm file to the following location. (If the Reports folder does not exist for some reason please create it there, using the
same capitalization):
Windows XP or older Users:
..\My Documents\HanDBase\Reports\
Windows Vista and Windows 7 Users:
..\Documents\HanDBase\Reports\
With the file saved in the proper location open the Contact_Report.PDB file in the HanDBase Desktop. You can do this by going to
the File menu and choosing Open and then clicking the Browse Files button and navigating to where you saved the file.
With the Database open click on the File menu and choose Print Report. You'll see a new window open and it will show the Report
Name, which is basically the .htm file name without the .htm extension. Highlight that report name and click Next.
The Report will be displayed so you can preview it. You then have the options to Save it, as an HTML, .htm, file, which can then be opened in a web
browser. Or you can Print it right from there.
If you decide you want to make changes to the report or the data, or if you just wanted
to view it on your screen, you can just click Finish.
When you view or print this report you'll notice that the records show up in a table format for one. You'll also notice that the Address
information is all in one cell, even though the data is in 4 different fields. The same goes for the Phone Numbers. These are just some
of the things you can do with reports.
Structure of Report Template Files
Reports for HanDBase are written in standard HTML. However, you will leave out the normal opening and closing tags of
a normal HTML file:
<HTML></HTML>
<HEAD></HEAD>
<TITLE></TITLE>
<BODY></BODY>
If you happen to create your report using an HTML editor you will want to open the file in a Text editor and remove
these tags to avoid any issues.
Most other standard HTML tags can be used such as the following:
<B></B> - Bold Text
<I></I> - Italicized Text
<H#></H#> - Larger Heading Text
<IMG></IMG> - Image file reference
HTML Table:
<TABLE>
<TR><TD></TD></TR>
</TABLE>
There are many others which we won't document here but can easily be found online. You can find most of these on sites
like http://www.w3schools.com/tags/default.asp
When you create your HTML report file make sure that the file name has a .htm extension. Files with the .html extension will
not be recognized by the HanDBase Desktop when looking for reports.
When you create a Report, make sure that the first line of your .htm file is the actual database name that you are associating this Report with. This is not the file name but the Database name that you find in the General section of the DB Properties. Make sure that the very first line of your
.htm file has this name, including any spaces or other characters.
Data Aware Tags
To show the actual data from your HanDBase Database records, your template will need to contain tags that will be replaced with data when printing from within HanDBase. These are called data aware tags and look pretty much like regular HTML tags.
Field Tags: Tags identified by name 'field' followed by a field number are exchanged for valid record data:
<field1> ... <field100>
For example:
First Name: <field3> Last Name: <field4>
Link Tags: If a field follows a link, then it can encompass those fields that will be followed on the next database:
<follow field9> <field1> <field2>
</field9>
Once you begin a link tag pair, whatever data aware tags are used, will be filled with the data from the linked database. Link tags may be nested up to a total of 4 databases deep (including the Link/calling database).
Conditional Tags: Conditions are specified with and 'if' tag/block, a sole parameter is specified and that's the field to evaluate:
<if field14> Cost: <field14> </field14>
Although these tags can be used with Checkboxes, they can also be used with Float or Integer type fields (0 is false, any other is true) and even Note/Text type fields (no text/empty text is false, at least one character in the field is true).
Sample Report
The sample report included in this applet, ContactReport.htm, has a number of comments in it so you can see how certain things
were done. The HTML code is displayed below. This is the same thing you'd see if you open the ContactReport.htm file in a text editor.
Where to Find out More
If you are familiar with HTML code, the above should be enough to get you started. If you are not familiar with HTML, we suggest either reading up on the HTML format via many great sites on the internet that offer help on this, or using a WYSIWYG (What you see is what you get) editor such as Mozilla's Composer.
More complete documentation on the tags we do and don't support is available in the HanDBase Desktop for Windows Documentation - Click here
Specifically see the section under Advanced Features, Printing Records, Print Reports.
Need further assistance? We'd suggest searching or posting in the online support forums for the Windows Desktop version here:
http://www.ddhsoftware.com/forum/viewforum.php?f=13 |