Report Printing (by Richard Gaskin)

J. Landman Gay jacque at hyperactivesw.com
Sat Jun 14 23:04:01 EDT 2003


On 6/14/03 1:50 PM, Richard Gaskin wrote:

> Did HC's report tool do columnar reports?

Yes. You do it the same way Jeanne described for a Rev report, in 
another message on this list. Just abut a number of print items in a 
horizontal row, one item for each field reference, and then set the 
height of the report to the height of the fields, and set the report to 
print multiple cards on a page. The distance between the bottom of the 
row of fields and the bottom of the report will be used as the line spacing.

HyperCard also provides a "column" setting in which you can specify the 
number of columns on a page. This works more like a newspaper printout. 
You set up a single, tall, skinny print item the width you want the 
column, and place it at the left of the page. When it runs a report, 
HyperCard will wrap the text into as many columns on the page as you 
have specified. When a page fills up, HyperCard continues the text in 
the first column on a new page.

> I'd opened it and poked around prior to posting, but could only find
> capabilities similar to Rev's Report Builder.

HyperCard offers far more. The most important difference is the ability 
to assign global variables and custom functions to print items. With 
these two capabilities available, I never did need to use Reports Data 
Pro. The custom function business is especially useful. It allows me to 
set up a print item whose contents is "myPrintFunction()". Then in the 
stack script, I'll put a function with the same name that gathers stack 
data and returns it in some customized way. HyperCard calls the custom 
function while setting up the printout, and uses the value returned to 
populate the print item contents. This allows tremendous flexibility and 
you can print just about anything in any order.

Even easier is to run a custom function before printing that populates a 
global variable. Then assign the name of the global to the print item 
contents.

(Print items can also contain literal text or field references, but we 
can do that with Rev's report setup too.)

HyperCard's print items also allow multiple field references to be 
strung together in the same print item, separated optionally by any 
HyperTalk syntax or literal text. For example, I could put this into a 
HyperCard print item:

   (fld "first") && (fld "last") && "cordially invites you to" && (fld 
"occasion")

and I get: "Mary Jones cordially invites you to the barbeque of her pet 
pig."

HyperCard's print items have their own text and object properties which 
can be different than the linked fields in the stack; for example, a 
bordered field in a stack can be set up to print without borders. Text 
font, line spacing, text style, etc. can all be different than the 
source field. If no particular settings are indicated, HyperCard uses 
the text properties of the linked field, including text with mixed 
styles, while still respecting the object properties of the print item. 
Print items that use things other than field links for their contents 
can also be set to use styled text in any font.

HyperCard provides a limited header that can auto-calculate page 
numbers, the name of the stack, the time, and/or the date. You can use 
any of these, or none, or include your own custom text. Header font and 
textstyle can be set. You are limited to three header items, but those 
items can be placed individually at left margin, center, or right margin.

Linked field references can be either a name or a number. Unlike 
Revolution's method, this allows whole reports to be portable and they 
can be copied and pasted from one stack to another. As long as the 
second stack has fields in the same order, or fields with the same 
names, the report will work. HyperCard ships with report templates for 
most common Avery labels, for example, and you can paste the ones you 
need into your own stack. If you don't want to actually move the report, 
you can just put the Address stack in use and its report templates 
become available everywhere.

> If so, it would be useful to review that interface for ideas on building a
> replacement,  though it's hard to imagine it could compare to the more
> comprehensive options of specialized third-party tools like Reports Data
> Pro, which might make a better model to follow.

You might be surprised. I think if Revolution would allow the assignment 
of global variables and custom functions to print items, we could get a 
good chunk of what HyperCard offers. Reports Data Pro adds a provision 
for selection criteria to determine which records to print, but since 
Rev already supports the printing of only marked cards (as does 
HyperCard) it is a simple thing to just mark the cards you want to print 
before running the report.

The only thing I couldn't do in native HyperCard reports which I *can* 
do in Revolution is add graphics to a report. The inability to add 
graphics was the print engine's biggest liability, I think. But for 
basic text reports, I don't think you could go wrong by emulating 
HyperCard's print engine.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list