Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CDX missing
Message
From
29/05/2010 19:22:59
 
 
To
29/05/2010 19:00:54
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01466267
Message ID:
01466538
Views:
38
It's not ideal practice to open tables in specific work areas, like your SELE 1 below. You can end up closing a table already open in that area, that you didn't mean to close.

Generally I use code like this to avoid stomping on tables:
FUNCTION SomeFunc

LOCAL lnSelect
lnSelect = SELECT( 0 ) && stores the currently selected work area

* For straight opening of a table you can combine your 3 commands into 1:
USE MyTable TAG MyCDXTag IN 0 && IN 0 means open the table in the next available empty work area

* Do some SELECT into a cursor:
SELECT * FROM SomeTable INTO CURSOR TempCursor

* Do other stuff here

* Cleanup: remember to close anything you opened:
USE IN TempCursor
USE IN MyTable

SELECT ( lnSelect ) && go back to the work area selected before the function was called

RETURN
>I see now in the program where the cdx is called - as below.
>Once i exit the 'found record' - can i shut the cdx off perhaps with a set order to command.
>perhaps that would resolve the issue.
>
>Or perhaps i need to define the order at startup when the index files are summoned.
>right now i open data this way. should i perhaps set order at that point and keep it in place?
>
>sele 1
>use myfile
>set index to myfileindex
>
>
>
>Select mydata
>coldtag = Tag()
>Set Order To Tag name
>Locate For Substr(Alltrim(Upper(mydata.name)),1,.nIDSelStart) = ;
>Upper(Substr(This.Value,1,.nIDSelStart))
>
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform