list of chapters    previous chapter   next chapter

Ch 2 - Browsing and Editing


Ch 2 - Browsing and Editing

Opening a database displays the record window which shows the data for one record at a time. Each item of data in the record occupies a rectangle called a field. Most (but not all) fields will have a descriptor or label which appears next to the field. In addition all data fields will have a tag of up to four characters. Tags are very important - far more so than descriptors - as a means of identifying fields (see 4.2.4). If you click MENU over a field you will see its tag displayed in the menu, e.g. Field: NAME.

2.1 Subfiles, record numbers and keys

Look at the title-bar of the record window. Three pieces of information are displayed; the subfile number , the record number and the key of the record. Since we will make frequent reference to these terms it will be as well to explain each one at the outset.

2.1.1 Subfiles

Suppose you have a bookshelf, capable of holding 100 books, and six partitions, numbered 0-5, which you can use to divide it into sections. The partitions are, to begin with, all stacked together at the left-hand end of the shelf. You may leave them like this if you wish and fill up the shelf with an unbroken run of 100 books. If, however, the books fall into well defined categories you might prefer to use the partitions to divide the shelf up into sections. There are no restrictions on where you can place the partitions, or how many books you put into each section, as long as you don't exceed the total of 100 books.

In a similar way every Powerbase database is able to use up to six subfiles numbered 0-5. When you open the database you are looking at subfile 0 and you might have no occasion to bother with the others at all, in which case they can be ignored. Like the bookshelf partitions subfiles are there for you to use or not use depending on what your requirements are. The database remains the same size whether you use one subfile or all six and the number of records in a subfile is limited only by the defined size of the database. Unwanted subfiles can, however, be disabled. To do so choose Subfile control from the main menu. The window which opens has a button for each subfile and an associated menu button which allows them to be disabled and re-enabled. It is also possible from this menu to name subfiles and to swap the positions of any two subfiles.

Section 2.2.5 suggests instances in which you might find it advantageous to use several subfiles.

2.1.2 Record numbers

Every record in the database has a number which specifies its position in a file called Database. As you step through the records (see 2.2) you will probably find that the record numbers shown in the title-bar look quite random. Record numbers reflect the order in which records were originally entered into the database, not the order in which you see them while browsing. The latter is determined by the key.

2.1.3 Keys

A key is a group of letters or other characters derived from one or more of the data fields in a record and used to identify that record. A record is, of course, uniquely identified by its record number but record numbers are of limited use because they only reflect the order in which the records were entered. Keys, on the other hand, are derived from the actual data and are stored in a special table called an index. The keys in the index are ordered , either alphabetically or numerically and can therefore be used to examine the records in an order which is related to the data. To use the bookshelf analogy again, you can specify a book as "the 15th from the left" (which is equivalent to using the record number) but specifying it by title, author or subject is much more useful. A key enables us to do the same for database records.

A database may have several indexes built from keys based on different fields in the record but there must be at least one which we call the primary key index. When you come to create a database of your own you will find that Powerbase insists that you define the primary key before you can use the database. Subsidiary keys may be defined at any time; whether you use them or not is up to you.

Look at the key field and at the key itself in the title-bar and you will see that the two are related. You can recognize the key field for the currently-active key by its descriptor (label) which will be red (Note 1). Key fields for unselected keys have blue descriptors. Non-key fields have black descriptors.

The primary key field is further identified by the background colour of the data icon which is pale yellow instead of white like the other data fields. 

2.2 Moving about the database

Attached to the left-hand edge of the record window is the tool-pane which contains buttons for moving around the database, adding and deleting records, searching for records etc. (An alternative way of presenting these buttons - the keypad - is described in 14.1.1. It is also possible to place some or all of the buttons on the record window itself and use neither tool-pane nor keypad. 4.2.13 explains how to do this and the sample database Boxes shows such buttons in use.)

Most of the buttons have keystroke equivalents provided by the numbered function keys (F1-F11) and experienced users might want to use these instead of the mouse. The relevant keystrokes are given in the text where appropriate but note that these are default values and may be redefined if so desired. Many other actions have equivalent Ctrl sequences which can't be redefined. See Appendix B for a full list.

