Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing cursors between datasessions
Message
De
29/12/2005 11:22:23
Mike Yearwood
Toronto, Ontario, Canada
 
 
À
29/12/2005 10:59:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP1
Divers
Thread ID:
01081341
Message ID:
01081689
Vues:
9
Hi James

>Hadn't made myself clear. Maybe an example:
>
>Form A has customer summary data. User can bring up detail (in Form B) for any individual customer off a pop-up menu. In Form B, I create one or more cursors along the way before I show the user the cursor in the grid. Now, user can also return to Form A and bring up a new instance of Form B for another customer. How do I keep the names of the cursors created in the first instance of Form B different from the names of those in the second instance?

That's clearer. In such instances, you'd have to make up unique names and the objects on the forms would have to know how to find those names. Form properties can hold the aliases and the objects could determine them by accessing those form properties.

Further, you'd have to close those aliases when each instance of FormB closes.

>
>Jim
>
>
>>>Mike --
>>>
>>>I have some problems with assuming that a cursor name is unique ... most of my forms create their own cursors. How would you manage multiple occurrences of this form? Assigning some sort of random name to these cursors?
>>
>>Nope. Let's use an example. Form 1 is an invoice. Because it was called from a menu, and not from some other form, it is a private data session. It opens cursors InvoiceList, InvoiceDetails, LineItemList, LineItemDetails, CustomerList.
>>
>>When I launch the customer picklist form it is expecting to use the CustomerList cursor so it does not open or create a cursor for CustomerList unless it's not already open. It does assume the user will add or edit the customer so it opens CustomerDetails. It leaves it open in the initial datasession, in case the user re-opens the customer picklist form.
>>
>>Now, if I'm looking at an existing invoice and I go to the customer picklist, isn't it natural to see the customer already in the invoice? I didn't have to grab that data from the server. It's already available.
>>
>>If I'm doing a new invoice, the user enters some of the customer name. I can query that partial name in the invoice form resulting in a set of customers in the customerlist cursor and they get automatically and instantly displayed when the customer picklist form opens.
>>
>>
>>Were I to go back to the menu and launch a second instance of the invoice, it and it's called forms would have their own instances of the cursors with the same alias names as the first instance and there's no worry because they're in their own private data session.
>>
>>>
>>>Jim
>>>
>>>
>>>>Hi James
>>>>
>>>>>You might consider putting that data into cursors and having the forms use the default data session. You might also consider having that object instantiated within the data session of the first form and have other forms called by buttons on the first form. Such called forms can adopt the data session of the first form.
>>>>>
>>>>>Have tried for some time to avoid having forms share data sessions. Most of my forms create cursors which are then used in grids (yes, heaven forbid, my apps are based on grids, but they're the example of when using grids are appropriate). Sharing a single data sessions then causes major headaches with replication of cursor names.
>>>>
>>>>I think many people are blindly avoiding sharing data sessions. There are potential problems, but then what is free of potential problems? It's my contention that everything has it's place, even grids and SQL.
>>>>
>>>>What I do is assume that any cursor name is unique throughout a chain of forms. The first form in the chain has a private data session. All forms called from that first form participate in that data session. IOW instead of only having multiple instance forms, I have multiple instances of chains of forms.
>>>>
>>>>So when forma calls forma1, forma1 does not open already open cursors. Performance is very good.
>>>>
>>>>>
>>>>>Thanks for the suggestion in any case,
>>>>>
>>>>>Jim
>>>>>
>>>>>
>>>>>>Hi James
>>>>>>
>>>>>>>I understand that I can't pass a cursor between datasessions. I have read suggestions to use CursortoXML and back again, but I find that XMLtoCursor can be very slow for an interactive session (25 seconds is way too long for 2900 records). I'm looking for alternatives.
>>>>>>>
>>>>>>>Background: I have a class, created at the start of a user's session, which downloads a pile of data and creates summary information from it. All of my forms, with their own private datasessions, talk to this class to get the data they need. For all uses except one, using CursortoXML and back work fine, since the number of records involved is quite small ...
>>>>>>>
>>>>>>>Thanks in advance,
>>>>>>You might consider putting that data into cursors and having the forms use the default data session. You might also consider having that object instantiated within the data session of the first form and have other forms called by buttons on the first form. Such called forms can adopt the data session of the first form.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform