home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / database / 8867 < prev    next >
Encoding:
Text File  |  1993-01-06  |  2.6 KB  |  75 lines

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