2.2.1 Browsing

At the top-left of the tool-pane is the single-step button. This, when clicked with SELECT, steps forward through the records one at a time. Clicking with ADJUST steps back one at a time. The keystroke equivalents for these two actions are F2 and F1 respectively. Beneath the single-step button is what we might call the fast forward/rewind button: it steps through the records in jumps of 10, using SELECT and ADJUST in the way just described. (Keys: Shift F2/F1). You can alter the number of records jumped by entering a different number in the writable icon to the right of the button. At top-right is the ends button: SELECT displays the final record, ADJUST displays the first record (Ctrl F2/F1).

The terms "forward", "back", "final" and "first" in the preceding description refer to the order of records as determined by the keys in the index. The file "wraps around" so after the final record, SELECT-clicking the single-step button takes you to the first record. If you display the first record, ADJUST-clicking the single-step button displays the final record.

The buttons on the 3rd row resemble the play and stop buttons of a CD player or VCR and it will be convenient to refer to them by these names. Play (F11) causes Powerbase to run through the records, displaying each one briefly, and stop ( Shift F11) halts the process. Closing the record window has the same effect as stop and so does the Escape key. If play is clicked with SELECT records are displayed in forward order. Using ADJUST displays them in reverse order. You may swap the order at any time by a further click on play. The time for which each record remains on screen may be altered by changing the "Fast forward interval" (see above); the larger number you type into this icon the longer each record will remain on screen.

At the bottom of the tool-pane are four bookmarks which let you mark specific records for rapid retrieval. Click on one with SELECT and the number of the current record appears in the icon. Clicking with SELECT on a bookmark icon which contains a record number will return you to that record. Click with ADJUST to clear the marker.

2.2.2 Cross-referencing records

If you Shift/double-click on a field with SELECT, and the contents of the field match the current key of another record, that record will be displayed. The same is true if the field contains a record number preceded by a # symbol. This is a very handy facility for jumping quickly between records which are related in some way. It will also work if a field contains a comma separated list of keys or record numbers. A Shift/double-click on any one of these keys takes you to the relevant record. You could experiment with this using the Elements database. Look up, say, SODIUM, enter in one of the 'Notes' fields the primary keys of the other Group 1 metals, i.e. lith,pota,rubi,caes,fran (case of letters is unimportant). You can now access the records of these elements from SODIUM's record. 

2.2.3 Changing keys

Skip the next three rows for now and examine the one bearing a blue symbol resembling a key. It is used to cycle through the available indexes using either SELECT or ADJUST (for reverse order, as you might expect). Shift F5/F4 have the same effect. Wrap-around again applies. If no subsidiary indexes have been defined the button will have no effect.

2.2.4 Changing subfiles

Underneath the key-change button is one for changing the subfile being examined. A newly-opened database always displays subfile 0. Clicking SELECT on the subfile-change button (F5) causes subfile 1 to be accessed instead. Repeated clicks advance the subfile number by 1 until 5 is reached, after which wrap-around to subfile 0 occurs. ADJUST, as you might guess, accesses the subfiles in reverse order (F4). Subfiles which are disabled (see 2.1.1) are skipped over and cannot be accessed.

2.2.5 Using more than one subfile

A Powerbase database consists, as stated earlier, of six subfiles numbered 0-5. You may use subfile 0 (which is the one used by default) and ignore the others if you wish, but there are occasions when users might find multiple subfiles very useful. If, for example, you are maintaining a set of pupil records in a school you could assign one subfile to each year. At the end of a school year the promotion of Year 1 pupils to Year 2, Year 2 to Year 3 etc. can be brought about very easily using the Rotate subfiles feature. You will find the two action buttons for this on the window accessed from Subfile control on the main menu. It actually renumbers the subfiles so that (for "clockwise" rotation) subfile 0 becomes 1, 1 becomes 2 etc and 5 becomes 0. Records which were previously in, for example, subfile 2 will then be found in subfile 3. In an 11-16 school this would put the leavers into subfile 0, from which they could later be removed. You will be asked to confirm that it's what you really want before Powerbase proceeds.

