home *** CD-ROM | disk | FTP | other *** search
- Powerbase Utilities
- ===================
-
- Under this heading we will group a number of things which can be done from
- the ‘Utilities’ sub-menu of the icon-bar menu to examine and alter the
- structure of an existing database. Note that, if passwords have been set,
- you need to open the database with the ‘Manager’-level password to obtain
- access to this sub-menu.
-
- Changing the Primary Key
- ========================
- The primary key of a database is determined when it is created, but it is
- not fixed for all time. The option provided from the ‘Utilities’ submenu
- displays the same dialogue box as is used for creating the primary key in
- the first place, but with the addition of two radio buttons, whose function
- is described below. The present key structure is shown. Simply alter it to
- what you require and click on ‘OK’ or type RETURN. Confirmation is
- requested.
-
- Normally the first of the two radio buttons is selected, causing the records
- to appear in the same subfiles as they did before. In this case, any
- additional indices will still be valid.
-
- If you deselect this radio button with ADJUST (i.e. have neither button
- selected) then all the records will be placed in the currently selected
- subfile.
-
- Selecting the second radio button also places the records in the current
- subfile, but has the additional effect of recovering any “deleted” records,
- i.e. records which are still lurking in the ‘Database’ file but aren’t in
- the primary key index. In fact this mode of operation ignores the existing
- primary key altogether. There is one very important circumstance under which
- you would need to do this: when the primary key index is lost or corrupted.
-
- NOTE: You might have a ‘Database’ file but no ‘PrimaryKey’ file at all. This
- could happen if you have, for example, created a suitable text file and then
- set its type to ‘Database’. To build a primary key for such a file the only
- valid setting for the radio buttons is the one just described, i.e. second
- button selected. To enforce this mode both radio buttons are shaded.
-
- Adjusting the record format
- ===========================
- Minor changes to the screen layout can be made without having to rebuild the
- database. Choose the ‘Adjust format’ menu option and you will be presented
- with the blank record screen. Clicking MENU over this brings up the same
- menu as you used to create the screen originally, but the field-definition
- dialogue box has some options shaded. Thus, you can’t delete fields, add new
- ones or alter the data lengths, but you can re-position fields, change
- descriptors and tags, and alter the visible lengths. When you have finished
- the changes, click on the last option on the menu - ‘Quit design’.
-
- Another situation in which your control over the screen design will be
- limited as above occurs when you have a ‘Form’ file and a ‘Database’ file
- but no ‘PrimaryKey’ file. Since this is not yet a functioning database you
- will be placed in “restricted design” mode. The ‘Quit design’ option isn’t
- used to end the adjustments in this case. Use ‘Save form file’ instead.
-
- Changing the record format
- ==========================
- This is a more drastic change to make, but one can’t foresee all future
- needs and you may have to introduce a new field into the record or lengthen
- an existing one. This involves rebuilding the whole database. You will need
- to create a new application shell with the new ‘Form’ file inside it. The
- best way to do this is probably to open the new database directory, copy the
- old ‘Form’ file into it, then open the new “database”. Since no ‘PrimaryKey’
- or ‘Database’ file yet exists you will be able to modify the screen design
- as you wish. You should not, however, go on to complete the empty database
- (i.e. don’t choose ‘Default database’ or click on the ‘OK’ button in the
- primary key dialogue box) - simply save the ‘Form’ file using the menu
- choice provided.
-
- With your old database open, choose the ‘Change format’ option from the
- icon-bar menu and drag the new database to the large arrow icon in the
- displayed window. The database will then be rebuilt. Make sure you have
- plenty of disc space available before doing this since the original database
- remains intact so you need room for it and the new one.
-
- Data from a field in the old database is copied to a field in the new one
- which has the same tag. The new Form file must therefore retain the same
- tags as the old for data which is to be common to both. If a tag exists in
- the old Form file but not in the new Powerbase will assume that the relevant
- field has been deleted and data present in that field in the old database
- will not be transferred. A tag which is present in the new database but not
- in the old is assumed to be a newly-introduced field and will therefore be
- left blank.
-
- Merging a second database
- =========================
- Two databases may be merged provided they have the same record structure.
- Selecting ‘Merge database’ displays a window like that used for changing the
- record format and you simply drag the second database to the arrow icon.
- Powerbase will check that the two record formats are identical and report an
- error if they aren’t. If the open database has insufficient free space to
- hold the merged records it is automatically extended.
-
- Two radio buttons are also present, as in the dialogue box for rebuilding
- the primary key, and their functions are essentially the same. Thus, having
- the first selected will merge records into the same subfiles as those they
- occupied in the source database. Having neither selected will merge records
- into the current subfile of the open database, regardless of where they are
- in the source database. Having the second button selected does the same
- thing, but also imports records which were “deleted” in the source database.
-
- Changing the Database Length
- ============================
- Needing to lengthen a database is a common situation. Wanting to shorten one
- is less common, but both are easily accomplished. ‘Change length’ leads to a
- dialogue box with two writable icons. The first of these is used to specify
- the new database length. You will be warned if, when shortening a database,
- any of the records being removed are not blank. They may be deleted data,
- but then again they may not. You have been warned! The other writable icon
- determines the number of records by which the database will be lengthened
- each time it becomes full. If this value is zero no automatic lengthening
- occurs - a warning message is displayed instead.
-
- Balancing index trees
- =====================
- The tree structures used to hold indices can become very unbalanced,
- especially if you enter a lot of records in key-order. ‘Balance index’ leads
- to a submenu with two choices: ‘Automatic’ and ‘Right now’. Choosing the
- latter will optimise all subfiles in the current index. Before using it you
- are recommended to examine the state of the indices with the ‘Print tree’
- option.
-
- Choosing the first menu item (‘Automatic’) enables automatic balancing of
- all the indices in use every time the number of records entered becomes a
- multiple of a set value. This value is initially set to 25, i.e. indices
- will be balanced during record entry after each batch of 25 records, and
- may be altered via submenu with a single writable item. When automatic
- balancing is active the ‘Automatic’ menu choice is ticked. Clicking on it a
- second time turns auto-balancing off and removes the tick. Balancing can
- take some time, and the time increases with the number of records in the
- file. If you are entering records from the keyboard in a fairly haphazard
- sequence you should leave the ‘Manual’ option set. If, however, you need to
- enter a lot of records in primary key order it might be to your advantage to
- make balancing automatic whilst the database is small, returning to ‘Manual’
- when a few dozen records have been entered.
-
- The most useful application of the ‘Automatic’ option is when you are
- importing records via a CSV, or similar, file. Such files frequently come
- from other database systems and are very likely to have their records in
- primary key order. The data import will become slower and slower as the
- number of records increases and, where thousands of records are involved,
- can literally take hours. Setting the system up for automatic index
- balancing, say every 50 or 100 records, can markedly reduce this time.
-
- Printing the Tree Structure
- ===========================
- This is something you do either out of idle curiosity or to see whether an
- index tree needs balancing. ‘Print index’ provides two choices:-
-
- (1) to print the actual keys, positioned according to the level
- which they occupy in the tree
-
- (2) to print only the number of nodes on each level.
-
- The data printed applies to the current subfile of the current key and is
- output to a screen window from which it may be saved in the same way as any
- other list (see ‘Printing’ - Output destination).
-
- If the tree is very deep and straggly it may not be possible to show all of
- it. The maximum number of levels which can be shown is in fact 40, including
- the root. Using option (1) above causes keys which cannot be displayed in
- their correct positions to appear down the left hand side of the window with
- a note indicating the level in which they occur.
-
- If you choose (1), a double click with SELECT on any of the keys will
- display the relevant record with the caret placed in the key field.
-
- Duplicate primary keys
- ======================
- Wherever possible a primary key should be chosen so as to be unique. Where
- duplication of the primary key might occur the designer of the database can
- decide either to allow or forbid it. (The switch which controls this is
- hidden from prying eyes in the password-setting window and is thus under
- ‘Manager’-level control. See ‘Passwords’ for more information.) If duplicate
- keys are permitted it is sometimes useful to have a list of them. Such a
- list is created by ‘Find duplicates’ and may be saved as a text file.
-
- Closely related is the final entry on the ‘Utilities’ sub-menu; ‘Warn of
- duplicates’. If ticked this causes a warning message to be displayed each
- time a primary key is about to be duplicated. Clicking on this menu choice
- toggles the ticked state.
-
-