Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I index
Message
From
07/07/1999 11:14:43
 
 
To
06/07/1999 23:33:09
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00238097
Message ID:
00238314
Views:
10
>I have a table with fields including a date field, a character field and a logical field that stores the deleted status of the record - .T. = current, .F. = Deleted.
>id = N(10)
>Char = Name C(30)
>Date = Birth date D(8)
>Active = L(1)
>among other fields
>
>When changes are made to a record a new record is created with the changes, Active = .T. and the active = .f. for the old record. Thus we have an audit trail of changes.
>
>How do I create an index on the character field so as to SEEK only those that are active.
>

Use a FOR clause on the index:

INDEX ON NAME FOR ACTIVE TAG ACTIVNAME
INDEX ON NAME FOR ! ACTIVE TAG INACT_NAME

would create a separate index for each set.

Alternative, use a standard prefix character in th index expression and concatentate it with the name:

INDEX ON IIF(ACTIVE,'A','I')+NAME TAG NAMEACTORD

and now to find the active record:

SEEK "A"+cNameToFind

This way a single index containing both active and inactive items is built, and the lists are logically segregated.

>I use Locate for name = "MYNAME" and ACTIVE = .T. but this is too slow. I need SEEK so how do I create an index for this??
>
>Set filter to ACTIVE = .T. is also too slow. There are > 250000 records (including the non active ones)
>
>I need to
>
>Set ORDER to TAG myindextag
>and
>SEEK "MYNAME" which will give me an active record.
>
>Bernard
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform