home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases
- Path: sparky!uunet!almserv!mimas!g9utxu
- From: g9utxu@fnma.COM (Tanin Uthayanaka)
- Subject: Re: Foxpro 2.0 Index Searches
- Message-ID: <1993Jan6.215109.17786@almserv.uucp>
- Sender: usenet@almserv.uucp
- Nntp-Posting-Host: mimas
- Reply-To: g9utxu@fnma.COM
- Organization: Fannie Mae
- References: <thomasd.62.726343853@tps.COM>
- Date: Wed, 6 Jan 1993 21:51:09 GMT
- Lines: 61
-
- In article 726343853@tps.COM, thomasd@tps.COM (Thomas W. Day) writes:
- >Three questions:
- >
- >1) How do you do a multiple field indexed SEEK? Meaning, I have an index
- >that was created using three (3) fields, now I want to seek data on those
- >fields. Everything I try seems to bring back EOF without locating any
- >related data. A single field search (the first field of the index) works
- >OK, but that's all I've managed. Until I get this right, I'm doing all my
- >data searches with LOCATE and they are slow.
- >
- How was the data indexed in the first place ?
-
- For example, you could say:
-
- INDEX ON FIELD1+FIELD2+FIELD2 TO FILE
-
- As far as I know all three fields must of one consistent type but becareful when
- you convert to all numeric or all date because what you'll end up doing is ADD
- number or date together. So it is probably wise to convert all fields to characters.
-
- then all you have to do is
-
- SEEK VAR1+VAR2+VAR3
-
- You must use the same convert function, if there is any, when you issue the above
- command.
-
- >2) If I create several indexes, how do I keep them all current? Are they
- >all automatically updated if they are opened with SELECTs? Or do I have to
- >REINDEX after a change is made in the database with one index and then a
- >search is required on a different index?
- >
- The best way to keep index updated is to open the file with all the indicies.
-
- For example, you could say:
-
- USE FILE
- SET INDEX TO FILE1, FILE2, FILE3
-
- if you don't want the file indexed, then type SET ORDER TO 0.
-
-
- >3) Can you recommend an after-market book that details data search methods?
- >
- Tons out there. Can't remember one of the top of my head. May be someone else
- can help.
-
-
- >4) Is there a reasonable way to perform math functions on 4-digit time
- >data? The data is derived by the TIME() function but is stored
- >in a character field as 99:99 (hour:minute) character data. What I want to
- >do is subtract two fields stored this way in each record and obtain the
- >average time between each of these fields. Obviously, 15:01-14.58 should
- >equal something other than 00:43. Is there a convert-text-to-time (CTOT?)
- >function?
-
-
- Have you heard of the function ELAPTIME() and TSTRING() ? I'm sure you can use the
- two functions to do what you want. They are both Clipper functions.
-
-
-