Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

index is not work well

Status
Not open for further replies.

castleWolf

Instructor
Jan 23, 2005
26
AZ
Hi,
i have a problem which is bothering me all a week.
i have payment table which i want to add 3 indexes
I am adding index after it click 'ok' button
then i open again the table and seeing tab indexes there i see that the order of indexes is changed.
and i see the data ,data also changed .why such thing happend?. i don't know?. i am correcting the order afther opening it again changed
please give me a correct answer how to do this?
thanx
 
It has been like that for many versions of FoxPro. In order to avoid having a problem with this situation when you use the table with the index, call the index by its tag name rather than by the order its in.
Code:
select mytable 
set order to tag name

Not

select mytable
set order to 1

This way if the index name changes order, it won't matter.





Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Why you botter about when the exact order is placed?
Try this (I don't know if this helps but you can try). Delete all orders, open database exclusive and clean-up it.

Borislav Borissov
 
mgagnon
i didn't want to control this using code
i want to set the order in design time .Opening it from long period of time the order of this table stays as a like(unchanged)
 
Run time or design time arn't really the issue here. At some point you have to set the order and if you do that using the name tag you won't have to worry about the order number changing.

Regards,
Jim
 
castleWolf

You are using the Table Designer? What version of Visual FoxPro?

When you are creating (or looking at) indexes in the designer, they come in the order you created them.

When you click OK and then open the table and try to set the order, the indexes are in a different order. They are then in letter (alphabetical) order.

After you have designed the table and you want to use it, you should set the order using the tag (name) of the index, not the number.


Hope that helps,

Stewart
PS If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Opening it from long period of time the order of this table stays as a like(unchanged)
It kinda sounds like maybe you're creating indexes using the standalone index files (.IDX), rather than the newer compact indexes (.CDX). If every associated IDX file is not explicitly opened when the table is opened, they won't get updated as the table is updated, thereby giving you a 'snapshot' of what the table looked like the last time the index was open.

What code is/was used to create your indexes?
If you are using something like INDEX ON someexpr TO indexname, your indexes are standalone.

Change them to read INDEX ON someexpr TAG indexname, and they will be opened and updated automatically when the table is opened and updated.
Then it will just be a matter of specifying the order (tag) to be displayed rather than specifying the index file to use.

-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top