Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing report variable by reference to a function
Message
 
 
À
25/11/2008 23:52:18
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01364082
Message ID:
01364129
Vues:
16
>>Hi,
>>
>>I would like to know if it is possible to store a value into a report variable on-the-fly? Here is more specifically what I mean.
>>
>>Say in a report column the Expression is a call to a function (e.g. MyFunction()). And say I pass a report variable by reference to this function (using @ syntax). And then the function MyFunction() sets the value to the passed variable. If I use this variable as an Expression in the next column, will it have the value set in MyFunction()?
>
>It should, but.
>
>With code called from within a report, you never know how many times it is called. Specially if there's a preview going on - to show page 7, VFP evaluates and sizes up everything on pages 1 through 6, then renders page 7. Which means that any code in the expressions on these pages is also run when the expressions are evaluated - some of them twice (not sure this still holds, I observed it in several versions of VFP, but don't remember which). If you're using _pagecount variable, whole report is run just to calculate the total number of pages - and all the code on each page too (some of it maybe more than once).
>
>I hope you got the picture. My guess is that it will work, but you'll get a few surprises, aka "unexpected behaviors".

Yes, it's probably better to create a cursor in that function and use it instead of the variable.
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform