Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change cursor order without changing cursor recno()
Message
 
 
To
10/10/2001 13:38:12
Peter Brama
West Pointe Enterprises
Detroit, Michigan, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00566521
Message ID:
00566540
Views:
13
>I have an app that creates a cursor of records from a table, approximately 2000. In the SELECT, I have an ORDER call setting the order. Originally, I thought I needed a READWRITE cursor (don't have VFP 7 though) because I need to have two fields user changeable per record. I ended up creating an Array for the two changeable fields where the "tie" is the RECNO() of the cursor record.
>
>I now need to switch the display order (I use the cursor and array in a grid) from one column to another. The way I did it originally was to re SELECT the cursor and change the ORDER portion. In doing so, the RECNO() of course change.
>
>The client now wants to be able to switch back and forth as often as necessary during each session but wants to KEEP the info in the two array fields with the appropriate records in the cursor. Again, the tie WAS the RECNO() of the cursor record.
>
>I obviously can't call the SELECT again, and am leary of using an INDEX ON command because I don't want to create a temporary file on the hard drive that I have to ensure gets erased... (I originally did all this with a temporary db file and that got problematic and a bit slow, hence the switch to the cursor).
>
>I now am thinking maybe instead of cursor and array, how about just an array with all the field information... that way maybe I can ASORT() the array. I guess I am too novice to think of all the possibilities and potential problems this might ensue switching to just an array. It is alot easier to access a cell element in the grid and code with cMyCursor.MyField as opposed to an array call aMyArr(ThisRecord,ThisField)
>
>
>Suggestions?

Peter,
If you don't want to use INDEX ON then instead of linking the two using recno, use the primary key of the record (or combination of fields that ensures uniqueness if you don't have one field). Then you can do as many SELECTs as you want and the PK won't change.

Although, I would really take a look at using the INDEX ON command. We have been using this technique with no problems and it is very flexible. It doesn't require going back to the data for anything so network traffic is minimal.

HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform