Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP8/9 Function in detail band of report problem
Message
From
02/03/2006 17:03:54
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
VFP8/9 Function in detail band of report problem
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01101094
Message ID:
01101094
Views:
52
I cannot believe that after all this time we are just now noticing this problem but I guess no one followed these steps before at our customer sites.

I have a few reports which print a detail line and a summary section. In these reports, one of the items in the detail band calls a function and does computation. The total from the computations is printed in the summary band.

*--Simplified Example prg
USE mytable
STORE 0 TO totcomcash

LOCAL oPreviewForm
oPreviewForm = NEWOBJECT('PreviewForm', 'Pro32.vcx')
REPORT FORM (rpttoview) &prescope FOR &forclause TO PRINTER PROMPT WINDOW PREVIEWFORM PREVIEW
oPreviewForm.Release

*--Simplified example of Function chkcomm()
FUNCTION chkcomm
LPARAMETERS xreport
totcomcash = totcomcash + fieldvalue
RETURN

The expression in the field in the detail band of the report is:

chkcomm("XMITTAL")

Nothing prints in the detail band (as it should not), but in the summary band there is a field to display totcomcash (as well as many other totals which are summed in chkcomm() as well).

The problem doesn't occur until the user previews the report and during preview, clicks on the pages of the detail band (if only one page then for example he/she clicks on page 1 over and over) to zoom in and zoom out. Everytime the detail page is refreshed the function is called and the value of totcomcash is doubled, tripled, and on and on.

I never noticed this before and now I have to step through every report and look for function calls in fields that could have their total adjusted by zooming in/out on the detail pages in preview mode. All of our reports have numerous variables that are setup in the report itself (under report, variables in design mode) but we also have some that are created before the report is run and totals are created during the running of the report. A big job of ahead checking all of the reports (there are 153 of them) and in the case of chkcomm() it sums 15 variables (I only showed one in this example).

Does anyone, by anychance, have a better idea? I can't really step through the table and summ the values before the report is run in this case because the report is called from many locations and conditional filters are set. (A lot of coding involved to change the sequence of events in this process).

I have 153 reports x 4 versions of the app to check/verify/fix. These reports are used in FPD26, VFP7, VFP8, and VFP9 versions of our app and I will have to walk through 612 reports with anywhere from 5 to 100 fields on each report)
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Next
Reply
Map
View

Click here to load this message in the networking platform