General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Sorting a view for a grid
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
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only