Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Backup and Restore
Message
De
16/06/2006 09:10:49
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows 2000 SP4
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01129445
Message ID:
01129503
Vues:
18
>No secondary sort.
>
>Following all the tons of documentation on Cott's 3rd normalization I have 7 tables linked successfully to a primary table with pk and fk's. These keys (single field indexes actually) are all on a single surrogate (tablenameID) field, of course an interger, auto incrementing. Every thing links great.
>
>I have 5 of the seven tables on a pageframe (page 1) and these tables are displayed as a 4 or 5 line gird. Move the record in the primary grid and all the other grids repopulate immediately, with their appropriate child entries. It's very cool. It's supposed to be.
>
>The problem. I want some of the child grids showing in a secondary order, by date or alphabetically, not the natural order, a by product of the fk index. That's the problem. Change the index on the child grid (set order to SomethingElse) and you loose the fk link to its pk parent. NOT GOOD.
>
>Change the definition of the child fk 'string(childtableID)+dtos(sentdate)' and that cannot match the pk of the parent table, you loose the link. NOT GOOD.
>
>The grid object actually has a sort and tag property, but they cannot be changed. Try to turn the sort property from .f. to .t., can't do it. Try to use the Tag property, it has nothing to do with sorting.

Indeed, the "Tag" is for arbitrary information.

I found it not very useful - mainly for precisely the reasons you mention - to link the grids directly. Instead, I use one of these alternatives:

  • Filter the child table. For tables above ca. 20,000 records, this is very slow in Visual FoxPro 6. This problem may have been solved in VFP 9 - but I didn't do tests.
  • Create a parameterized view on the child table. Assuming the tables are linked on a field called parentkey, create a view for the child table, with a filter condition like parentkey = ?tnParentKey. Every time you change to another record in the parent table, change the value of a private variable tnParentKey, and requery() the view.

    Both solutions allow you to use temporary indices. For the first solution, existing filters can be used. For the first solution, creating additional (temporary) indices is slow, because the entire table has to be indexed. For both solutions, you can create temporary indices on more than one field (in Visual Extend, the user double-clicks on one grid header to sort on that column; the user can Ctrl-Click on additional columns to sort on a second, third, etc. column).

    In summary, I recommend the second solution (parameterized view).
    Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
  • Précédent
    Répondre
    Fil
    Voir

    Click here to load this message in the networking platform