This tutorial is intended to acquaint a new user with the most commonly-used facilities of Powerbase. It explains how to:
Double-click on the Powerbase icon. After a few seconds it will appear on the iconbar with the words "No data" beneath it to show that no database is open. Dragging the Elements icon onto the Powerbase icon on the iconbar will open Elements for use and the words "No data" will be replaced by the name of the database. Double-clicking on the Elements icon has the same effect, in fact if Powerbase isn't already on the iconbar a double-click on Elements will launch it for you provided that the Powerbase application has been "seen" by the filer.
When the database opens the record window appears with the first record in the database (the one for ACTINIUM) displayed. Attached to the left-hand side of the record window is the tool-pane (see below) which enables you to control the browsing, searching and editing functions of Powerbase. Descriptions of many of the tool-pane buttons referred in the tutorial can be accessed rapidly by clicking the mouse over the relevant part of the illustration. A "thumbnail" representation of the tool-pane appears in several places in the right margin and may be clicked to take you back to the tool-pane illustration.
Now that you have a database running we will learn first how to move from record to record and how to access any particular record by using a small group of letters called the key of the record. Most of the tool-pane buttons respond to clicks with both SELECT and ADJUST, and the effects of the two mouse buttons are sometimes exact opposites; in other cases SELECT is the usual button to use and ADJUST has a different but related function.
(a) ends takes you to the end of the database (with SELECT) and the beginning (with ADJUST), i.e. to ZIRCONIUM and ACTINIUM respectively.
(b) single step moves through the database one record at a time. From ACTINIUM, clicking SELECT takes you to ALUMINIUM, whence ADJUST takes you back to ACTINIUM.
(c) fast-forward/rewind goes through the database by longer jumps. SELECT takes you from ACTINIUM to BISMUTH and ADJUST back to ACTINIUM. The fast forward/rewind interval value is shown in a writable icon. It is initially set to 10 but can be altered by clicking in it with SELECT and entering a new value. Try entering 2 or 5 and fast-forwarding again.
At either end of the database "wrap around" occurs. If you are at the final record (ZIRCONIUM) one record forward takes you to ACTINIUM again. Similarly, one record back from ACTINIUM goes to ZIRCONIUM.
The play and stop buttons resemble the corresponding controls of a cassette player. Play starts an automatic run-through of the records without the need to touch any other buttons. When you get to the place you want, click on stop or type the Esc(ape) key on the keyboard. If the records go past too quickly you can slow the process down by increasing the number in the writable icon (the fast-forward interval).
If you click on the change active index button the record for HYDROGEN is displayed. Now experiment with the top group of buttons as before. You will find that the records no longer appear in alphabetical order of Name but in order of Atomic number instead. What we have done is change to a different index. If a database has several indexes change active index allows you to cycle through them in opposite directions with SELECT and ADJUST. Since Elements has only two indexes (one based on the name and the other on the atomic number) both mouse buttons have exactly the same effect. When you change to a different index the screen always displays the first record as determined by that index.
An index is built from keys which are derived from a particular key field. The way in which the key stored in the index is derived from the key field differs in the two cases. For the Name index the first four letters of the name are used. Since no two elements have names beginning with the same four letters this gives a unique value for the key. (Two letters would not be enough because of names like CHLORINE and CHROMIUM.) The Atomic number index is based on the whole 3-digit maximum length and the ordering is numeric. When a record is displayed the key is shown in the window title.
The record screen shows which fields are key fields and which are not. The labels or descriptors of fields are normally black. Where the fields are key fields they are shown in dark blue instead and the field related to the current index has its descriptor in red. Note also that the background colour of the Name field is pale yellow whereas the rest are white. This indicates that Name is the primary key field. The primary key is more important than the others; the index based on it is the only one which every database must have and is the one selected when a database is first opened.
Suppose you want to see the record for the element NITROGEN. If the current index is the primary key index (based on Name) then enter NITR and either type the Return key on the keyboard or click on the Find button. The required record quickly appears. If you enter the key of a non-existent record Powerbase briefly displays a warning then displays the record which most nearly matches the key. You don't necessarily need to type the whole key; NIT would do in this case, but NI would be ambiguous (there are elements called NICKEL and NIOBIUM). If you do enter an ambiguous key or part-key the first matching record is displayed and the number of matches is shown in the icon above the Find button. You may then cycle through the matching records by clicking on the arrowheads to the left and right of this icon.
To find NITROGEN when the Atomic number index is active you would need to know that the atomic number of nitrogen is 7. Change index, enter this number and type Return or click on Find. The required record appears. Abbreviated keys are not allowed in this case for obvious reasons; if you want element 103 (LAWRENCIUM) it's no good entering 10 (NEON)!
You might want to examine a group of related records, e.g. the six similar elements LITHIUM, SODIUM, POTASSIUM, RUBIDIUM, CAESIUM and FRANCIUM which are known as the Alkali Metals. You could, of course, look up each in turn by entering its key but there is a better way. Click on the Filter button. The button becomes ticked and the Filter window opens on the right of the tool-pane.
This button is what we call an option button and is used to turn a particular feature ON or OFF. The six elements referred to all occur in group 1 of the Periodic Table of the elements so type GP=1 into the writable icon. and click on Apply. The record for CAESIUM is displayed. If you now experiment with the single step button you will find that they behave as if these six were the only elements in the database; all the rest have been "filtered out" so that you access only the ones you are interested in. To return to normal operation either click the Cancel button on the Filter window or deselect the option button on the tool-pane. If you want the Filter window out of the way without cancelling the filter click on Close. The option button on the tool-pane remains selected.
Click SELECT on the add record button. A blank record will be displayed with the caret in the Name field. Enter TASMANIUM here. You needn't use the Shift key; input into this field is forced to uppercase regardless. Type Return and the caret will jump to the Symbol field. Enter Ts. You will now need to type Return twice to get to Atomic number (One press takes you to the field after Name where the origin of the element's name is given. The field has no descriptor.) Alternatively you could point the mouse at the Atomic number field and click SELECT. There is no need to type Return after entering a field in order to accept the data; it's just the most convenient way of getting to the next field. When entering data into widely-scattered fields it is more convenient to use the mouse to move the caret.
Having entered the data click any of the browsing buttons so that a different record is shown. Now use search for record to find TASMANIUM by name (its key will be TASM). Change to the Atomic number index and find it by atomic number (108). In both cases try moving to the record just before and just after the new one, noting that it has been placed in its correct position in both indexes: between TANTALUM and TECHNETIUM in the Name index and at the end of the Atomic number index.
To see what the validation table contains, place the caret in the Group field then click on the Table button. The validation table will be displayed in its own window. Only items in the left column of the table may be entered in the Group field. Element 108 would be a transition metal, so enter T. You will now find that Powerbase accepts your data.
Both character validation and table validation may be turned off and on by means of a button on the Preferences window. The simplest way to access this is to click ADJUST over the Powerbase icon on the iconbar. The rather large window which appears has a collection of option buttons down its left-hand side. The seventh of these (Validate input) is normally selected to indicate that validation is in effect. Click to deselect it then click on Accept. The Preferences window will be removed from the screen and you will find that input is no longer being validated and the Table button on the tool-pane is shaded.
Suppose you had clicked the button by mistake and deleted an important record? It isn't a problem; what you have done is made easy because it is far less drastic than it looks; the record hasn't really been deleted at all. To prove this, click SELECT on the change subfile button. TASMANIUM will reappear. You will also find that it appears to be the only record in the database! Don't worry; nothing has been lost. A Powerbase database is treated as sixteen separate subfiles numbered 0-15. When you first open the database you are looking at Subfile 0 and the heading of the record window shows this. If you look at the heading now you will see that it has changed to Subfile 1. The change subfile button advances the subfile number by 1. When you reach subfile 15 the next click takes you to subfile 0. As you might expect, clicking with ADJUST has the opposite effect.
The button above delete does not delete records; it merely moves records from one subfile to another. Clicked with SELECT it moves the displayed record to the next subfile in sequence. Thus, in the above case TASMANIUM has been moved from subfile 0 to subfile 1. A record in subfile 1 would be moved to subfile 2 and so on. When it gets to 15 the next click moves it into subfile 0 where it was originally. As you may have guessed, ADJUST moves records in the opposite direction, i.e. from subfile 1 to 0 or from subfile 0 to 15.
If you do want to lose a record for good you consign it to the dustbin by clicking delete. As this button's action is more drastic than that of the other two you are asked to confirm that this really is what you want to do before the deletion goes ahead.
You might prefer to have a warning message and a request for confirmation when simply moving a record to the next or previous subfile (especially if you sometimes click the move record button by accident). You can enable confirmation by editing the ShiftWarn option in the !Powerbase.Resources.Config file as described in 14.8.
Before Powerbase can produce a list, or report, as it is usually known in database-speak, it must be told:
The report won't appear until the process of scanning the database is complete. It will then be displayed in a window. If no records at all appear in this window make sure the icon for subfile 0 is highlighted as shown in the illustration. If the mouse pointer is over the main window the hourglass will tell you how far things have progressed. Pressing Escape will cause the process to be aborted. Assuming you now have a list in a window, clicking MENU over it displays a menu which leads to a Save box from which you may save the list as a text file by dragging the file icon to a filer window. If you point to a record in the displayed list and double-click with SELECT Powerbase will retrieve the chosen record and display it in the record window. Moreover, the caret is placed in the field you were pointing to on the list. This is very useful if you spot errors in the data whilst examining a list. A double click on the offending item offers the record with the caret correctly positioned for editing.
Most database reports don't include all the records. You will usually need to enter a search formula in the Match window before clicking Report. You have already used a simple search formula when you typed GP=1 to filter out all but the six Alkali Metal records (see 2.3). Search formulae can be complex and a detailed treatment can be found in Ch.3 of the Reference Manual. Only a few simple examples are shown here.
Suppose we want a list of all transitional elements. i.e. all those which have T in the Group field. We can do this by entering the search formula GP=T.
Why GP? "Group=T" seems the more obvious choice but Elements contains many fields which have no descriptor, such as the one on the first line which gives the origin of the element's name. Every field which can hold data has to have a handle by which we can refer to it and that handle is called the field tag. Tags are very short, never more than four characters. You have seen some tags already. Look at the report you produced earlier. The three columns are headed with the tags (NAME, SYM and GP) not the descriptors (Name, Symbol and Group). We therefore meet tags in two contexts:
The second example involves listing all elements whose names end in "IUM". What we need to specify is that the Name contains IUM and we do this by entering the search formula NAME{IUM. Note the use of a left brace (curly bracket) to mean "contains". Another way to perform this search is to use a wild-card. Type NAME=$IUM. Clicking Report will produce the same list as before. The "$" is a wild-card character which can represent any number of unspecified characters. The search formula is saying in effect, "I don't care what the first part of the name is as long as it ends with IUM".
We will combine the previous two examples into a two-pronged search for all the TRANSITIONAL elements whose names end in "IUM". The search formula this time can be either NAME{IUM AND GP=T or NAME=$IUM AND GP=T. Note the spaces before and after AND. These are essential.
You might like to try an alternative way of entering a search formula. It is designed for new users of a database or for occasional users who might forget what the tags of the fields are. Proceed as follows:
The biggest problem you are likely to encounter is not knowing the tags for the various fields. By using the above method you can see all the tags displayed in a menu or cycle through them using a pair of arrowheads ("bump" icons). It is also useful to know that clicking with SELECT on a field while holding down Ctrl causes the tag of that field to appear in the search formula icon.
When you are in list edit mode the previously shaded Edit button becomes active and allows you directly to edit records in the report. When clicked its legend changes to Update and the caret is placed in the first editable field of the highlighted record. Return or "down arrow" will move the caret from field to field, just as it does on the record window, and "up arrow" moves it back to the previous field. You can alter the contents of the fields and then click the Update button. (Typing Return when the caret is in the last editable field has the same effect as clicking Update.) Not only is the report modified by this procedure; the changes are written back to the database records too! This is an extremely powerful feature for finding and correcting errors in the records.
Deselecting the Browse button causes Powerbase to revert to ordinary record browsing and editing.
If your printer is one of the more recent inkjets you might not be able to print plain text files by simply dragging them to the Printers icon as described above, because some such printers contain no fonts of their own. What aften happens is that you get page after page with nothing on them but a few characters of gobbledegook. Fortunately Powerbase is able to talk directly to the printer. Click the icon to the left of the Cancel button on the Match window. This is another way of opening the Report Options window, at the top of which is an area marked Destination. Select the Printer button instead of the Window button and click on Accept. You will now find that reports go directly to the printer (provided it is ready for use and Printers is running) without ever appearing in a window.
The Lots more button on the Report options window gives access to many features associated with hard-copy printing but this isn't the place to delve into them. Full details will be found in Ch 3.11 of the Reference Manual.
The distribution disc contains a simple Impression document called MergeTest and an Ovation Pro document called OproMerge. Either may be used in conjunction with the Elements database to illustrate direct data-merging, which is described here for Ovation Pro. Certain preliminaries are necessary to prepare Ovation Pro for direct data-merging:
The most widespread use for this powerful facility is mail merging where names, addresses and other information are merged into a standard letter to personalise it. For more information on data-merging, including instructions on how to prepare the Ovation Pro or Impression document, see Ch.9.2 in the Reference Manual.
You are strongly advised to back up your database whenever you make changes to it and this is made easy by the provision of a Backup button on the tool-pane. However, Powerbase needs to be told where to back up. Clicking ADJUST on the button opens a window which invites you to drop a directory on the large down-pointing arrow icon. The pathname of the directory will then be displayed in place of <no directory>. This will be your backup directory and Powerbase needs to be able to find it in future so your backup choices need to be saved somewhere. If you want to use it for backing up all databases then select the in Powerbase radio button and click Save choices. If it is the backup directory for the current database only, select in database before clicking Save choices. (Ignore the middle radio button, the wording for which might not be "for User".)
Once a backup directory has been specified the stored pathname will be loaded from the choices file when the database is opened and a click with SELECT on the Backup button will make a copy of your database. If you want automatic backups you should select the Back up on closing button before saving the choices. Open directory is also useful for inspecting the contents of the backup directory or retrieving the backup copy if necesssary.
A database may be closed down by choosing the Close database entry from the iconbar menu. When you do so, all the indexes stored in memory are saved to disc and the database is closed. You do not have to do anything to save the database itself to disc since it has been there all along. Only the current record is in memory at any one time and this is automatically written back to disc when it has been changed in any way. Also saved automatically are validation tables and the link file which holds the links between the main database and the validation tables.
If you are going to use another database straight away just double click on it or drag it to the Powerbase icon on the iconbar. In fact you don't even need to close the previous database before doing this; Powerbase will do it for you. To terminate Powerbase itself use the Quit option on the iconbar menu.
This section describes the creation of a simple address-book database. Make sure that the Powerbase icon is on the iconbar but with no database open. ("No data" under icon.) Click SELECT on the icon and a Save box appears showing a database icon and offering !Database as the default name. Change this to Addresses (the "!" will be added by Powerbase if you don't include it yourself) and drag the icon to a suitable directory.
Powerbase is now in design mode and the record window is covered with a blue grid to help in laying out the fields. Clicking MENU over this opens a menu different from the one you will have seen previously. Most of the entries will be shaded at this stage, but the one we want is Create field. When you choose this the rather complex Field definition window opens.
A lot of the window is shaded at this stage and much of the rest can be ignored for the present — we did say a simple database — so leave the Editable radio button selected and the field-type as Unrestricted. We're going to call the first field Name so type that into the Descriptor icon. Anything you enter there will appear on the record screen as a label for the field. Very important is the Tag which is used to identify a field uniquely. It is limited to 4 characters and we might as well use NAME. (Uppercase is recommended for tags to distinguish them from descriptors.) How long might a name be? 20 characters ought to be enough so enter 20 in Data length.
Click on Create and there's the first field. Easy! But it's not in the right place, is it? So point the mouse at the white rectangle and drag with SELECT until it's where you want it.
We now need several fields for the address; four ought to be enough. The first will obviously have the Descriptor Address but the layout looks neater if the other three are just aligned underneath without descriptors. This is quite permissible; descriptors are optional. Tags, however, are not optional and you can now see why; if a field had neither Descriptor nor Tag there would be no way of querying it by means of a search formula. Create four fields with tags ADD1, ADD2, ADD3 and ADD4. Make them all 20 characters long and drag them so that they line up neatly underneath each other.
That's enough for the present. Click MENU and choose Default database. You will be asked to confirm that Powerbase is to create 100 records with NAME as the primary key field. The first four letters of the field will be used to make up the key unless the field is shorter than that, which it isn't in this example. That sounds acceptable (and can be changed later) so accept the suggestion — and there's your database all ready for you to type data into! This illustrates just how easy Powerbase can be for a beginner, but there are loads of refinements for you to use when you are more used to the program. Go ahead and enter a few records before proceeding to the next stage.
Oh dear! We left something out! There should be a field for the telephone number. And, while we're at it, it would be nice to have a field for general notes too. Here's how these fields can be added without losing any data you might have already entered.
Click MENU on the iconbar icon and choose Utilities=>Alter format. First comes a message telling you what to do next (and what to do if you change your mind) then up comes the blue grid again with your record design displayed. Choose Create field from the menu again.
For the phone number we want an Editable field and we might as well make it Numeric since it's numbers we'll be storing in it. (Although it doesn't really matter; we aren't going to attempt any calculations on phone numbers!) Click the menu button at the top-right corner and choose Numeric. Enter a suitable Descriptor, Tag and Data length, e.g. Phone, TEL and 12. Click on Create and position the field beneath the address.
Now for the Notes field. Most records won't require any additional notes at all but a few may need quite a lot of extra information. How do we decide how much space to allow? There's a way of avoiding the problem altogether. Choose Create field from the menu again but this time select the External radio button. The field-type at top right will now be showing Text instead of Unrestricted. Enter Notes as the Descriptor and NOTE as the Tag. What about the Data length? It's shaded to stop you entering anything. Never mind, you'll soon see why. Click Create and what do you get? Not a white rectangle but a little square button with a small Edit icon on it! Drag it to where you want it and then bring up the main menu. This time it's the final choice, Quit design, which is needed. The message "Reformatting database" appears briefly then we're back in normal data-entry mode.
Now click on the little Notes button. Assuming RISC OS knows the whereabouts of a text editor (and it should at the very least be able to find Edit) a text window will open. Initially it merely contains "Record 0:" but this is for information only and you may delete it if you wish. You can type whatever you like and as much as you like into this window. When you've finished, close the window in the usual way and the editor will prompt you to save the file. Just accept whatever filename is offered and click Save; Powerbase knows where the file should go. Try adding notes to several records and notice how the button changes to a text-file icon when you do so. On returning to these records, clicking the button with SELECT brings up the associated text for editing. The notes you enter are stored as a separate text file for each record, these text files being stored within the database application. "Ordinary" fields like the Name, Address and Phone fields are stored in a large text file called Database but the field you've just added occupies no space in Database at all, which is why we call it an External field and why you weren't expected to assign a Data length to it.
When you created the address database by choosing Default database you left the choice of primary key to Powerbase. The result of doing this is always a key consisting of the first four characters of the first writable field, in this case the first four letters of the Name field. This is a fairly primitive key-structure, even for such a simple database. Let's assume you're storing the names surname first. If many of the names in your database are of family members some of them are going to have the same key. A much better choice of key would make use of both surname and given name, so let's change our primary key to do that.
Go to the Utilities submenu on the iconbar and choose New primary key. This displays the Key definition window which tells us that the structure of the key is the four Leftmost characters of the first word in the field whose tag is NAME. It is possible to change all four of these bits of information: the field, the word, the position in the word and the number of characters. You will see also that there is space for three other similar sets of information; in other words you could derive the key from up to four different fields or words.
Leave the first line as it is and click once on the down-pointing "bump" icon on the second line. The Field icon should now read NAME like the first, the rest of the line reading 1, L and 20 (the maximum length of this field). Change the word to 2, leave the position as L (other choices are R, for "right" or a number indicating where the first character comes from). Change the length to 2 and click Create. Powerbase now asks: "Build index with records in same subfile of current database?" Tell it to proceed and the new primary key index will be created.
Looking at the keys as they appear in the title bar of the record window, you will see that they are now six, instead of four, letters long and that they consist of the first four letters of the surname plus the first two of the given name, thus distinguishing (most of the time) between people with the same surname, e.g. "Fred Bloggs" would have the key BLOGFR.