A more common use of subfiles is to use subfile 0 to hold the in-use records and subfile 1 as a repository for records which you want out of the way but don't want to lose permanently. Powerbase is actually used in this way in a certain Further Education college where the applications file for a course is built up in subfile 0. On enrolment day records are updated to reflect students' subject choices and all the records for applicants who have not appeared are moved into subfile 1. The enrolled students in subfile 0 are then timetabled and class lists are printed. During the first week of the course there is a trickle of late enrolments which simply involve retrieving the required records from subfile 1 and reinstating them in subfile 0.

The facilities for moving records, singly or in batches, from one subfile to another are described in 2.4.2 and 2.5.6. You can, of course, also select a subfile and type new records directly into it.

2.2.6 Naming subfiles

To give subfiles meaningful names choose Subfile control from the main menu. This opens a window with pop-up menus for each subfile. Name then leads to a writable menu item into which you may type a name of up to 20 characters. This then becomes the name of the current subfile and will be saved on closing the database.

2.3 Searching for a record

It's all very well being able to move about the database like flipping through the pages of a book but how do we find a specific record? Powerbase provides three ways of doing this: you can search for the record by key , by record number or by using a filter.

2.3.1 Searching by key

The button with the question mark is the search button (F8). When clicked with SELECT the Search window opens to the right of the tool-pane. Type the key of the required record into the writable icon and click on the Find button or type Return. To see how the key is constructed from the key field click MENU over the record window and choose Index => Show details (Ctrl K). This displays a window describing the key structure of the currently-active index.

If the key exists in the index the record will be found and displayed. If the key doesn't exist Powerbase beeps and displays the nearest matching record with the key field flashing. If the database is a small one with keys which differ greatly from record to record then the displayed record may not look to be very near at all. If you typed Return or used SELECT on the Find button the Search window will close after retrieving the record. If you want to search repeatedly it is more convenient to have the window stay on screen and this can be achieved by clicking on Find with ADJUST. If you do this you will notice that the icon above the Find button displays the number of matches found and you may click on the left and right "bump" icons to retrieve the matched records in sequnce

Clicking on the up and down "bump" icons in the Search window allows you to search an index other than the current one. The index used affects the search only; clicking the browsing buttons on the tool-pane will show you that the current index has not been changed.

A search carried out as described looks only at the current subfile. If you suspect that the record you require might be lurking in some other subfile you can force all six to be searched. This can be achieved by using ADJUST (Shift F8) instead of SELECT on the search button. When the Search window appears you will see that the All subfiles radio button is selected instead of This subfile. The radio buttons enable you to change your mind after the window has been opened.

If searching on a numeric key you must enter a number of exactly the right value. If, however, the key is alphabetic you may use just the first few letters if they are sufficient to distinguish the key from others.

There are two other buttons on the Search window. Old restores the last key entered into the writable icon and Cancel simply removes the window from the screen without further action.

2.3.2 Searching by record number

You may type a record number, preceded by # (e.g. #1054), in the Search window instead of a key. Provided the record is in use Powerbase will find and display it, regardless of which subfile it is in. Bear in mind that, if the record is found in some other subfile than the current one, that subfile will become the current one. If the record has been deleted or has never been assigned a "Record #xxx is not in use" message is displayed.

2.3.3 Searching by filter

The Filter button (Ctrl F8) is just above the bookmarks on the tool-pane. Selecting it brings up the Filter window which contains a writable icon into which you can type a search formula (see 3.5). You should then click on the Filter button in the Filter window or, alternatively, type Return. The buttons used for browsing will now only display records which match the search formula, all non-matching records being filtered out. Deselecting the Filter button closes the Filter window and restores normal browsing operations. So does clicking Cancel on the Filter window. The Close button simply closes the Filter window but leaves the filter in effect - useful if you want the window out of the way once you've set up a filter.

Clicking on the single-step button with the filter window open and a filter active causes a displayed number to increment with every match found until the end of the subfile is reached. Wrap-around then occurs and the number no longer increases. Clicking Count displays the total number of matches in the subfile straight away without the need to step through the records.

2.4 Editing the database - fundamental operations


2.4.1 Adding new records

