The Readerware Report Writer Window

The Readerware Report Writer allows you to easily define your own custom reports, you can print the results or create an HTML file that you can use on your web site.

The input to the Readerware report writer is an HTML template which defines the layout and formatting options of the report. Readerware then merges in the data from your database and displays the output.
 

Printing a custom report

The easiest way to get started is to use one of the example templates that are shipped with Readerware. To produce a report do the following:
Do a search to establish the content for your report. The Readerware report writer uses the current search results as input. So you could search for all titles to produce a full report, search by a given author or category etc.

Open the Readerware Report Writer Window by selecting the File->Report Writer menu item.

Select the Readerware basic image report, (BasicImageReport.html), from the list. You will see a table displayed in the window, but instead of data, you will see text like [[$AUTHOR]], [[$TITLE]] etc. This is the report template, the [[$----] fields identify what Readerware database fields will be displayed and where.

Click on the Run button, , or select the File->Run menu item. Readerware will then populate the report template with the contents of the current search results. The report will then be displayed in the window.

To print the report select the Print toolbar button, , or to save it in HTML format select the Save, , button. You can use the saved HTML file on your web site or load it into your regular browser and print it from there.

To display the report in your default browser, select the Browser toolbar button, . The browser is then opened and the report displayed. You can print the report from your default browser if you prefer.

You can return to the Readerware Main Window and perform another search, then in the report writer just click on the run button again to produce another report with the new data.

That is how you create and print a report with the Readerware Report Writer. Try some of the other sample reports distributed with Readerware. There is an example of creating labels and creating a detail report with images. The next topic discusses how you create the template files.
 

Creating a report template

A Readerware Report Writer template file is in HTML format so you do need to understand a bit about HTML to take full advantage of all the customization and formatting options available.

The basic idea is that you simply create the HTML to produce the desired report, but instead of using real data you use predefined Readerware keywords that determine where Readerware will insert the data. Consider the template for the basic table example used earlier:

<HTML>
<HEAD>
   <TITLE>Readerware Basic Table Example</TITLE>
</HEAD>

<BODY>
<CENTER><FONT COLOR=#0000FF><H2>Readerware Basic Table Example</H2></FONT></CENTER>

<TABLE ALIGN=CENTER BORDER=3 CELLPADDING=5>
<TR>
<TH>Author</TH>
<TH>Title</TH>
<TH>ISBN</TH>
<TH>Est. Value</TH>
</TR>

[[$BEGIN_READERWARE]]
<TR>
<TD>[[$TITLE]]</TD>
<TD>[[$AUTHOR]]</TD>
<TD>[[$ISBN]]</TD>
<TD>[[$VALUE]]</TD>
</TR>
[[$END_READERWARE]]

</TABLE>
</BODY>

</HTML>

This is fairly standard HTML, the interesting part is between the [[$BEGIN_READERWARE]] and [[$END_READERWARE]] lines. These lines mark the section of code that Readerware will duplicate, once for each book to be displayed. You can see that between these lines the HTML statements define a new row within the table. So if you have five books in your result set, Readerware will duplicate this section five times creating a five row table.

Within this section you can see several Readerware database column names, for example [[$TITLE]] indicates this is where Readerware is to place the book title, Readerware simply substitutes these keywords with the database values. That's really all there is to it. Here is the HTML file that Readerware might generate from the above template

<HTML>
<HEAD>
   <TITLE>Readerware Basic Table Example</TITLE>
</HEAD>

<BODY>
<CENTER><FONT COLOR=#0000FF><H2>Readerware Basic Table Example</H2></FONT></CENTER>

<TABLE ALIGN=CENTER BORDER=3 CELLPADDING=5>
<TR>
<TH>Author</TH>
<TH>Title</TH>
<TH>ISBN</TH>
<TH>Est. Value</TH>
</TR>
 

<TR>
<TD>In a Dry Season</TD>
<TD>Robinson, Peter</TD>
<TD>0-380-97581-5</TD>
<TD>$24.00</TD>
</TR>

<TR>
<TD>Roses, Roses</TD>
<TD>James, Bill</TD>
<TD>0-393-04637-0</TD>
<TD>$23.00</TD>
</TR>

<TR>
<TD>The Breaker</TD>
<TD>Walters, Minette</TD>
<TD>0-399-14492-7</TD>
<TD>$23.95</TD>
</TR>

<TR>
<TD>The Running Woman</TD>
<TD>Carlon, Patricia</TD>
<TD>1-56947-110-X</TD>
<TD>$21.00</TD>
</TR>

<TR>
<TD>The Scold's Bridle</TD>
<TD>Walters, Minette</TD>
<TD>0-312-95612-6</TD>
<TD>$6.99</TD>
</TR>
 

</TABLE>
</BODY>

</HTML>
 

Getting Started

You might want to start with one of the examples included with Readerware and adapt them for you own use, or you can start from scratch. Any HTML file stored in the appropriate reports directory will be included in the reports list:
 
Readerware readerware\reports\RW
ReaderwareAW readerware\reports\AW
ReaderwareVW readerware\reports\VW
Mac OS X users will find the reports folder inside the application package. Control-click on the program icon. Select Show package contents from the popup menu. Double click on Contents, Resources, Java, reports.

If you develop custom reports that you think might be useful to other users, please consider sending them in. They may be placed on the Readerware web site where others can use and learn from them. Full credit will be given to the author or you can remain anonymous if you prefer. Just e-mail any templates to support@readerware.com.
 

Report Writer Templates

Report writer templates are standard HTML files with an embedded section that is duplicated for each database record displayed. This section is marked by the following statements:

[[$BEGIN_READERWARE]]
.
.
.
[[$END_READERWARE]]

Sometimes you need to display multiple records within the marked section. Consider a two column table where you want each column to display a record from the database. Effectively you want to duplicate a table row for each two records. You do this with the [[$INCR_READERWARE]] statement. It tells Readerware to fetch the next record from the database. For example:

<TABLE>
[[$BEGIN_READERWARE]]
<TR>
<TD>[[$TITLE]]<BR>[[$AUTHOR]]</TD>[[$INCR_READERWARE]]
<TD>[[$TITLE]]<BR>[[$AUTHOR]]</TD>
</TR>
[[$END_READERWARE]]
</TABLE>

Report Writer Keywords

The following is a full list of the keywords recognized by Readerware. These will be replaced by the appropriate data from the database.
 
[[$AUTHOR]] Book Author
[[$AUTHOR2]] - [[$AUTHOR6]] Additional Authors
[[$TITLE]] Book Title
[[$ISBN]] ISBN formatted for display, e.g. 0-684-87301-X
[[$ISBN-13]] ISBN-13 formatted for display, e.g. 978-0-684-87301-5
[[$RAWISBN]] Raw ISBN, no formatting, e.g. 068487301X
[[$RAWISBN-13]] Raw ISBN-13, no formatting, e.g. 9780684873015
[[$PUBLISHER]] Publisher
[[$BOOKFORMAT]] Book format, hardcover paperback etc.
[[$FIRST]] First edition?
[[$SIGNED]] Signed?
[[$PUBDATE]] Publication date
[[$PUBPLACE]] Place published
[[$COPIES]] Number of copies owned
[[$RATING]] Rating
[[$CONDITION]] Condition
[[$CATEGORY]] Category
[[$READ]] Read?
[[$PRINT]] Include in Readerware reports?
[[$HTMLEXPORT]] Include in Readerware exports?
[[$VALUE]] Estimated value
[[$COMMENTS]] Comments
[[$DATEENTERED]] Date entered into the Readerware database
[[$SOURCE]] Source of import
[[$ROWKEY]] Internal row key, also used to store images
[[$CART]] Book in shopping cart?
[[$ORDERED]] Book ordered
[[$LCCN]] LCCN (Library of Congress)
[[$DEWEY]] Dewey decimal number
[[$DEWEYLABEL]] Dewey decimal number. Standard format, Library of Congress extensions removed.
[[$USERNUM]] User defined book number
[[$COPYDATE]] Copyright date
[[$VALUEDATE]] Valuation date
[[$LOCATION]] Book location
[[$SERIES]] Book series
[[$PAGES]] Page count
[[$KEYWORDS]] Book keywords
[[$DIMENSIONS]] Book dimensions
[[$USER1]] -
[[$USER10]]
User defined fields
[[$LOANTO]] Loaned to
[[$LOANDATE]] Loan date
[[$LOANDUE]] Loan due date
[[$IMAGENAME]] The name of the image file
[[$IMAGE]] The full path of the image file
[[$CURRENTDATE]] The current date

All keywords must be in uppercase as shown above. They can be in any order, but must appear between the [[$BEGIN_READERWARE]]  and [[$END_READERWARE]] lines otherwise they will be ignored.
 

Keyword Modifiers

The following is a full list of the modifiers that can be applied to any of the report writer keywords. These will modify the database values, i.e. display the database value in uppercase.
 
-U Display the value in uppercase
-L=n Limit the value displayed to at most n characters
-S=n Display the value starting at the nth character. This is relative to 0.

The modifiers must immediately follow the report writer keyword. For example:

[[$AUTHOR-U]]
This will display the author in uppercase.

You can apply multiple modifiers to a keyword. For example:

[[$AUTHOR-U-L=3]]

This will display the first three characters of the author in uppercase.
 
 

 

Top of Page


Copyright © 1999-2009 Readerware Corporation