Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sorting views and tables from header click
Message
From
26/10/2000 10:47:18
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00434409
Message ID:
00434593
Views:
17
>How do you tell the grid about the which index tag goes with which column/header? Then I assume there is code that tells you that a column isn't sortable if there is no index available?

In my apps, I used to have code that each column would take its ControlSource, and find out if there is an Index tag based on it. For example, if the control source was "alias.field", it would look for an index on "field" or "lower(field)" or "upper(field)".

That worked alright, but if I wanted a column to sort on another index, or a complex index the above method wouldn't work. So what we did is simply add a column too our grids table (the table which defines how to build the grid columns at run-time) for the index tag to use. If it was blank, that meant the column wasn't sortable, otherwise, it simply SET ORDER TO the specified tag.

Since I didn't have to search through a CDX for every column to find a possible index match like the first way, the second way performs a little better too.

If you still want it to find the index automatically, it could look like this (just typed off my head, needs some tweaking :-):
lcExpression = ''
For lnIndex = 1 to TagCount('mycdx.cdx')
     if upper(Column.COntrolsSource) $ Key('mycdx.cdx', lnIndex)
          lcExpression = Key('mycdx.cdx', lnIndex)
     endif
Endfor
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform