Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sort Grid with Relation set
Message
From
11/08/2008 08:26:48
 
 
To
11/08/2008 01:38:22
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01337982
Message ID:
01337995
Views:
10
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform