Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to make this process more efficient?
Message
De
02/09/2002 15:17:52
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
02/09/2002 10:23:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00695944
Message ID:
00696015
Vues:
13
>Hi
>
>Ok, my case is weird, so bear with me on this one. Here is what I try to do: via view the user is gonna be working with a record set, he will be able to update, delete and insert records.
>Very often he is gonna be filtering the record set, each time he decides to reduce or add records through the filter he can't be forced to save the changes, instead the program got be able to keep the changes apart, so if the user the decides to see again the unfiltered records he will be able
>to see the old unsaved changes and being able to save them anytime.
>The only idea I came up with to solve this is that before applying the filter I should add the changed records into a cursor, revert the view and once I need to requery or refresh the view put back the changes into the respective records.
>So I'd like to know your opinion on how to make this process the most efficient possible or implement a better solution.
>For instance, wha is fastest way to know if there changes in the view.

Weird calls for weird. Here's what I'd do (and maybe prove myself wrong, but... maybe worth a try):

Open the view twice, under different aliases (make sure you don't use AGAIN clause, because it would show you the same data). Make one of them have no data on load, and show that one in a grid. Whenever user needs some records from the read view, retrieve them and stuff them into the grid view. Let user do whatever he wants with the grid view. Upon save, scan the grid view for changed records (you may use a cursor actually for the grid, with a structure copied from the view, with an extra field to mark whether the record was updated), and post the updates.

Now for posting the updates you may have to have a view with the same structure, parametrized by the primary key, so you'd retrieve records in it one by one, copy the changes from the cursor (or the grid view) and update the underlying table or remote DB. The process wouldn't have to be too complicated - you could easily use Scatter/Gather Name {object name here} Memo to achieve this.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform