home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / database / powerbase / docs / indices < prev    next >
Encoding:
Text File  |  1995-08-21  |  3.4 KB  |  62 lines

  1. Ch 7 − Using extra indices 
  2.  
  3. The record data is stored in a file called Database inside the database’s
  4. application directory. The order of records within Database is determined
  5. purely by the order in which the records are entered. To access the records
  6. in a logical order we need one or more indices. Powerbase has no sorting
  7. facilities other than the ability to sort a validation table or, under
  8. certain circumstances, a report.  All data ordering is achieved by the use
  9. of indices. 
  10.  
  11. The most important index is index 0. This is always called “PrimaryKey” and
  12. is created as part of the process of setting up a database (see 4.5). You
  13. will find the file PrimaryKey inside the database directory. Other,
  14. subsidiary, indices are stored in the database’s Indices directory and all
  15. have an icon bearing an “I”. When a database is opened any indices in this
  16. directory will be loaded automatically. (Indices operate in memory − to
  17. achieve maximum speed − not from disc.) Changes to the database update the
  18. indices and closing the database (or quitting Powerbase itself) causes the
  19. updated indices to be written back to the disc. 
  20.  
  21. Note that the more indices you use the longer it takes to add and delete
  22. records or to make alterations to records which involve changing indices.
  23. The ideal situation is to have all fields indexed and, given a fast enough
  24. machine, a hard disc and a record structure with not very many fields, this
  25. may be feasible. Remember that fields which are repetitive − those which
  26. have only a few distinct values repeated throughout many records − do not
  27. index efficiently. 
  28.  
  29. 7.1  Indexing a field
  30.  
  31. Click MENU over the required field and choose Index field choice from the
  32. Field submenu. The Key structure window will appear with the tag of the
  33. field you clicked on in the first Key field(s) icon. You may use the “bump”
  34. icons or pop-up menus to bring the tags of the other fields into view if you
  35. wish to base the index on more than one field. Enter the data in exactly the
  36. same way as when creating the primary key index (see 4.5) and click on
  37. Create. If the field is already indexed you will be warned of this and asked
  38. if you wish to overwrite the existing index. When indexing is complete you
  39. will see that the descriptor of the indexed field has changed from black to
  40. dark blue. 
  41.  
  42. Clicking on the “key” buttons on the keypad (Shift F4 and Shift F5) causes
  43. the red highlighting which indicates the current key to move from one
  44. indexed field to another. When you have a subsidiary key selected as the
  45. current key it works just like the primary key as regards browsing,
  46. searching and printing. 
  47.  
  48. There is nothing to stop you indexing one field whilst an index based on
  49. another field is the currently-active one, thus producing what amount to a
  50. sort within a sort.
  51.  
  52. 7.2  Automatic saving of indices
  53.  
  54. Indices are written to disc when you close a database or quit Powerbase but,
  55. as long as the database remains open, they are in memory and therefore could
  56. be lost if the power failed or someone switched off your computer. 
  57. Occasional use of the keypad’s Force update button ensures that the disc
  58. copy of all indices is more or less up-to-date but you can automate the
  59. process if you wish. Choose Preferences from the icon-bar menu, make the
  60. appropriate selection from the Save indices section of the Preferences
  61. window and click on Accept. You may make Powerbase save the indices at
  62. regular intervals or simply warn you to do so.