Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Debugging a report form

Status
Not open for further replies.

chpicker

Programmer
Apr 10, 2001
1,316
Well, since I got such a fast and informative response to my first question on here, I thought I'd try a tougher one. *grins*

Does anyone know of a good way to debug a report form? When an error occurs executing a report form, the debugger's trace window shows nothing (there is no code executing, after all). For example, one of the report forms that I created gives the error "Data type mismatch"...but then still appears to print properly with no fields missing. There is no code whatsoever in the report...everything is either processed ahead of time in the procedure that calls it, or is calculated by the fields themselves in a single expression.

This particular one is merely annoying, since I can hit Ignore and still get the report I want. But ordinarily any error will abort the printing entirely, even if ignored. Is there any way of getting FoxPro to tell you what field in the report is causing the error? (I'm using VFP 6.0 with SP4.)
 
The simple answer is "No, there isn't an easy way to debug reports!". When I get get one of these situations and I can't spot the problem immediately, I invoke the "elimination" method. First make a back up copy of the report files (.FRX & .FRT). Depending how many fields are on the report I'll use one of two techniques. On a "simple" report, I'll remove them one at a time and retry the report until the error goes away. On a complex report, I'll take out a group of fields (about 1/2 at a time) until the error goes away - each time backing up the intermediate form to recover from and cut back on the grouping till I can identify the "bad" field.

Sometimes you get lucky, and sometimes due to UDF()s, related fields and groupings, things can get really complicated.

Rick

 
When you get a data type mismatch, pressing Ignore will usually allow the program to proceed but there will be a difference in your output - generally two fields containing identical information.

One method I've used for debugging is to save the environment immediately before issuing the REPORT FORM command (i.e. CREATE VIEW fix_frx, SAVE TO fix_frx). Then from the command window, issue RESTORE fix_frx, SET VIEW TO fix_frx. Modify the report and do a preview from the command window. Generally the problem fields will surface for correction, one at a time.

Hope this helps.

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top