The icon bearing a plus sign is the add record button (F10). Clicking with SELECT displays a blank record for you to fill in. The subfile number and anticipated record number are shown in the title-bar of the record window but there is, of course, no key as yet because there is no data. The title-bar therefore reads "(New)" in the place where the key would normally appear. In most databases you may leave blank any fields except the primary key field (Note 2). Powerbase does, however, allow other fields to be defined as mandatory fields (see 4.2.14). If the database contains such fields (which normally have red as their foreground colour) you will be told about them when you try to move to another record or close the database and will be unable to do so until you fill them in. You might also find that on some fields pressing certain keys has no effect. This will happen, for example, if you try to type letters into a field which has been defined as Numeric.

Ctrl D will insert the current date into a field and Ctrl T will insert the time. The fields need not be designated as Date or Time fields for this to work (if so designated they will accept only the date or time) but the data will not be inserted if it is too long for the field.

If you type into a field whose text and border are dark green you may get an error message. These fields only accept certain values which are listed in a validation table (see 5.2). To see what these values are make sure the caret is in the relevant field then click on the Table button on the tool-pane. There are times when this data-validation feature can become a nuisance, so it can be turned off. Bring up Powerbase's iconbar menu and choose Preferences. One of the option buttons on the left of the preferences window is called Validate input. Deselect this button and click on Accept. All validation, including insistence on filling in mandatory fields, will then be disabled. Ctrl F9 can also be used to toggle validation on and off.

After entering data into a field you can go to the next field in sequence by typing either the Return or the down-arrow key. To go back one field use the up-arrow key. These arrow keys work in such a way that attempting to go beyond the last field of the record takes you to the first field and attempting to go back from the first field takes you to the last - our old friend wrap-around again. Typing Return on the last field of a record acts rather differently in that it writes the record to disc and brings up a new blank record for editing, i.e. it duplicates the action of the add record button on the tool-pane. You can also place the caret in any editable field by clicking with SELECT.

When you have entered as much of a record as you wish you can click add record again for another blank record. The record you have just entered is automatically written to the database. The same is true if you click on any other tool-pane button or close the database altogether. You don't need to use the Update (F3) button to tell Powerbase to write the record - its real purpose is to make Powerbase save indexes and validation tables which are stored in memory. Occasional use of the button during a long working session guards against power cuts or system failure.

2.4.2 Deleting records

The two buttons below the search and add buttons are concerned with record deletion. The second of these, which suggests putting an index card in a dustbin, is obviously a delete button (Ctrl F10) but what about the other? A click with SELECT (F7) moves the displayed record forward, normally by one subfile, e.g. if the record is in subfile 0 it will be moved to subfile 1. If it is in subfile 5 it will be moved into subfile 0 (wrap-around again). Clicking with ADJUST (F6) normally moves the record back one subfile. A record in subfile 5 will be moved into subfile 0. Normal behaviour is modified, however, if subfiles have been disabled (see 2.1.1). The record is then moved to the next (or previous) enabled subfile.

This button, which we will refer to as the move record button, clearly doesn't delete records at all, except in the sense "delete from the current subfile ". We often want to get a record out of our way but keep open the option of bringing it back again and that's where these buttons are really useful. If you have a lot of records in subfile 0 and want to do a clear-out you can use subfile 1 as a dumping-ground for the unwanted records. You're not really deleting them: just removing them from the subfile you're working in.

It is sometimes useful when moving a record, to be able to "follow" it into its new subfile. You can do so by holding down Shift while you click on the move record button. e.g. If you use Shift-SELECT to move a record from subfile 0 to 1 you will be left with 1 as the current subfile and the record displayed.

The delete (dustbin) button should only be used when you are sure you want to lose the record permanently. As this is quite a drastic action Powerbase will ask you to confirm it before the record actually disappears. Nervous users may prefer to leave this button strictly alone and do all their "deleting" with move record. If this eventually results in a lot of clutter in the subfile next to the one you're using you can always do an occasional clear-out as described in 2.5.6.

2.4.3 Altering existing records

A displayed record may be altered manually without any restrictions other than those applying to the addition of new records (see 2.4.1). Alterations which would result in a change to the primary key must be confirmed. Normal RISC OS conventions for editing writable icons apply, e.g. Ctrl U clears the icon. As with new record entries you need do nothing to save your changes to disc. The process takes place automatically before a different record is displayed, when a database is closed or on quitting Powerbase.

