Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sort Grid with Relation set
Message
De
11/08/2008 08:26:48
 
 
À
11/08/2008 01:38:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Database:
Visual FoxPro
Divers
Thread ID:
01337982
Message ID:
01337995
Vues:
9
>I have a form with a relation set id_num to id_num
>I have 2 grids one with the main data and the other with the child data.
>The child table has 2 index id_num and date
>
>How do I sort the child grid by date in descending order.
>
>it seems that as long as the relation is set I cannot use date as the sort order.

Usually it's easier not to use Set Relation at all but rather create a Parameterized Local View like
Create View vTest As Select id_num, datefield From theTable Where id_num = ?yourParameter Order By datefield
That View would get stored in yourDatabase.DBC persistently so that you can now USE it almost like a table.
For instance, add it to your form.DataEnvironment, set .NoDataOnLoad=.T., and in form.Init() and whenever the parent table's record pointer moves, call a custom method looking like:
Local yourParameter 
yourParameter = parentAlias.id_num
Requery("vTest")
If you prefer to continue using Set Relation, you can use an concatenated index expression as long as Set Exact is OFF, assumed your id_num is numeric and the datefield is type "D", it might look like "Index On BinToC(id_num)+DToS(datefield).



hth
-Stefan
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform