Solved

Set Index on a non index dbf

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Moving applications to the cloud or switching services to cloud-based ones, is a stressful job.  Here's how you can make it easier.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now