2.4.4 Undoing mistakes 

Changes to the record on-screen can be undone provided you haven't clicked on Update (not normally needed anyway) or done anything to cause Powerbase to display a different record. In other words, you can undo changes made to the current record as long as it remains on the screen. You may either undo all the alterations made to the record or only those relating to specific fields.

If you bring up the main menu and choose Undo changes the record will be returned to the state it was in when you displayed it and before you began to edit it. To restore an individual field, click MENU over the field then go to the Field submenu and choose Undo changes from there. Only ordinary writable fields and check-boxes may be restored; you can't restore External fields (see 2.6) which is why a warning is normally issued before deleting such fields.

2.5 Editing the database - special features

Section 2.4 described all the editing facilities you actually need in order to maintain your database. The features described in this section are not essential but they can save you time and make your use of the database more efficient.

2.5.1 Using a template

You may want certain fields to be filled in with fixed contents on every new record to save typing the same thing every time and Powerbase provides a means of doing this. Call up the main menu, go to the Miscellaneous submenu and choose Edit template (Ctrl E). A blank record is displayed and the window title says "Enter data which you wish to appear by default on new records". Type in the required fixed data then click any of the usual tool-pane buttons. You will now find that the new record displayed every time you click add record is no longer blank but already contains the data entered in your template. This feature affects new records only; it doesn't have a retrospective effect on existing records. You may drop a sprite of your own onto a Picture field to be used instead of the default Sprite icon when a record has no sprite associated with it.

2.5.2 Copying fields

The two buttons above the Update button may be thought of as copy to clipboard (Ctrl C) and paste from clipboard (Ctrl V) respectively. They can save a lot of time when you want to copy data from one field into another. When you click SELECT on copy , the contents of the field which owns the caret is stored in memory. Positioning the caret in another field and clicking on paste will copy the stored data into the new field, erasing the field's previous contents (if any). If the data is too long for the field it will be truncated. If there is nothing on the clipboard the data from the same field in the previously-displayed record will be copied to the field. copy and paste are not limited to copying into another field of the same record; you may use them to copy data between records or from a record into a validation table or a dialogue box or, indeed, between any two writable icons within Powerbase. Data remains on the clipboard until you use copy again.

