Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
One Doggone Good Reason To Use SET FILTER
Message
De
02/01/2000 10:25:16
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
One Doggone Good Reason To Use SET FILTER
Divers
Thread ID:
00311341
Message ID:
00311341
Vues:
66
Since I started this mess.....(lol)

And this applies to native tables......

SET FILTER is a crappy way to get a limited recordset. In the old days, SET FILTER was just plain sequential access to the records and could, therefore, be excruciatingly slow. Nowadays, it uses some optimization and is somewhat faster. Still is slow, though, and there are lotsa better ways to grab a subset of rows from a table.

I have found one reason to use it. Consider a parent-child-grandchild relationship. A corporation has multiple operating companies. Each company has one or more divisions. Each division has one or more products. The relationship is:

Corporation (superentity, only one)
Company (Parent)
Division (Child)
Product (Grandchild)

In a single edit session, you want the user to be able to edit a company and add/edit divisions and products at will. You also want all changes to be saved or reverted as required. How to do this? Well, you can't just use child and grandchild table buffers because, if in the edit session the child record pointer is moved, you would normally need to requery the grandchild. This does not work with uncommitted changes in the grandchild.

So, what I have done in these cases is buffer the entire products table and SET FILTER to those products matching the division key. It's the only way to maintain a single-edit paradigm under these circumstances.

(and, no, I don't take kindly to drill-down edit structures....you should edit everything about an entity with one edit session)
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform