Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Doing away with Private variables
Message
De
26/01/2023 06:16:51
 
 
À
25/01/2023 19:42:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
01685958
Message ID:
01685965
Vues:
50
>Hi,
>
>I have 2-band report. The 2nd band relies on records in a cursor. The cursor name is lcLaborCursor. The cursor is created as follows:
>
>lcLaborCursor = SYS(2015)
>
>So the variable lcLaborCursor has to be in scope when the report is produced. But the cursor (lcLaborCursor) is created and populated two functions before the report is produced. So, I declare the variable lcLaborCursor as PRIVATE. And it works.
>
>Another way I can do it is to declare the variable as Local (my desired goal) and then pass it from one function to another, and then to another.
>
>My question: Can I declare the variable lcLaborCursor LOCAL, not pass it from one function to another, but then still make the cursor in scope within the report?
>Some of the text in the report is using the following syntax:
>
>EVALUATE( lcLaborCursor + ."FLD_NAME")
>
>The above requires that the lcLaborCursor be in scope.
>
>What else can I do?

To expand on what Lutz said, the only reason you ever need to create a random name for a cursor is if a _single_ user can run the code that creates more than once at the same time. For example, if a form that isn't using private data sessions creates a cursor and the user can run that form more than once.

Since a report is essentially a modal activity (well, preview is modal and running the report prevents the user from doing anything else until it completes, so is functionally modal), there's no reason to use a random name for a cursor for a report.

Tamar
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform