Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Multiple sorts in grids
Message
De
14/02/1997 08:01:46
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00020171
Message ID:
00020527
Vues:
39
>Hi,
>
>I'd like my users to be able to see multiple sorts in grids. The grids are populated through SQL generated cursors. Now I make an index for each field just after the SQL, and set order to according to the field who's heading was clicked. The user can request to sort the cursor by clicking on the header of the column.
>
>The problem is that most of the time this functionality is not needed, and that under these circumstances, the indexing is a bit time consuming. I'd like to be able to index on a field the first time that the sort is requested.
>
>So ... here's my question: how can I detect that an index is already there. I could write a routine that scans the tags, or let the error handler manage this, but I'm lazy. Maybe you know better.
>
>TIA,
>
>Marc

Hi Marc,

I have followed the thread with Edward. I don't want to get into that thread but to tell you what I did. I put the following code in every
Click event of each column header:
local lnIniRec

lnIniRec = recno()

*Checks for the existence of the tag
i = 1
DO WHILE !ISBLANK(TAG(i)) .AND. LOWER(TAG(i)) != 'thisColumnTag'
	i = i + 1
ENDDO

if isblank(tag(i))
	index on thisColumnTagExp tag thisColumnTag of ....
endif
set order to thisColumnTag ascending
goto lnIniRec
thisForm.grdWhatEver.Refresh()
Of course for each column you have to replace thisColumnTag and thisColumnTagExp with its values.

Hope it helps,

Javier.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform