Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP8/9 Function in detail band of report problem
Message
 
 
À
02/03/2006 17:03:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01101094
Message ID:
01101122
Vues:
17
The simple idea that comes to mind is to have a condition to not increment totComm, when zooming in/out. E.g.

private pnTotalLines
pnTotalLines = 0

In your program

pnTotalLines = m.pnTotalLines + 1


pnTotalLines should be equal to the number of records in the table. So, you should increment your total value only if pnTotalLines < than number of records.

That's just a quick idea, see, if you can work it out.

>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)
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform