Help  |   Contact Us  |   About Us  |   News and Events
Books, conferences, and other information about... Moving to Linux Switching to OOo Building Linux Apps Using Visual FoxPro
Buy      Download      Your Account      Catalog      Support      Conferences      Resources      Fun

The Visual FoxPro Report Writer: Pushing it to the Limit and Beyond

If you have a question about the technical contents of this book, please contact the author(s). Their email address(es) can usually be found in their bios in the About the Author section at the front of the book or on the author's bio page (click on the author's name on the book's main page.


I just read a thread on the UT which made me slap my head and go Doh!!

When we needed a picture of a report in the book we previewed it on the screen, did a screen capture with Snagit for the top half, then did a capture of the bottom half of the screen, then used another application to merge the two halves together.

The better way …. Print the report and select “SnagIt” as the printer driver!! It saves the report to whatever graphic format you choose!!!

Page 45.

Item 4. near the end of the page says to remove the object when it’s blank. However, in some versions of VFP, the “Remove line if blank” option is disabled for objects in the summary band. In VFP 8, this has been corrected.

Page 216.

The following text (located immediately above/before Figure 14): ‘o’, ‘x’, ‘o’, CHR(251), ‘o’, CHR(252), CHR(253), CHR(254), respectively.

should read as follows:

‘o’, ‘x’, ‘o’, CHR(253), ‘o’, CHR(254), CHR(251), CHR(252), respectively.

Page 217.

In the section titled, “How do I create a Report template?” it says, “I’m taking Ted’s word out of context”. This should say, “I’m taking Ted’s words out of context”. After all, when has Ted ever said just ONE word!!

Page 226.

In the section titled, “The position”, the magic number is incorrectly stated as 1979.16666666. The correct number should be 2083.33333333. It may be that very old versions of FoxPro used the other number but I can’t test this theory at this time. I also can’t test the magic number for centimeters so be aware that it may also be incorrect.

Page 229.

The last item in the table, RULER, should have the following description:

1 = Ruler measurement is determined by the System Default
2 = Ruler measurement is in metric
3 = Ruler measurement is in pixels

Page 256.

Half way down the page, it says, “the specified expression without preceding it with a carriage return / life feed.” While I try to breathe life into my apps, in this case the second to last word should be “line”, not “life”.

Page 230.

The ObjType and description for the STRETCH and STRETCHTOP fields are incorrect. They should say the following:

Field ObjType Description
STRETCH 6-Line & .T. = The Stretch relative to height of band check box on the
7-Shape object’s property dialog has been checked
8-Field Corresponds to the Stretch with overflow check box on the
object’s property dialog
STRETCHTOP 6-Line & .T. = The Stretch relative to tallest object in group check box
7-Shape on the object’s property dialog has been checked

Page 230.

The description for the TOP field for ObjType = 1 is incorrect. It should say the following:

.T. = Print area is “Whole page”
.F. = Print area is “Printable page”

Additional Bug Alerts

Bug Alert: If you include a Picture/ActiveX bound control on the report, you cannot set the band height to zero. The Report Designer keeps resetting the band height to the height of the Picture/ActiveX object, less the height of the gray bar defining the band.

Bug Alert: If you issue the REPORT FORM command from a form that has a grid, it’s possible for VFP to switch the current alias to the RecordSource of the grid right out from under you. This means you can preview the report, then the current alias gets switched, and then when you try to print the report the wrong alias is selected causing all kinds of problems. To solve this problem, programmatically take focus off of the grid before issuing the REPORT FORM command.

Bug Alert: A label object that is greater than 38 characters in length, right-aligned, has a proportional font, and is positioned all the way to the right of the report … will crash VFP!!

Additional tips and tricks

“How do I create a diagonal line?”

The answer is to hack the FRX. First, add a horizontal line to the report. Then hack the FRX, changing the height and/or width accordingly.

