Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What has happend with preview report in VFP7?
Message
 
À
19/10/2001 03:31:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
00565389
Message ID:
00571169
Vues:
23
>This sounds like the problem I have... I'm using a private datasession created with the session class. Is there any solution to it?

Yes, but they involve a fair amount of programming, depending on what you want to do. I'll sketch some ideas out here about what we did.

We wanted to be able to let the user view multiple reports on the screen at once. It actually does work (finally). But what you need to do is define the report (report designer) as running in a private data session.

This turns out to be a real pain in the ass. My biggest problem was that I used to (in FP2x) create first run an "initialization" program that would create memvars, cursors, and relations to create an "environment" where the report would run. When you use a private data session these no longer are available.

So our report driver program actually works in 2 different ways. When printing to a PRINTER, it uses the default datasession -- called from a SESSION object, but it works OK. First it runs the "init" program. The variables and cursors are there, so everything is cool.

But when you PREVIEW to the screen, it does the opposite. It runs the report in a private data session. It starts the report. Then the data environment calls a special program which runs the "init" program to create the cursors, etc.

You should now ask me how the same report can run with private data session in one case and default data session in another. The answer is you have to learn to hack an FRX! We let our users design their own reports, by the way. But we never run the report they design. We copy it to a temporary FRX and run the copy. During that copy process, we stick in the appropriate data environment.

The story about memvars is even worse, but running a copy of the FRX is again the secret. Let's suppose that the user want to run the report twice, once for today's date, and once for last month's date. We put the ASOF date into a variable ldASOF which we want to display on the report... But I need different values for each execution. And the user might page forward and back on each open preview. And the problem is that the data environment can call all the programs it wants, but variables these programs create disappear when the program does. So I can't create variables. The trick that worked for me was to stash them in a custom object pointed to by a global variable named goREPORTnnn, where nnn is the DataSessionId. So the variable's value is actually eval("goSession" + ltrim(str(this('datasession'))) + ".ldASOF"). I stick that into a report variable (See the report designer) called ldASOF, and the whole thing works!

The good news is that once you build the machinery and make it work, you can then get back to application programming!

Tom
Tom Green in Montreal
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform