Solved

Set Index on a non index dbf

Posted on 2010-11-16
5
465 Views
Last Modified: 2012-05-10
I select MyTable.dbf and it has 4 fields, fld1, fld2, fld3, fld4

no index I seen the othe day an Exper was typing to set index on xxx TAG sort order then select I beleive.

can any one clarify?
OPEN DATABASE C:\MyFolder\Data\DB.dbc SHARED
* Set Index
	Index On fld1 + fld2 + fld3 TAG sortorder
	Select * ;
	from MyTable ;
	order By fld1, fld2 Into Cursor cMycursor Readwrite

	Browse

Thanks

Scan
....
ENDSCAN

Open in new window

0
Comment
Question by:jaymz69
  • 3
5 Comments
 
LVL 2

Accepted Solution

by:
Gary2Seven earned 250 total points
ID: 34146029
You can either index your original table

USE MyTable Exclusive
INDEX ON fld1 TAG fld1

Open in new window


OR you can sort as you select
Select * ;
from MyTable ;
order By fld1 Into Cursor cMycursor Readwrite

Open in new window


OR if you want multiple indexes in your result you would have to:
Select * ;
from MyTable ;
Into Cursor cMycursor Readwrite
INDEX ON fld1 TAG fld1
INDEX ON fld2 TAG fld2
...

Open in new window

Then set the index to whichever you want to use
SET ORDER TO fld1
...
SET ORDER TO fld2
....

Open in new window

0
 
LVL 12

Assisted Solution

by:jrbbldr
jrbbldr earned 250 total points
ID: 34146030
Select * ;
      from MyTable ;
      order By fld1, fld2 Into Cursor cMycursor Readwrite


Will create a Cursor.  
And that Cursor may be Ordered, but it has No Index on it
You need to create an Index on the Cursor after it is created.
Immediately after creating the Index it will be Active, but should you use the Cursor in a variety of ways, you will need to  SET ORDER TO <index tag>   to ensure that the particular index is Active

Good Luck


0
 
LVL 12

Expert Comment

by:jrbbldr
ID: 34146111
Also I have to agree with the comments of some of the other gurus (http://www.experts-exchange.com/Microsoft/Applications/FoxPro/Q_26612003.html) in the numerous posts you have entered on the wide variety of VFP issues that you have needed help with.     It seems as though we have needed to assist you almost line-by-line on this entire project of yours.

In light of the almost line-by-line assistance that you have needed it might be well worth your while to Hire a VFP consultant to tutor you personally or to assist you in your project.

Good Luck
0
 

Author Comment

by:jaymz69
ID: 34146631
Is that what this is not for?

Thanks again for all your input...
0
 
LVL 12

Expert Comment

by:jrbbldr
ID: 34147189
"Is that what this is not for?"

The forum is to provide assistance to users who need it from time-to-time, but when that level of assistance goes to the line-by-line for an entire project, it could easily be considered excessive and justifying your getting more detailed line-by-line assistance through a contracted professional.

If you look at your other positing which I referenced above you will see where other top-rated gurus for this site have made previous similar comments.

Good Luck
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Scrolling a grid 3 1,501
Database Upscaling 9 108
Can't Build Exe in VFP9 8 362
Print a word document in Visual Foxpro 1 576
Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
One of the biggest threats in the cyber realm pertains to advanced persistent threats (APTs). This paper is a compare and contrast of Russian and Chinese APT's.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question