“How do I create dot leaders, such as those used in an index?”

Add a Field object with the expression for the text you want to precede the dots. Make sure you add ALLTRIM() around the expression and set the Mode of the Field object to Opaque. Now add another Field object on top of the other one, making it wide enough to extend to the end of where you want the dots. The expression for this object should be REPLICATE(‘ .’, 100). You can change the value of 100 to a higher number if necessary depending on the width of your object. Do not set this object as Stretch with overflow. Once you have this object defined, select it and select the Send to Back option so it is behind the real Field object with your text. Because your real Field object is opaque, it will cover up all the dots in the beginning of the expression and you’ll only see the dots that appear the real text!

“How do I remove extra space in the detail band when no picture prints?”

The trick to solving this problem is understanding how Remove when blank works. Let’s say you define the detail band to have a few Field objects on the left side and put a picture to the right of the Field objects. Obviously, the picture is much taller than the one line of Field objects. You check the Remove when blank check box because you know that sometimes you don’t have a picture to print and you don’t want to waste the extra vertical space on the report.

Unfortunately, when you run the report each detail band prints with enough space to accommodate the picture, even when there isn’t a picture. The reason this is happening is because VFP looks at everything within the same horizontal space as the picture to see if anything else is printing. If it is, it doesn’t bother to remove the extra space. Because you have the detail information printing in line with the picture, it doesn’t bother removing the space.

To solve this problem add a horizontal line beneath the picture. Set the Print When expression to .f. so this line never prints and check the Remove if blank check box on the line. Now what happens is VFP looks at this line, sees that it isn’t printing, sees that it’s marked as Remove if blank, sees that nothing else is printing in the same horizontal space as the line, so now it removes the line and any extra unused space above it. This means it removes the extra space between the actual text you printed and the horizontal line.

Additional Commercial Products

Mind’s Eye Report Engine The Mind's Eye Report Engine Professional Version ActiveX Control makes it easy to do graphs and barcodes in a Report as well as support for saving reports to PDF without requiring any 3rd party PDF printer drivers or tools. Both versions support ZOOM levels greater than 100,000%, PAGE X OF Y without making any extra passes on the Report, appending multiple VFP Reports of Different Page Sizes and/or Page Orientations into a Single Report Preview thus allowing multiple reports to be sent to a single print job or single PDF document (PDF output requires Pro Version). Since there is VFP code driving the Report Engine you can even extend it's capabilities to add support such as Subreports and more. It's like having a desktop publishing page layout tool that you can manipulate programmatically.The Power of this tool is that you now have a Report Object that you can manipulate at runtime and it is extremely fast.

Contact Information:

Mind’s Eye Inc.

Stonefield Query Stonefield Query is a powerful query builder and report writer. In May 2000, the reporting engine in Stonefield Query was awarded the Developer's Choice Award for Best Reporting Tool at the DevConnections 2000 conference in New Orleans, sponsored by Microsoft. At the 2002 FrontRange Partner Conference, Stonefield Query was the winner of the Best Integration award.

Stonefield Query has a simple "wizard" interface. After selecting a report from the list of available reports, you can select the sort order, enter filter conditions, and select where the output should go (printer, disk file, spreadsheet, screen preview, etc.).

In addition to running pre-defined reports, you can create your own "quick" reports in just minutes. Simply select which fields to report on from the list of available fields (full English descriptions rather than cryptic names and symbols), and you're done! You don't have to know complex stuff like join conditions; Stonefield Query takes care of that for you.

For finer control, you can select how each field should appear from a "Field Properties" dialog, including column heading, grouping, and totaling. The easy-to-use query dialog allows you to include or exclude specific records. Use the sort page to order the information how you need it. Finally, save the report so you can edit it, copy it, or make it available to others to run.

Contact Information:

Stonefield Systems Group Inc.
1112 Winnipeg Street, Suite 200
Regina, SK
Canada S4R 1J6