Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sorting a view for a grid
Message
De
01/10/1999 11:31:46
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Sorting a view for a grid
Divers
Thread ID:
00271570
Message ID:
00271570
Vues:
58
Hi-
I have a table that is populated by a view. I want to let the user click on each header to sort the grid by that header. The form is also using transactions when data is entered.
My problem: I am creating indexes for each header when the user clicks on it. If I remove the index, the Begin Transaction works but the sorting is discarded. If I leave the index there, the begin
transaction gives me an open index error. Here is some code:

select("v_orders")
***make sure everything is current
IF GETNEXTMODIFIED(0,"v_orders") > 0
TABLEREVERT(.T.)
ENDIF
**change the cursor props so we can build the index(is is at 5)
CURSORSETPROP("Buffering", 3, "v_orders")
IF FILE(SYS(2003)+"\inorder.idx")
SET INDEX TO
**get rid of old index
ERASE inorder.idx
ENDIF
**now index on this header.
SELECT v_orders
INDEX ON orderno TO inorder
SET ORDER TO inorder
DODEFAULT()
**if I leave this line in, the sort is discarded. if I take it out my transactions do not work.
set index to
***restore original buffering
CURSORSETPROP("Buffering", 5, lcTable)

****************************************************************
**in a totaly different part of the form I have a
Begin Transaction
***which bombs if I leave the "set index to" out.

Maybe there is a better way to sort a view?
Thanks
Jill
Répondre
Fil
Voir

Click here to load this message in the networking platform