Even more conveniently data can be copied by simply dragging with SELECT. If you place the pointer over a field and hold down SELECT, a text-file icon appears under the pointer. This may be dragged and dropped into another field (provided it is an editable field) or into a writable icon in a dialogue box. It can even be dragged to another database if you have two copies of Powerbase running at once with two databases open. (The field contents may also be dragged to a different application such as a wordprocessor, or to a filer window where it will be saved as a file named from the field's tag. See also 8.8.)

This is a suitable place to explain how Powerbase can also copy data to and from other applications by means of the global clipboard. The latter is a feature of RISC OS which few users seem to know about and not all applications use it. Here's how it works. Highlight one or more fields with ADJUST as described above and make sure the caret is in the displayed record. It needn't be in one of the highlighted fields; any field will do. Now type Ctrl Shift C. Nothing appears to have happened but the highlighted data is now on the global clipboard. If you open, say, an Impression window, place the caret in it and type Ctrl V the data will be copied to Impression.

If, on the other hand, you highlight data in Impression and type Ctrl C , then place the caret in a Powerbase record and type Ctrl Shift V the data will be copied from Impression to Powerbase. The same method may be used to copy data from Powerbase to Writer, Easywriter or Techwriter. For StrongEd you need to type Ctrl Shift V. Although copying in the reverse direction works fine with Impression it does not appear to work with these other applications. Edit doesn't appear to support the global clipboard at all.

2.5.3 Copying an entire record

When a new record contains much of the same information as an existing one you can save time by copying a whole record and editing the copy. Display the record you want to copy and then click the add record button with ADJUST instead of SELECT (Shift F10). No blank record appears when you do this; instead an exact copy of the current record is displayed and a message appears informing you of this.

If you make no changes to the copy Powerbase will not add the new record to the database. (It is assumed that no-one will ever want two absolutely identical records in the same database!) Any alteration, however, leads to the record becoming part of the database.

2.5.4 Choosing the field where editing starts

When an existing or blank record is displayed Powerbase places the caret in the first (i.e. lowest-numbered) writable field of the record. (This might not necessarily look like the first if the fields have been placed in out-of-sequence positions in the window.) When going through a database making changes to one or two fields somewhere in the middle of a large number of records it might be convenient to have the caret start somewhere else. Click MENU over the field where you wish the caret to start, go to the Field submenu and choose Start editing. Whenever a record is displayed the caret will be placed in the chosen field. The same procedure is used to restore the normal starting position. The same result can be achieved by placing the caret in the required field and typing Ctrl @.

2.5.5 Changing many records at once

To alter a given field in a set of records point the mouse at the field and click MENU. Go to the Field submenu and choose Global changes. In the first writable icon (Replace) enter what you want changing and in the second (with) enter what you want the first string changing to. In the third you may enter a search formula (see 3.5) specifying which records are to be changed. Finally click on Change or type Return. You will be asked for confirmation before the changes are allowed to take place. Note the following:

It should be apparent from the above that leaving both Replace and the Search formula blank will place the with string in all records of the current subfile.

The characters "$" and "#" may be used as "wild-card" characters in the Replace and with strings (Note 3). The first of these is used to represent a group of characters which don't need to be matched. If you enter:

Replace $Street with $Road

the substitution will be performed on any record which matches the search formula and where the target field ends with "Street". The ending will be changed to "Road" leaving the rest of the string unchanged. Another example of use is:

Replace 47$ with 1047$

If the target field begins with "47", the beginning will be changed to "1047", the remainder left unaltered:  

Replace $MPUT$ with $NFUS$

would change "MPUT" occurring anywhere in the target field into "NFUS", e.g. "COMPUTER" would become "CONFUSER"(!). You may, of course, use "$" in the middle of a word:

Replace re$ment with dis$d

would cause a string in the target field beginning with "re" and ending with "ment" to have its head and tail replaced with "dis" and "d", leaving the middle unchanged. e.g. "replacement" would become "displaced".

The "#" character is used to represent a single wild-card character and can replace individual letters in specific positions. The Replace and with strings here must be the same length and should have "#" characters in the same positions. The characters in the remaining positions are the ones which get replaced, but only if they occur in the corresponding positions of the existing string.

You may also use Global changes to perform simple calculations e.g. "+12" in with will add 12 to the current value in the field on all the matching records. "*5-13" will multiply the current value by 5 and then subtract 13. It is operations like these which are most likely to produce values which won't fit in the field, especially if floating-point numbers are involved. The operation isn't limited to Numeric fields, or even to other types of field consisting wholly of numerals; Powerbase will find the number embedded in an entry such as "ABC45XYZ" and the operation "+12" would convert it to "ABC57XYZ".

It is also possible to change the case of letters in a field, without any other change to the data, by placing special strings in the with field. These strings are distinguished by being placed in square brackets:

[U]  Make all letters uppercase

[L]  Make all letters lowercase

[UL] Make first letter of field uppercase, the rest lowercase

[ULUL] Make first letter of each word in field uppercase, the rest lowercase

2.5.6 Moving or deleting many records at once

Choose Move/delete from the Miscellaneous submenu. This opens a window which gives you the choice of three types of operation: 

(a) Delete records from a designated subfile 

(b) Accumulate records from all subfiles into one designated subfile

(c) Move records from one designated subfile to another

The default is to Move records from the current subfile to the next in sequence, but any source or destination subfile may be specified by clicking on the bump-icons. Type in a search formula (see 3.5) and click the default action button or type Return. All matching records will be moved or deleted as specified. Operations may be undone by clicking on the Undo button, but only for the last operation carried out.

2.5.7 Hiding sensitive data

Your database might contain information which you don't want just anyone to read. A field may be hidden in the following way:

(a) From the iconbar Utilities submenu choose Alter format. This puts Powerbase into design mode. No data is displayed; just the empty fields over a blue grid.

(b) Double-click with SELECT over the field you wish to hide.

(c) In the Field design window select the option button Hide and click Update field.

(d) From the main menu choose Quit design. This returns you to normal editing mode.

The field you've just "doctored" will now have vanished. Typing Ctrl Shift F1 makes it reappear, but with its text in mid-grey to show that there's something special about it. Ctrl Shift F2 will hide it again. Even if you close the database with the field visible it will always be hidden when the database is re-opened. The field can only be returned to normal using the procedure detailed above, deselecting the Hide button.

Whilst in the invisible state a field cannot be selected for printing (see 3.4). ADJUST has no effect and you can't sneak round the protection by using Ctrl A to select all fields or by choosing a range containing the hidden field (i.e. by clicking with SELECT on an earlier field then double-clicking with ADJUST on a later one). Its tag doesn't appear in the Field entry of the main menu when you click MENU in the relevant place, nor does the field appear in the field list produced by typing Ctrl F. As soon as you reveal the data by typing Ctrl Shift F1 it can be printed as normal.

If you intend to use this facility you are strongly urged to password-protect your database (see Ch 11). Only a user with Manager access rights will then be able to use Ctrl Shift F1 and F2 or access Alter format to remove the protection. If you leave the database unprotected then anyone can use the key combinations and might easily discover them by chance (or by reading this manual!).

2.5.8 Protecting data against deletion

If you follow steps (a) and (b) above you will see beneath the Hide button another option button called Lock. Selecting this button and returning to editing mode causes the field to be locked against alterations. The Return and arrow keys skip over the field and an attempt to place the caret in it directly results in a message telling the user the field is locked against changes.

2.6 External fields

The data in External fields (see 4.2.8) is not stored within the Database file but in separate files, one for each record. With the exception of Remote fields these files are stored inside the database's application directory. They may be Text, Sprite or Draw files and can be linked to buttons on the record window. Clicking on these buttons loads the External file into Edit , Paint or Draw provided that the relevant program has been "seen" by the filer. (For Remote fields the file objects can be of any type whatsoever including applications and directories and clicking on the button performs the appropriate action, e.g. an application is run, a directory is opened, an Obey or BASIC file is executed, other files are loaded into the appropriate editor if the filer knows where it is. Remote fields are discussed fully in Ch 4.)

It is also possible to link Text files to a Text block field which will actually display the text (with certain limitations) within a large icon. Sprites may be similarly displayed in a Picture field.

2.6.1 Linking files to the fields

To link a file with an External field drag the file's icon onto the record window and drop it on the appropriate field. For example, if the record includes a field represented by a Text button, i.e. one bearing a small version of the Edit icon, you may drop a Text file onto it. The button's icon changes to the small version of the Text file icon to indicate that the file has been linked. Sprite and Draw files are linked in the same way and Powerbase will not allow the wrong type of file to be linked. A Text block field also may have a Text file dropped onto it (Note 4). The text (or as much of it as will fit inside the icon) is then displayed on the record window. The formatting will not be the same as it is when you examine the text in Edit ; lines are word-wrapped and centred within the display icon. (This is a feature of multi-line RISC OS text icons and is out of the control of Powerbase.) You can't edit the text directly but it is possible to export the file for editing (see below). Sprite files may be dropped onto and displayed in a Picture field. Any new file dropped onto an External field which is already linked to a file simply replaces the old file with the new.

2.6.2 Editing External fields

You can't edit an External field directly, only via an appropriate editing program such as Edit , Paint or Draw. As long as the editor has been "seen" by the filer clicking on the on-screen button with SELECT will load the file into the editor and display it. You can edit the file and re-save it without altering its name and it will remain associated with the same field of the record. The contents of Text block and Picture fields are loaded into their editors by a double click.

2.6.3 Clearing and exporting field contents

Clicking MENU over an External field makes available certain entries on the Field submenu which are shaded for other types of field. Remove external lets you delete the linked file from the database application (Note 5). As deleting a file is irreversible you would probably like to be warned when this is about to happen so the message "Delete object? Are you sure?" normally appears. Finally, Save contents on the Field submenu lets you export the linked file to a filer window or to another application.

2.6.4 Editing scrollable lists

Entering or altering data in a scrollable list is not very different from doing so in other types of field, but some keys do behave differently and there are extra keystrokes to access the special features of such lists.

Return moves the caret from cell to cell across the current row, then jumps to the start of the next row. When it reaches the last visible cell the list will scroll up a row if there are still rows to display. If the last cell of the list has been reached the caret moves to the next field or next record, just as it does for other types of editable field.

Shift-Up-arrow has the opposite effect to Return, i.e. it moves the caret to the previous cell.

Shift-Return behaves like Return until the last cell of the list is reached. It then adds a row to the list, moving the caret to the start of the new row. You may add as many rows as you wish and each record can have a different number of rows.

Insert with the caret anywhere in the list also adds a row to the end, but this time without scrolling the list or moving the caret.

Ctrl-Insert will insert a blank row in the middle of a list, just above the row containing the caret.

Shift-Insert is used to remove unwanted blank rows. This key-combination is quite safe: it always deletes the last row but only if the row is blank. The choice of the Insert key in this and the following combination may seem strange, but Delete can't be used because it already has a standard function in writable icons.

Ctrl-Shift-Insert will force the deletion of the row containing the caret with the loss of the data from that row. You aren't very likely to use this accidentally. Neither Shift-Insert nor Ctrl-Shift-Insert will let you reduce the number of rows to fewer than the minimum the window can display: when the scroll-bar completely fills its slot this minimum has been reached.

Up and Down arrows move the caret vertically from cell to cell, staying in the same column. When at the top or bottom of the list wrap-around occurs instead of the caret moving to the previous or following field as it does for other field types.

Wiping a scrollable list
Click MENU over the list and g to the Field submenu. Choose Blank list. You will be asked for confirmation before the data is deleted.

Data export and import
When MENU is clicked over a scrollable list two choices become available on the Field submenu in addition to Blank list noted above:

Save as list saves the contents of the scrollable list as a plain text file. The contents of each cell of the list occupies a separate line and there is nothing in the file to indicate which itbs came from the same row and which came from different rows. If such a file is dropped onto a scrollable list the data will be imported cell by cell, working along each row to the end then moving to the next.

Save as CSV saves the list as a CSV file (see Ch 8) with each row of the list as a separate CSV record and each cell in the row as a CSV field. The characteristics of the file are determined by the CSV Options window just as they are for exporting data from ordinary fields.

If you drop such a CSV file onto a scrollable list field the result is somewhat different from the importing of a text list as described above because the data in the file is more structured; the row and column information of the field from which the data came has been retained.

Suppose you have exported such a file from a 3-column scrollable list. If you drop the file onto a 2-column list the third item in each line of the file will be ignored: the destination field will contain what the first two columns of the source field contained. If, on the other hand, you drop the file onto a 4-column scrollable list the 4th column of the list will be left blank.

2.7 Backing up

Clicking the Backup button on the tool-pane with SELECT will back up your database to a user-defined directory. If no directory has been specified (or if you wish to change the backup options) click the button with ADJUST. A window will open on which the desired backup directory should be dropped. Its pathname will then appear in the writable icon. You may choose to keep 1, 2 or 3 "generations" of backup and Powerbase will move backed-up copies into subdirectories Older and Oldest where required. An option button may be selected to force automatic backing up whenever the database is closed and the choices selected may be saved in the same way as CSV options, Preferences etc.

When the Backup window is opened it displays the date and time of the most recent backup, if any.




Notes

1. Colours referred to above which are used to identify key fields are the default colours but it is possible for the user to change them (see 14.5). (back)

2. If the primary key is derived from two or more fields you needn't fill in all of them provided the result isn't a null key. (back)

3. The characters used to represent single and multiple wild-card characters may be changed via the Preferences window (see 14.5.2). (back)

4. If you drop a text file in the wrong place in the record window Powerbase will think you want to treat the file as CSV file and import data from it (see CSV files) and the Import text file window will appear. This is rather startling but harmless enough as long as you don't click on Import! Click on Cancel to get rid of the window. (back)

5. Unlinking objects from Remote, Run file and Directory button fields is also done this way (see 4.2.8 and 4.2.13). (back)



top of page   list of chapters    previous chapter   next chapter