Solved

Set Index on a non index dbf

Posted on 2010-11-16
5
466 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

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…
Use Windows Task Scheduler to print a Word document weekly so your printer ink won't dry out.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

820 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