COPYRIGHT NOTICE © Precision Software limited 6 Park Terrace Worcester Park Surrey England KT47JZ (01) 330 7166 First Edition August 1988 This manual, and the Superbase software ("Superbase") described in it, contain confidential information proprietary to Precision Software limited and are copyrighted with all rights reserved. Neither the whole nor any part of the manual or of Superbase may be copied, reproduced, transmitted, transferred, transcribed, stored in a retrieval system, or translated into any language or computer language, in any form or by any means, electronic, mechanical, magnetic, optical, chemical, manual, or otherwise, without the prior written authorization of Precision Software limited. Conditions of Authorization of Backup Copy You may make backup copies of Superbase, but not of the manual. Every copy must include the same proprietary and copyright notices as the original. If your Superbase program is supplied with a Software Protection Device, you may only use the program in conjunction with this device. Installation of a copy of Superbase on your hard disk is permitted subject to these conditions. You may not make an extra copy of Superbase for the purpose of using it on another computer. You may not sell, loan, or give away a copy of Superbase. Resale or Disposal You may sell, loan or give all the material you purchased, together with all backup copies, to another person. Trademarks Superbase is a trademark of Precision Software Limited. GEM, GEM Desktop and DOS-Plus are trademarks of Digital Research Inc. MS-DOS is a trademark of Microsoft Corporation. Atari ST is a trademark of Atari Corp. (UK) Limited. ffiM-PC is a trademark ofInternational Business Machines Corporation. SUPERBASE CREDITS Superbase Personal 2 Design and Programming: Additional programming: Additional Design: Testing: User Guide: Simon Tranmer Brian White Bruce Hunt John Barrs and Tim Arnot Simon Beesley and Bruce Hunt LIMITED WARRANTY If there is a physical defect in the Superbase program disk, manual or software protection device, Precision Software Limited will replace the defective item free of charge, provided you return the item to be replaced with proof of purchase to Precision Software Limited within 90 days of the date of purchase. In some countries the replacement period may be different; check with your software supplier. The contents of this manual are subject to change without notice and do not represent any commitment on the part of Precision Software Limited. No warranty is made with respect to Superbase, its quality or performance. Any and all warranties for merchantability and/or fitness for a particular purpose are expressly excluded. The Superbase software is sold Has is", and you, the purchaser, are assuming the entire risk as to its quality and performance. In no event shall Precision Software Limited be liable or responsible to the purchaser or any other person or entity for direct, indirect, special, incidental, or consequential damages, including but not limited to interruption of service and loss of business or anticipatory profits, resulting from any defect in or misunderstanding ofthe software or its documentation, even if Precision Software Limited has been advised of the possibility of such damages. ii '-.-/ The warranty and remedies set out above are exclusive and in lieu of all others, oral or written, express or implied. Some laws do not allow the exclusion or limitation of implied warranties or liabilities for incidental or consequential damages, so the above limitation or exclusion may not apply to you. Registration and Support Please complete and return the User Registration Card, which is included in your Superbase package. Only registered users with a User Number are eligible for free software support. Ifyou do not return the card, we will not be able to assign you a User Number when you first call in, and you will not be able to obtain free software support. Please remember, when requesting support, to make available: • • • Your User Number The version number of your copy of Superbase A clear statement of your problem While we are proud of our ability to help users solve their problems, we ask you to remember that only a precise description of a problem can lead to a precise solution. iii Before You Begin ... Superbase versions for the Atari ST and the Amiga have a number of features which are not found in the IBM PC version. At the back of this manual are two appendices which describe these machine specific features. Appendix J is for Atari owners, Appendix K is for Amiga owners. The appendices also provide additional information about installing Superbase on your system; so it is important that you read the appendix for your computer before you do anything else. Then return to this page and read the remaining sections. Any Sliperbase features which relate specifically to the IBM PC and compatibles are covered in the main body of the manual. Note: At various points throughout this manual, key controls or commands that are specific to Amiga are shown in italics. Installing a Printer Driver Superbase is already set up for Epson and compatible printers. If you use another type of printer, you will find instructions in Appendix I on how to install a new printer driver or modify the existing one. Readme.Doc The Superbase disk containing the demonstration files also supplies a document called README.DOC. This document describes the changes made to Superbase between the time your Superbase User Guide went to press and the time the final modifications were made to the software. README.DOC is an ASCII text file. There are two ways of loading it into the computer so that it can be read or printed out: • Using a word processor. Most word processors will accept ASCII (or non-document) files. If you have a word processing program, you should load README.DOC before starting Superbase. • Using the Superbase Text Editor. Obviously you will need to acquire some familiarity with Superbase before you can use the Text Editor to read this document. But you should make this task one of your first priorities. The Text Editor controls are described in Chapter 10. iv .~ Changes to Superbase Personal If you are upgrading from an earlier version of Superbase Personal, you will find that this version incorporates a large number of new features; among them, a built-in text editor, new field types and improved facilities for creating relational links between files. For a quick review of the new features, you can consult Appendix F. How to Use This Guide Chapter 1 is Getting to Know Superbase, a simple introduction to the basics of Superbase. You should read this before reading any of the other sections. Getting to Know Superbase provides you with the essential information you need to use Superbase effectively: opening files, viewing records, using the Control Panel, and searching the database. Chapters 2 to 8 explain in detail the various menu options and provide useful guidelines on how best to use each option and the system. Two tutorials in Chapters 3 and 6 give you the chance to consolidate your knowledge of setting up files, entering data, and using some of the important Process Menu options. These chapters take you through the Superbase menus in a systematic way: there is one chapter for each menu, and it covers each of the menu's options in turn. Chapters 9 to 11 adopt a different approach and provide detailed descriptions of separate topics: the External File Management System in Chapter 9, the Text Editor in Chapter 10, the Query facility in Chapter 11. Chapter 12 is a quick reference guide. It's designed for experienced users who want a brief reminder of the function of each menu option, but it's also a very useful way for a new user to get an idea of the system as a whole. There are twelve Appendices. Appendix A is a list of error messages and explanations. Appendix B gives details and examples of how to use the important LIKE logical operator. Appendix C provides a list of the functions available in the Superbase programming language, which may also be used in Superbase Filter Command Lines and Formulas. Appendix D provides you with a full list of the reserved words that constitute the Superbase programming language, and so may not be used as field names. Appendix E lists ASCII codes and decimal equivalents. Appendix F describes the differences between Superbase Personal 2 and earlier versions of the program. Appendix G provides you with some useful tips on how to get the best performance from Superbase. vi Appendix H is only relevant to Gem versions of Superbase. It explains bow you can gain more memory which you might need in order to display images from the External File System. Appendix I explains how to install a printer driver (referred to here as a printer definition file). You will only need to consult this if you use a printer which is not Epson compatible. Appendix J describes certain options for configuring Superbase when it starts up. Appendix K explains how to set up Superbase on the Atari, and describes those aspects of controlling Superbase that are specific to this machine. Appendix L does the same thing for Amiga owners, providing information on any features that are only available on the Amiga. 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 CONTENTS CHAPTER 1 GETTING TO KNOW SUPERBASE 1·1 Welcome to Superbase ......................................... 1-1 Loading Superbase ............................................ 1-1 The Superbase Menus .......................................... 1-2 Opening a File ................................................ 1-3 Control Panel ................................................. 1-9 Opening Fields to View ........................................ 1-12 Paging ....................................................... 1-13 Moving Columns .............................................. 1-13 Form View Design ............................................. 1-14 Summary ..................................................... 1-16 The Key Lookup Button ........................................ 1-16 The Filter Button .............................................. 1-19 Fifteen Minute Tutorial ........................................ 1-25 Other Filter Based Options ..................................... 1-27 The External File Button ....................................... 1-28 CHAPTER 2 USING THE PROJECT MENU 2-1 New File: Overview ............................................ 2-1 Setting Up a New File .......................................... 2·3 '~~/ The File Definition Dialog ........................ ~ ".............. . 2-4 Creating a New Field ........................................... 2-5 Text Field .................................................... 2-8 Numeric Field ................................................. 2-10 Date Fields ................................................... 2·13 Time Fields ................................................... 2-15 External File Fields ............................................ 2-16 Field Attributes ............................................... 2-16 Validation .................................................... 2-17 Calculation Formula ........................................... 2-22 Constants ..................................................... 2-29 Formulas and Functions ........................................ 2-29 Using the Ternary Operator ..................................... 2-30 Using Formulas for Multi-file Applications ....................... 2-32 dBase Compatibility ........................................... 2-35 Creating Indexes for a File: New Index ........................... 2-35 The Superbase Working Environment ............................ 2-38 CONTENTS Open File .................................................... Open Fields .................................................. Open Index ................................................... Close File .................................................... Close Fields .................................................. Edit: Changing a File Definition ................................. Rules for Changing Fields ...................................... Save File ..................................................... Quit ......................................................... 2-38 2-40 2-42 2-44 2-45 2-46 2-47 2-51 2-53 CHAPTER 3 TUTORIAL: SETTING UP A NEW FILE 3-1 CHAPTER 4 USING THE RECORD MENU 4-1 Editing Features .............................................. Record New .................................................. Record Save .................................................. Batch Data Entry .............................................. Record Edit .................................................. Record Duplicate ............................................. Record Remove. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. External > > and External < < ................................ Twenty Minute Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. 4-1 4-6 4-7 4-8 4-9 4-9 4-10 4-10 4-10 CHAPTER 5 USING THE PROCESS MENU 5-1 Update ...................................................... Query: the Heart of Superbase .................................. The Query Options .......................................... " Process Remove .............................................. Process Import ................................................ Process Export ................................................ Using Process Export .......................................... Process Print ................................................. Process Mail Merge ........................................... Process Labels ................................................ 5-1 5-8 5-9 5-11 5-13 5-15 5-15 5-16 5-17 5-22 CONTENTS CHAPTER 6 TUTORIAL: THE PROCESS MENU OPTIONS 6-1 CHAPTER 7 USING THE SET MENU 7-1 Output Device ................................................ 7·1 Views ........................................................ 7-2 Paging ....................................................... 7·4 Options ...................................................... 7-5 Number Format ............................................... 7-13 Dateffime .................................................... 7-13 CHAPTER 8 USING THE SYSTEM MENU 8-1 Version (Amiga Only) .......................................... 8-2 Directory ..................................................... 8-2 Status ........................................................ 8-3 List .......................................................... 8-4 Reorganize ................................................... 8-4 Housekeeping Options ......................................... 8-6 CHAPTER 9 EXTERNAL FILE MANAGEMENT SYSTEM 9-1 External File Fields ............................................ 9-2 Viewing Text Files ............................................. 9-4 Searching External Text Files ................................... 9-5 Querying External Files ........................................ 9-6 Gem: Viewing Picture Files ..................................... 9-6 Manipulating Windows ......................................... 9-8 Amiga: Viewing Picture Files ................................... 9-10 Image Menu .................................................. 9-11 Record Menu ................................................. 9-12 Control Menu ................................................. 9-13 External Sound Files .......................................... 9-15 CHAPTER 10 THE TEXT EDITOR 10-1 Creating a New File ........................................... Entering Text ................................................. Editing Text .................................................. Formatting Text ................................................ Setting the Type Style .......................................... 10-4 10-4 10-5 10-9 10-12 CONTENTS Loading Text ................................................. 10-13 Saving Text Files .............................................. 10-14 Printing Text ................................................. 10-14 CHAPTER 11 USING QUERY Query Definition Dialog ...............•....................... Query Fields .................................................. Query Report. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. Report Example .............................................. Query Filter .................................................. Relational Queries ............................................ Query Order ................................................. , Query Output Destination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . •. 11-1 11-1 11-2 11-12 11-14 11-20 11-21 11-23 11-25 CHAPTER 12 QUICK REFERENCE GUIDE 12-1 APPENDIX A ERROR MESSAGES A-1 APPENDIX B THE LIKE OPERATOR B-1 Examples .................................................... B-2 APPENDIXC FUNCTIONS C-1 APPENDIXD RESERVED WORDS 0-1 APPENDIXE ASCII Values E-1 APPENDIX F CHANGES IN SUPERBASE F-1 APPENDlXG TUNING FOR OPTIMUM PERFORMANCE G-1 APPENDIX H GAINING MORE MEMORY H-1 CONTENTS APPENDIX I THE PRINTER DEFINITION FILE 1-1 APPENDIXJ SUPERBASE START OPTIONS J-1 APPENDIXK SUPERBASE ON THE ATARI-ST K-1 Superbase Environment ........................................ K-2 APPENDIX L SUPERBASE ON THE AMIGA ~---_...-/- L-1 Setting up Superbase ........................................... L-1 Loading Superbase ................ ,. .... ,.,.,. .......... ~ ~ ........................................... ~ L-2 INDEX 1-1 CHAPTER 1 GETTING TO KNOW SUPERBASE Welcome to Superbase At this stage, you should have already installed Superbase on your computer. You should also have familiarized yourself with the features that are specific to your computer and are not covered in the main body of the manual. For the Amiga and Atari ST, the installation procedure and machine differences are explained in their appendices at the back of the manual. Any features which are specific to the IBM (and compatibles) version of Superbase are covered in the main body of the manual. This chapter provides a quick introduction to Superbase. At the end of this session, you will have gained an understanding ofhow to perform some of the basic database management operations of the Superbase system. Loading Superbase Once the Superbase icon is shown on your computer's desktop interface (GEM on the IBM and Atari ST, Workbench on the Amiga), you can load the program by pointing with the mouse and double clicking on the program's icon. Superbase's opening screen presents you with a Copyright Notice that draws your attention to certain legal facts. It also includes the program Version number, which you should be ready to quote if you ever need to request telephone or written support. GeHing to Know Superbase 1-2 The Superbase Menus ':--"" Project New File Index Open File Fields Index Glose File Fields Edit File File Save Rel1love File Index Text Quit Set Screen Printer Table view Forn view Record view Paging Options NlIlllber forlllat Date format Record New Edit Batch Duplicate Relllove Save External » External « Process Update Edit load Save Query Edit load Save Relllove hlpot~t Export Print ~1ai1 Illerge labels Systerll Printer options Directory list Directory change Statlls file Status systelll Reorganize List Delete Renane Copy On the Amiga, Printer options on the Project menu is replaced by Version, and the System menu includes Screen Dump as an additional option. Getting to Know Superbase 1-3 Ghosted Items Menu items that are temporarily unavailable are shown in faint script, and are known as 'ghosted' items. We use this feature in Superbase, most obviously during this start up phase when no file is open. To see this, pull down the Record Menu. You'll see that all the items on this menu appear to be faint, as if only half the dots that make up each letter were being used. If you try to select a ghosted item, nothing will happen. A quick look at the Control Panel at the bottom of the screen will reveal that most of the control buttons are also ghosted while no file is open. Keyboard Equivalents For some operations, Superbase provides a keyboard equivalent to the mouse. This allows you to select a menu item without having to display the menu on screen, and without having to use the mouse pointer. So, for instance, you could have selected Open File simply by pressing the Alt key (the right Amiga key) and the letter 0 together. Note that the keyboard equivalent will not work while the menu is on screen. If there is a keyboard alternative for selecting a menu item, it is shown on the menu as the diamond symbol (representing the Alt key) followed by a letter. On the Amiga, it is shown as the Amiga key character. To select the item, you can either press both keys together, or you can hold down Alt (the right Amiga key) and then press the letter key. Opening a File If you look at the top centre of the screen you will see a message that reads "Superbase: Please open a file". You always see this message when you start Superbase up, or when there is no file open. Since you can't do any work without a file, let's open one and take a look at it. Select Open File from the Project Menu. Notice that some other items are 'ghosted'. and that the only ones available are New File. Open File, Text and Quit. GeHing to Know Superbase 1·4 Superbase Dialogs (Requesters) Superbase uses Dialogs to communicate information to you. For example, the dialog you've just selected is the Open File dialog. Open file Dialogs like this one (some are more complicated) are used in most Superbase operations. They communicate messages to you and require you to do a specific action. This action involves making selections by clicking the mouse or typing in a number or a text value of some kind. Many dialogs show a panel that contains a list of items such as file names or field names. The panel may be only a few lines long, so there may be more files or fields than can be shown at one time. If there's a gap at the bottom of the scroll bar there are more items to be viewed. You can show them by dragging down the scroll bar at the right of the panel, or by clicking on the downwards pointing arrow gadget below the scroll bar. One very important fact about dialogs is that you must respond to them before you can do anything else. Most dialogs have a Cancel button. Clicking on this returns you to whatever you were doing previously. If there's no Cancel button there is certain to be an OK button, and you can safely click on this once you've read the dialog. Many Superbase dialogs include a Clear button. This has the effect of removing anything that's in the Selection Box, and can be used at any time. Getting to Know Superbase 1-5 Default Dialog Keys In GEM versions of Superbase many of the dialogs accept Return as the keyboard equivalent to clicking on the OK or Cancel buttons. Superbase indicates which of the two buttons will accept the Return key instead of a mouse click by highlighting the button with a thick black line. As well as the Return key, the Amiga version of Superbase also accepts the Escape key as a keyboard equivalent. Press the Return key to select OK, press the Escape key for CanceL In cases where a casual OK might be destructive, Superbase does not allow the Return key equivalent. Changing the Directory The Open File dialog is one of a number of Superbase dialogs that present you with a list of file names. In each case, the file names refer to files in the current directory. When you load Superbase for the first time, the current directory will be the directory in which you installed Superbase. Generally, this directory will not be the same as the directory or drive where you keep your data. You can check that this is so by looking at the Open File dialog. If the dialog panel is empty, it means that the current directory does not contain any data files. For the rest of this session, you will be using the Address file which is supplied with Superbase as a demonstration file. Before proceeding, you need to change the current directory to the directory or drive which holds the Address file. You can do this using the Directory Change option in the System menu. The demonstration files are supplied on a separate disk to Superbase itself. On a floppy disk system, you should select the drive which holds the demonstration disk. On a hard disk system, you may have already copied the demonstration files to the hard disk. If you have stored them in a separate data directory, you should change to that directory. !fyou have stored them in the same directory as Superbase, you do not need to select the Directory Change option; the files will already be in current directory and will be listed in the Open File dialog. Getting to Know Superbase 1·6 Path names Superbase also allows you to select a file in another directory or on another disk without changing the current directory. To do this, type the path name and the file name directly into the Selection Box - that's the box underneath the panel of file names. The Selection Box acts as a scrolling window on the path name and file name. If you enter a character string longer than the window, it scrolls to the right. Uyou want to correct what you have typed in, you can scroll the window to the left using the left cursor key. Here are some examples of the way path names are used: A:Address DFO:Address This uses the drive specifier A: (DFO:) to select the Address file which is stored on the disk in drive A (drive 0). \Sbpers\Address ISbpers/Address This selects the Address file which is stored in the Sbpers directory. You may specify a pathname in any dialog which is used to select files. However, there are some circumstances where it is inappropriate to do so. In particular, you should not enter a pathname when you select a file with the Close File dialog. Superbase accepts pathnames up to 40 characters long (not including the file name). Choosing the Address File After selecting Open File, move the pointer into the dialog panel, which contains a list of file names. Move it over the file name Address. Click once on the name Address. Superbase copies the name of the file you've selected into the Selection Box. (If you see the wrong file name in the box, move the pointer carefully onto the right file name, and click again). Once you've selected the file, move the pointer onto the OK button and click once. Superbase now opens the Address file. As a faster alternative to this procedure, you can double click on the name to open the file without pausing to click on OK 1-7 Getting to Know Superbase The Main Display When Superbase opens a file from the start up screen, it automatically reads the first record in the file and shows it on the Main Display screen. You'll see the name of the file appear on the title bar at the top of the window, followed by the name of the field on which the file is currently indexed. SSP The Main Display is Superbase's permanent window onto your database. It's like a large worksheet, 273 columns across; the number of lines you can see depends on the size of your window. Superbase uses the Main Display to show you the records in the current file, as well as the results of some other operations. At the bottom of the Main Display is the Control Panel, which we'll be looking at in a minute. On the Main Display, the field names for each record in the Address file appear down the left-hand side of the screen. The data for each field is displayed to the right of its field name. If the data for a field is wider than the window, it extends off to the right. You can bring it into view using the scroll bar at the bottom of the window. Remember that if there were more fields in the record than you could see, you could view them by dragging the scroll bar at the right of the window downwards, or by clicking on the downward pointing arrow. 1-8 Getting to Know Superbase Record View, Form View and Table View The record format in the Main Display picture on the left is only one of the three possible ways oflooking at your file. It's called Record View. This view shows the records one at a time, restricting the format by keeping the field names on the left and limiting you to one field per line. In Form View, you also see one record at a time. Each record is like a form or page and, as you'll see later, you can drag the fields around to create a worksheet designed to suit your application. The third display format is Table View. This displays the field names across the top of the screen with the data appearing in rows and columns, each record occupying one line. Switching to Table View Select Table View from the Set Menu. You will see the field names appear across the top of the screen. The same record is shown, but each item of data appears underneath its field name. As with Form View, there are ways of changing this row and column display to suit your own preferences, which we'll explain later. . " ";',',': ,.:: .:: ,--.. .~ Getting to Know Superbase 1-9 Scrolling the Screen While you are viewing your record in Table View you will notice that the field names do not all fit onto the screen. The fields to the right can be viewed using the arrow at the right of the bottom scroll bar. Move the pointer onto this arrow, and click on it once. The display shifts five columns to the left. Click once on the left-hand arrow to shift right and restore the display. If you want to shift the display by larger areas, drag the bottom scroll bar with the mouse, or click in the scroll box. Control Panel ,.-/ ,_.-/ '---/ Now that you've opened a file, and discovered how to change the way in which records are displayed on the screen, let's look at the Control Panel. This is your means of controlling the main display. As you can see there are 12 buttons, most of them modelled on the controls for a video cassette or tape recorder, so you should find these conventions easy to learn and remember. Each button has a special purpose, and together they fall into three groups. On the left are the Pause and Stop buttons, followed by seven buttons for browsing through the file. On the right are three special purpose buttons which we'll examine later. The functions of some controls are more intuitively obvious than others, so we'll take a look at the first nine now, one by one. Make sure you've set Table View for this exercise. Getting to Know Superbase 1-10 Current Record ~~ 1. 1 9 After some actions the screen does not show any record data. Click on this button to redisplay the current record. You can use this button to restart Table View with the current record at the top. As well as acting as the current record button, it also allows you to change the current page in a multi-page form. As a page selector, the same hutton is used to select either the next page or the previous page. Clicking on the right-hand triangle displays the next page, clicking on the left-hand triangle displays the previous page. 1• I Next Record Allows you to view the next record in the file. The order in which the records appear is decided by the current index, which is shown by the message on the title bar of the main display window. Try this now, and you'll see the data for the next record come onto the screen. In Table View it appears underneath the previous record. In Form View it replaces the previous record. I Previous Record This gets the previous record in the file, relative to the current record. -4 I Fast Forward I •• I Instead of moving forwards through the file one record at a time by pressing the Next button, you can move much quicker using the Fast Forward button. Click on this button, and Superbase gets the next records in the file, displaying them row by row until the screen is full, when it selects the Pause button. Getting to Know Superbase 1-11 Pause When the Pause button is selected, you can only select options from the menus if the system is inactive. You can, however, use the other Control Panel buttons. So, to view the next screen of records, release the pause by clicking on the Pause button. Superbase continues with the Fast Forward display of records, stopping when the next screen is full, or when it reaches the end of the file. Pause is useful when you're searching for a record and you want to stop from time to time to read the screen. This button may also be activated by pressing the Space Bar. To release the pause, simply press the Bar again. Rewind This does the opposite of the Fast Forward button. You will see the data appear from the top of the screen, in reverse index order. If you do this immediately after Fast Forward there will be an apparent delay while Superbase displays records over the text of the existing display. I I~ I First Pressing this button automatically displays the first record in the file, according to current index order. Last Pressing this button automatically displays the last record in the file, according to current index order. I• I Stop If you want to stop the Fast Forward or Rewind display, click on Stop. You must also click on Stop if you want to interrupt Pause when it's selected. If you want to stop a process, you must use the key combination Control C. 1-12 Getting to Know Superbase Opening Fields to View As Superbase imposes no limit on the number of fields per record, you need to have a way of restricting the fields that actually appear on the Main Display. You can do this with the Open Fields option on the Project Menu. Display the Project Menu, and select Open Fields. Superbase will display another dialog. The basic procedure for selecting fields is very simple: 1. Click on a field name in the left-hand paneL Superbase copies it into the right-hand panel. 2. Repeat until the selection of fields you want is in the right-hand panel. 3. Click on OK. The list of fields in the right-hand panel is called the Open Fields List. Let's make one now. Move the pointer onto the list of field names, and click on City. Notice how Superbase copies it across. Now click on Lastname. When you have both names in the list, click on OK. If you make a mistake, Delete removes the current field from the right-hand panel; Clear removes the whole list. Superbase immediately returns to the Main Display showing the data for the two open fields. Try out the Control Panel buttons to see their effect. Experiment with Record View as well as Table View. When you've finished, restore the full set of fields by selecting Close Fields from the Project menu. Getting to Know Superbase 1-13 Paging This is another feature which gives you control over the Main Display: the Paging option. If Record View is not set, select it now from the Set menu. Then go back to the Set menu, and select the Paging item. You've now turned the Paging option off. (You can check this by looking at the Set menu again; there should be no check mark against the Paging item.) Now, select the first record in the file by clicking on the First Record button. Then click on Fast Forward, and watch the display. You'll see that Superbase doesn't pause when the screen is full it just goes on displaying records. You can still use Pause to halt the display, but the automatic pausing at the end of each 'page' of data no longer occurs. The same applies when Rewind is in use, except that the records appear at the top of the screen. If you now switch back to Table View and try out some of the Control Panel buttons, you'll see that with Paging off the difference is similar to that in Record View. Each record appears below the last, without clearing the screen. Rewind displays records from the top down, as in Record View. Moving Columns For this exercise, you need to be able to see all the fields on the screen, not just those in the Open Fields List, so if you have an Open Fields List in use, close it now by selecting Close Fields from the Project Menu. You can see that if you have all the fields open in Table View, some of the field data is very likely to be hidden from view. Normally, to see hidden fields you have to scroll the screen to the right. However, Superbase provides a way of closing up columns to get more data on the screen. Assuming you're in Table View - set it if you're not - click on the First Record button, then the Current Record button on the Control Panel in order to get the first record of the Address file on your screen. Moving a Column to the Left Now move the pointer so that it is on the space to the right of"M" in the Title field. Once you've done that press and hold down the mouse button. As you do this you will see a box appear around the field. The two vertical lines form a column beneath the Title field. 1-14 Getting to Know Superbase Keeping the button depressed, drag the pointer a little to the left, then release the mouse. You will see that the column and the field names move, and when you release the mouse tbe data beneath the field name has shifted to the left. All columns to the right have also moved leftwards. Now try the same with the Forename field. This time move the column so that it is just to the right of the "e" in Title. If you also try this with Lastname and Street you will see that as you move the columns over to the left, the field name City appears on the right of the screen. If you now move tbe City column to the left, the Code field will appear on the screen. Finally, if you move the Code field, Country will appear on the right-hand side. So by moving the columns you've got all the fields on one screen instead of two screens. Notice that you can move a column so that it overlaps the column to its left, truncating the data. This can be useful. Moving a Column to the Right If you move a column back to the right, the truncated field name and data are not automatically restored to their full length. A quick way of restoring the length of a field is to double click in its column. Then if you click on the Current Record button the full field name and data will reappear. But as this only displays one record you will have to use Fast Forward if you want to redisplay a screen of record data. Form View Design Superbase allows you to rearrange the positions of the fields in Form View, setting more than one field on a line, creating columns of fields to resemble invoices or other business forrns, and generally tailoring the system to suit your own application. The full 273 column work-sbeet is available for Form View, and you can vary the depth by dragging fields downwards, creating new lines. You can use Form View for creating new records and editing them, as well as for display. By setting the Printer option on, you can copy the visible portion of the worksheet to the printer. Select Form View now from the Set Menu. Make sure you've got the Address file open, and that the current record is the first record in the file. Getting to Know Superbase 1-15 Default Form View If you look at the screen you can see that the fields names already appear in a Form View. This is the default Form, which we have predefined for this demonstration file. You can change it, and then save it with Project Save File. Once a Form has been saved, the fields will appear in that layout every time you open the file. Moving Fields Let's move the Lastname field to another position on the screen. Move the pointer so that it's on the field name Lastname. Then press and hold down the mouse button. Superbase outlines the field name and its data area. (If you see a cursor instead, you've started editing by mistake. Carefully click again on the field name itself). Now drag the outlined box to a new position three lines below its present position. Release the mouse button. As you can see, the field name and data have moved to this new position. ''--' Now, if you want to, you can arrange the Form View for Address in any way you like. This can be just an experiment, but if you want to save the present arrangement, you can do so. Select Save File from the Project Menu. Superbase stores the File Definition, which contains the Form View location of each field, on disk. Although you have freedom to drag fields to any position on the screen, there are as usual a few limits to what you can do. "j .~ You cannot place a field on top of either the name or the data area of another field. If you try this, Superbase leaves the field you tried to drag in its original position. This will happen even if the other field is not in the Open Fields list and is not visible on screen. • Superbase won't let you move a field completely off the right or left hand end of the worksheet. • To gain more lines, move a field down into the Control Panel. Then use the vertical scroll bar on the Main Display window to bring it back into view. Move it down again if you still need more lines. • To move a field over to the right of the worksheet, position it near the right-hand edge of the screen, then shift the display with the scroll bar, and drag the field further over. • Only the open fields are shown, so close the Open Fields List if you want to see all the fields in Form View. • Getting to Know Superbase 1-16 Summary Time for a check list of what you should know before we proceed. • • • • • • • • • • • • • • • How to Open a file How to switch between Form View, Table View, and Record View How to switch Paging off and on How to drag columns around in Table View How to drag fields around in Form View How to Open and Close a list of fields How to select the Current record How to move to the First record How to go to the Last record How to move to the Next record How to go to the Previous record How to use Fast Forward to move forwards through the records How to Rewind to move backwards through the file How to Pause HowtoStop Understanding all these actions is essential if you want to be able to work easily with Superbase. If you do not understand them or are uncertain then take a little time to go back and re-read the appropriate sections before continuing. The Key Lookup Button Key Lookup. This is for the retrieval of individual records. You enter a value for the field on which the file is currently indexed, and Superbase uses the index to find and display the record. You can only use one index field at a time the Filter button is used for multiple value searching. 1-17 Getting to Know Superbase ,-/ When you click on the Key Lookup button you'll see a dialog asking for the entry of a key value. The maximum length of a key value entry is 100 characters. Record key KAS9001 OK I Clear I ICancel I Typing in Your Key Provided the cursor is displayed in the box, you can type in your index key straight away. If there is no cursor, you must move the pointer into the box and click the mouse once. This produces the cursor, and you can then type in your index key. Suppose you want to find the record for Julie Kasper. The file is indexed on the Number field, so we can use the current index to search for individuals by by their Reference Numbers. Click in the box and then type in "KASOOOl" (omit the quotation marks). This is the index key. Retrieving the Record When you press Return or click on OK, Superbase looks up the first record for which the Number field has the value "KASOOOl". If there were more than one with this value, you would have to browse through the file with the Next Record or Fast Fonvard button to find the exact record you wanted. Key Lookup with a Different Index You're not restricted to one index. Superbase allows you to have up to 999 indexes for each file, all automatically updated when you add or modify records. We've provided indexes on other fields besides the Number field: Lastname, City and Country. Let's try one of these. Select Open Index from the Project Menu. Getting to Know Superbase 1-18 Open index Click on the field name Lastname; this is copied into the Selection Box. When you're ready, click on OK. You've selected the Lastname index, and ifyou look at the title bar at the top of the window you'll see<thatthe message now reads "Superbase: Address indexed on Lastname". The record on the main display has not changed. Click on the Key Lookup button, and Superbase produces the Record Key dialog. As you did above, click in the box and type in a key value, only this time type in "Forge". Press Return or click on OK, and Superbase looks up the first record with Forge in the Lastname field. Entering Partial Values You don't even need to type the full index key in many cases. Try Key Lookup once more, but type in "Hut" and press Return. Superbase finds the first record for Huttermann. For your information, Superbase tells you that it didn't find the exact match. 1-19 Getting to Know Superbase The Filter Button I -I Filter This is a very powerful feature. You may have thousands of records in a database file, yet you may often want to review them (or print them out) on a selective basis. The Filter allows you to enter a set of values, as simple or as comprehensive as you like, to restrict the display to only the records that match those values. The Filter Dialog Move the pointer and click on the Filter button on the Control Panel. Filter File: ADDRESS This dialog looks more complex than the ones you have seen so far, but after a little practice with the demonstration file you'll find that you can remember how to use it easily. It's important that you learn how to use the Filter, because Superbase uses filters in several other functions. The dialog has four main parts: the Field Name Panel, the Operators, the Value Box, and the Main Box. A Filter is created by a combination ofclicking on field names and operators, and typing in values. These actions produce the Filter Command Line in the Main Box. Let's look at each component of the Filter dialog in tum. 1-20 Getting to Know Superbase Field Name Panel This appears on the leftahand side of the dialog. You can scroll the list of field names up and down in the usual way, using the scroll bar and arrows at the right of the Field Name Panel. You specify that a field is to be used in the Filter by clicking on its name in this panel. The list of field names is complete. It's not affected by whether you have an Open Fields list, so the fields that specify the Filter need not be the same as the ones that are shown in the Main Display. Operators These appear to the right of the Field Name Panel, and can be divided into Relational Operators, Logical Operators and Mathematical Operators. We'll see how these are used below. Value Box This is the box with the word 'Value' next to it. You use it for typing in values such as names, numbers, and dates, which will form part of the Filter. When you are matching numeric data that has to be held in a text field because it may include nonanumeric characters (such as telephone numbers), you must put the value in quotes. Always remember to press Return after typing in the Value Box. You must do this to ensure that the contents are copied to the Main Box. Main Box This is the long box that appears below the Field Name Panel and extends across the whole dialog. When you make selections with the mouse or type values into the Value Box, Superbase copies them into the Main Box, building up the Filter Command line. In this way you get immediate feedback about the results of your selections. The maximum length of the Filter Command line is much greater than the apparent length of the box up to 255 characters are allowed. You can type directly into the Main Box, but in these exercises we'll stick to making selections with the mouse. Using the Operators The Operators are the most complex aspect of the dialog. They are used to relate field names to other fields or values. For example, if we wanted to set up a Filter to show only the addresses in West Germany, we would need the expression: Country UKE "West Germany". Here, Country is a field name Getting to Know Superbase 1-21 obtained by clicking in the Field Name Panel; LIKE is selected by clicking on the LIKE Operator button; and "West Germany" is typed into the Value Box (note that it is not necessary to enter quotation marks if you use the Value Box). Text String and Pattern Matching: LIKE When you're searching for names or text strings, you should avoid using the equals sign operator, and use LIKE instead. This is because only LIKE accepts matches on either upper or lower case characters; it's said to be 'case insensitive'. The equals sign operator, on the other hand, requires exact matches for what you type in: it is 'case sensitive', LIKE also permits searches for text strings using pattern matching characters, These allow you to enter incomplete words for the Filter. For example, to find all the records where the Lastname begins with "C", you need the Filter Command Line: Lastname LIKE "C*" To specify a range, add square brackets to the value: Lastname LIKE "[A-O)*" '-.. / This finds all records where the Lastname begins with "A", "B", "C", or "0", Note that the asterisk is placed outside the brackets. There are several other things you can do with the LIKE operator. You'll find a complete list and a number of examples in Appendix B. The Relational Operators = This specifies that the field is to be EXACTLY EQUAL TO the following value or field: Balance = 2000 < > The field is to be NOT EQUALTO the following value or field: Country < > "France" > The field is to be GREATER THAN the following value or field: Balance > 1000 < The field is to be LESS THAN the following value or field: Balance < 1000 > = The field is to be GREATER THAN OR EQUAL TO the following value or field: Balance > = 1000 <= The field is to be LESS THAN OR EQUAL TO the following value or field: Balance < = 1000 Getting to Know Superbase 1-22 The Logical Operators AND, OR and NOT These provide links between different expressions like the ones given above. You use them to specify alternatives and ranges for the Filter, either for a single field or for a number of interrelated fields: AND Both of the conditions linked by AND must be satisfied for the record to be accepted by the Filter: Country LIKE "West Germany" AND Balance > = 5000 OR Either of the conditions linked by OR is sufficient to make the record acceptable to the Filter: Country LIKE "West Germany" OR City LIKE "Geneva" NOT NOT is slightly different. It negates the effect of an expression: NOT (Country LIKE "West Germany" AND Balance> 5000); this will find all the records other than the ones where the country is West Germany and the balance is greater than 5000. Note the use made of parentheses with NOT. Parentheses The '(' and C)' operators are used in the normal way, to give priority to one part of the expression over another. ( The following expression has a higher priority for evaluation than the preceding expression. ) Required to end a higher priority expression. The numbers of opening and closing parentheses must be equal. The Mathematical Operators + This is used to express addition: Balance > Amount + 1000 The minus sign expresses subtraction: Balance > Amount - 1000 * The asterisk is used for multiplication: Balance> Amount * 1.15 / The slash represents division: Balance < Limit /10 Getting to Know Superbase 1-23 Typing in the Main Box The great power and flexibility of the Filter system is only achieved by giving the user control of every aspect of the operation. Because you can type into the Main Box you can include all kinds of expressions which are not available from the buttons on the dialog itself, and all kinds of text and numeric values. The price you pay for this flexibility is an increased risk of making mistakes. This is not too serious, as you cannot harm your data by using a Filter (although you can discard records using the Remove Records Filter). However, you may see a Superbase "Can't do this" message concerning an error in the Filter Command Line in two possible situations: • When you click on OK after creating or editing a Filter Command Line. • When you use a Filter after changing the definition of a field with Project Edit. If you see a "Can't do this" message you must either change the Filter Command Line or change the file definition. Here's a summary of the editing facilities available when typing inside the Main Box: Filter Command Line Editing You can remove everything from the Main Box by clicking on the Clear button or, if you've already clicked in the box, by pressing the Escape key (Gem only) or CI'RL X (Amiga-X). • '~ • • • Provided you have not left the box the cursor is still visible - Alt-U will undo the effect of any changes you may have made (Amiga-Q). If Superbase won't let you make an Operator selection when you re turn to modify an existing Filter Command Line, click in the Main Box and press Return. Now you can go ahead. The Home and End keys move the cursor to the beginning and end of the Filter Command Line respectively (Shift right cursor and Shift left cursor). On Gem versions of Superbase, Tab and Shift Tab tab the cursor right and left respectively. The Del or Delete key removes the character to the right of the cur sor. By holding this key down you can cause text to the right of the cursor to be deleted. The Del key (with the backward facing arrow) or the Backspace key removes the character to the left of the cursor. Backspace repeats its action if held down. • • '~ 1-24 Getting to Know Superbase Using a Filter The Filter Command Line is made active by clicking on OK. Whenever a Filter is in use, Superbase highlights the Filter button on the Control Panel. You can perform all but one ofthe Control Panel record selection operations we've discussed, and Superbase will restrict the records displayed to the ones that match the Filter values. For example, if you have specified Country LIKE "West Germany" and you click on the First Record button, Superbase will go and find the first record in the file, according to the current index, which has the value "West Germany" in the Country field. The Key Lookup button is an exception to the Filter effect. You can still recall individual records by entering an index key value, whether or not they match the Filter. Suspending a Filter There will be times when you want to remove the Filter effect so that you can review all the records in the file again. To do this, just click on the highlighted Filter button. It reverts to normal, and you'll find that when you use the Control Panel Superbase acts as if there were no Filter. Modifying or Re-activating a Filter If you've set up a Filter and then suspended it, you can bring it back into operation by clicking once more on the Filter button. Superbase displays the Filter dialog, with the Filter Command Line in the Main Box just as you left it. If you want to, you can add to the Filter Command Line by clicking on more field names and operators (you may need to click in the Main Box and press Return first), or edit it after clicking in the Main Box, as described above. Whether you've made any changes or not, just click on OK to use the Filter again. Getting to Know Superbase 1-25 Fifteen Minute Tutorial Make sure you've got the Address file open, indexed on Lastname. Set Table View with Paging off. Go into Project Open Fields and open these fields: Forename Lastname Street City Country In Table View, drag the Lastname column a few columns to the left, and then do the same for City, overlapping the Street column if necessary, until the Country column comes into view. Click on the Filter button. We are going to search for those name and address records where the person lives in the USA or West Germany. So we'll use the Country field, the UKE operator, and the Value Box. You'll see the results of your selections appear as a Filter Command Line in the Main Box. Move the pointer into the Field Names Panel, and click once on the down arrow to bring Country into view. Then click on Country. The name appears in the Main Box. Next, move the pointer to the right and click on the UKE button. This also appears in the Main Box. Now you must type in "USA". This goes in the Value Box. Move the pointer into the Value Box and click on the mouse to produce the cursor. Type in "USA" (no quotation marks). Press Return - this is essential, or the contents of the Value Box will not be copied into the Main Box. Your Filter Command Line should read: Country LIKE "USA" Next, you need the OR operator. Click on it and Superbase copies it into the Main Box. Now you must click on the Country field name again. This is important. A Filter Command Line like this is not allowed: Country LIKE "USA" OR 'West Germany" So, click on Country, as before, followed by UKE. Then, as before, click in the Value Box, and type in "West Germany". Press Return. Your Filter Command Line should look like the one shown in the diagram opposite. Getting to Know Superbase 1-26 Filter File: ADDRESS G [3J ~ IT] Value KE "USA" OR COUNTRY LIKE ''WEST GERMANY" OK • I I Clear I ICancel I If there are any mistakes click on Clear and repeat the steps above until you get it right. You have built your Filter Command tine, so now you can put it into action. Click on the OK button. Superbase activates your Filter and displays the first record in the file that matches the Filter. Click on Fast Forward. Superbase shows all the records that match the Filter. Now de-activate the Filter. Click on the Filter button so tihat it's not highlighted. Now click on Rewind. You'll see all the records in th~ file appear as normal. I Let's go back and add another condition. Click on the Filter but on to recall the dialog. Click on the OR operator, then on Country, then on UKE, then in the Value Box. Type in "France", and press Return. Your line hould read: Country LIKE "USA" OR Country LIKE "West Germ ny" OR Country LIKE "France" Now click on OK, and when Superbase shows the first record, lick on Fast Forward. You'll see that Superbase has added the addresses in Prance to the display. You may pause the display by either clicking on the pause button, or by using the space bar. Either action will highlight the pau~e button on the control panel. When you are ready to continue, either click ~n the pause button or press the space bar. This action will de-highlight the p~use button. That concludes our short tutorial. 1-27 Getting to Know Superbase Other Filter Based Options You should have acquired a feel for the way the Filter dialog works, and you can experiment freely with the Address file to deepen your knowledge. When you're ready, you can start using the Process options, all of which are selected from the Process menu. Remove Allows you to delete groups of records from the file. You can use the Control Panel Filter to view them first - the Filter Command tine is preserved for you to use in the other Filter functions. Import When you need to read in records from other systems, the Import Filter provides a means of rejecting records that don't match the conditions you set up. Export The opposite ofImport, Export lets you create a disk file containing selected fields and records. Mail Merge Allows you to create a large number of personalized letters by merging the names and addresses from a database file with a single 'form' letter. Print A quick and easy way of obtaining a printout of selected records. Labels Up to four columns of labels from the records that match the Filter. The Update and Query options use slightly modified Filter dialogs, but the principle is the same. More details of all these options can be found in the U sing the Process Menu, Chapter 5. Getting to Know Superbase 1-28 The External File Button External File The right-hand button on the Control Panel is a representation of a camera. It activates another of Superbase's unique features the ability to access and display external files graphic images produced by painting and drawing programs, and text files produced by the Superbase Text Editor or a word processor. Amiga owners also have the ability to play back external sound files. You can combine the External File System with the Query and Filter functions of the database to produce a unique 'picture library' application, indexing and cross-referencing large numbers of independent Pictures files by putting keyword data into ordinary fields and using them as the basis for searching. We suggest you experiment with the Filter function and read through Chapter 9, External File Management System, before setting up your own External File Database. CHAPTER 2 USING THE PROJECT MENU The Project Menu contains the options for setting up, opening, editing, and removing database files and indexes. In this section we cover in detail all the aspects of the options. Chapter 3 provides a tutorial, which takes you through the process ofsetting up a file, but we advise you to read through the detailed discussions before attempting it. New File: Overview A Superbase database file has three components: a data file, an index file, and a definition file, usually referred to as the file definition. (There can be up to 999 index files for each data file, but the minimum is one.) The data file holds the actual record data that you key in through the Record menu options. It has a name, and an 'sbf extension, like this: address.sbf The index file holds single entries that match the contents of one of the fields in the data file. The index allows fast look-up of individual records (like a book index), and also provides an alphabetical order for the presentation of the records. Index files have a numeric extension to the main file name, like this: 'addressJ'. This would indicate that the index was constructed on the first field in the file definition (more explanation later). The file definition contains all the information Superbase needs to display and update the records for the file correctly. Its extension is 'sbd', and its full name could be like this: 'address.sbd'. The fields that comprise the file definition may be of four main types: text, numeric, date and time. There is also an external file field type, which contains the names of text or graphics files, and is used by Superbase's External File System in two ways: to provide indexed 'picture library' facilities and to provide memo fields for storing large amounts of text information. Using the Pro/ect Menu 2-2 Once a field has been defined as belonging to one of these main types, there are number of attributes that can be attached to it: Formula A field may be assigned a formula (or two formulas in combination) which calculates or checks the field's data. There are three types of formula: validation, calculation, and constant. Multiple Response Multiple response fields are text fields which store more than one item. In programming terms, this means text fields can be defined as arrays. Required A required field is one for which data is compulsory. Read only The data in a read only field cannot be edited. Index An index can be constructed on any type of field. Here's a preview of the steps required to set up a new file: 1. Select Project New File then type in a new file name, adding passwords if desired. 2. Define the characteristics of each field and add it to the File Definition. 3. Specify which fields are to be indexed. 4. Save the File Definition. S. Start entering record data. 2-3 Using the Project Menu Setting Up a New File From the Project menu select New File. Entering the New File Name Superbase presents you with a dialog for the name of the file you are about to define. Hew file ~ll Click in the box, then type the name of the new file. Don't type ".sbf' or any other extension. It must not contain any spaces. Any characters may be used except the following: • I \ -- I .. Once you click on OK Superbase will display the Password dialog. If you do not wish to set any passwords against this file, click on Cancel. Superbase will then display the File DefInition Dialog which is explained in the next section. Passwords You can enter up to three passwords, separated by semicolons, and with no spaces in between. Each one permits a different level of access privileges for the file. Suppose you enter three passwords in the following sequence: John;Paul;George When you open your fIle and type in the password John, you will have full privileges for the file. If you enter Paul, you get read and write privileges, but you may not delete the file. If you enter George you have read privilege only: no data entry or editing, and you may not delete the fIle. If you enter two passwords to begin with, the read only level of privilege will not be available; one password, and both read only and read/write levels will be unavailable, so the single password will allow all actions. Using the Project Menu 2-4 When a password exists, Superbase will ask for it when you open the file. Therefore you will have to enter it each time you wish to open the file. As a precaution against the password being seen by someone else, Superbase does not display the password on screen when you type it in. Caution: You cannot change or remove a password once it has been set, so don't lose it. The File Definition Dialog This is the screen on which you specify the details of each field in the file. The dialog has several parts. File definition Field naMe Attributes REQ IX!} NUMber TXT Title TXT TXT ForenaMe Lastnane TXT IXD Street TXT TXT IXD Cit~ TXT Code ® Text o External o NUMeric o Required o Date / TiMe o Read onl~ Field []EJ IDelete I Forillat 10 10 15 15 39 15 12 m I i\"Jl.Ii o Validated ID o Calculation o Constant At the top there's the File Definition Panel. This has three parts or zones, indicated by the headings Field name, Attributes and Format. When you're looking at an existing file definition, the list of fields for the new file appears in the left~hand zone, the abbreviated forms of the field types and attributes (TXT - text; NUM - numeric; CLC - calculated; and so on) in the centre zone, and the field formats (length, date style, or number style) in the right hand zone. For a new file the File Definition Panel will be empty. Below the panel are the field type selection buttons. You use these to change or set the attributes of the selected field. The selected field is the one whose name appears in the Field box below the Numeric Field Type button - when you've just called up this dialog this box is empty. Using the Project Menu 2-5 Bottom left are the Add and Delete buttons. When you've defined the details of a new field, you click on Add, and Superbase adds the field name together with its attributes and format to the upper panel. Delete is generally used when editing an existing file definition. Bottom right are the usual OK, Clear and Cancel buttons. Cancel exits from the dialog to the main display. Clear empties the Field box and resets the field type selection buttons. OK takes you on to the next step, which for a new file is specifying the index fields. So, to summarize the procedure for defining new fields: 1. Type in a field name. 2. Select the appropriate field type button. 3. Enter details about the field - its length or numeric format, for example. 4. Use the Add button to add the field to the file definition. Creating a New Field Click in the Field box below the Daterrime Field Type button. Type in the field name. You may use up to 15 characters, including spaces. Use only alphanumeric characters, the space, and the underline character. The field name may not begin with a number or contain more than one consecutive space. You can use any words except those reserved for the Superbase programming language. A list of these is given in Appendix D. Selecting the Field Type Click on the button next to the type of field you want. Choose from Text, Numeric, Daterrime, or ExternaL You can add attributes such as Validation or Read Only later. Your choice will display another dialog for entry of details about the field. (Each of the field types has its own dialog. These are described in the sections following this one). When you have specified the details, you click on OK in the field type dialog to return to the File Definition dialog. Using the Project Menu 2-6 Adding a new field: The Add Button After setting the details for a field type, you still have to go through the step of adding it to the list of fields in the upper File Definition Panel. You need to click on the Add button in the bottom left-hand corner of the dialog. When you do this, Superbase does the following: 1. Copies the name from the Field box into the File Definition Panel, adding it to the existing list of names if there is one. 2. Shows abbreviations to indicate the field type selections and the field attributes (both are shown under the heading Attributes). These appear across four columns, like this: TXT VAL REQ IXD The abbreviations for the field types and field attributes are as follows: First column TXT NUM DAT TIM EXT DEL Text Numeric Date Time External Deleted Second column CLC CLV CON COV VAL Calculated Calculated and Validated Constant Constant and Validated Validated Third column RDO REQ RDQ Read Only Required Required and Read Only Fourth column IXD IXU Duplicates Index Unique Index ~' Using the Project Menu .~~ 2-7 3. Shows the format of the field. For a text field this is the length of the field in characters. It may also include the two optional text parameters: case parameters (Upper Case, Lower Case, Capitalize) represented as U, Land C; the number of multiple responses selected (if more than one) represented as M followed by the number. For a numeric field the format is specified by the digit pattern plus certain characters to show which style features have been included. For a date field it is a representation of the day, month and year style you selected, and for a time field it is a representation of the selected time style. Validation and Calculation formulas are not shown. You may view or print them with the System Status File option. 4. Finally, Superbase clears the Field Box and the type selection buttons. You can either define another field or exit from the definition dialog. Deleting a Field: The Delete Button This is really an editing feature, and we cover it f\illy in a later section. Clicking on Delete marks the selected field, causing the DEL abbreviation to appear in the Attributes column against the field name. The field will not be removed from the disk until you Reorganize the file. Concluding File Definition: OK, Clear and Cancel Clear Removes all settings for the selected field. Cancel Exits back to the main display without creating a new file definition. OK Holds the details of all the fields you have placed in the File Definition Panel, and displays the New Index dialog (see page 2-36). Using the Project Menu 2-8 Text Field Use this type for any field that is not designed to hold a date, a time, a number or the name of an external file. Text forMat ~COCJ~ a Upper case a Lm'ler case a Capitalize [] Responses OK C-a-nc-el..... I I'... The panel at the top of the dialog allows you to set the length of the text field, up to a maximum of 255 characters. There are two ways of doing this. You can enter the number of characters you want the field to have from the keyboard; or you can set the length using the up and down arrows at either end of the length counter. The up arrow increases the value in the length counter, the down arrow decreases it. The value in the counter changes each time you click on one of the arrows; In some versions of Superbase, you can also press and hold down the mouse button. This will then scroll through the numbers within the counter you've selected. Below the field counter are three buttons which determine how text is stored in the field: with capital letters, lower case letters, or with the first letter capitalized. Click on the Upper case button if you want all the letters in a text entry to be capital letters; Lower case puts letters in lower case; Capitalize makes the first letter a capital letter. When you enter text in a field, these options convert it to their respective formats. If you ignore these options, the text will be stored and displayed in the same case that it is entered in. But there is a good reason for selecting one of them: it means that you do not have to worry about whether you enter text in lower or upper case; text is automatically converted to the selected format. Using the Project Menu 2-9 The box labelled Responses is used to define a text field as a multiple response field. This attribute, which is unique to text fields, is explained in the next two sections. Normally the box contains the number "I" which indicates that the text field has has only one response. If you do not want the text field to be multiple response, you can leave this box as it is. When you have set the text format as you want it, click on OK to accept the entry. Multiple Response Field Defining a text field as a multiple response field enables you to store a number of related data items under one field name. When you display a record with a multiple response field, only one of the field's items is shown on screen; but you can display each item in turn using the key combination CfRLN. To move back to a previous item, use CTRLP. For example, if the second is currently displayed, CfRL N displays the third item; CfRL P will then return you to the second item. In some circumstances, you may want to refer to particular items by name; when setting up a filter, for example, or in a calculation formula linking one field to another. You can do this by enclosing the item number in parentheses and placing it after the field name. Thus to refer to the second item in a multiple field, you would enter: Fieldname(2) One way of talking about fields is to say that each field holds the answer to a specific question about the data in a record - such as, what is this client's telephone number? Or, how much does this product cost? As the name suggests, multiple response fields are used when there may be more than one answer to the question. Suppose you wanted to index the books in a library. For each book you would create a separate record. Along with the title and other details, the record would contain a field showing the author of the book. Some books, though, have more than one author, so you could make this field a multiple response field. More generally, multiple response fields are suitable for storing any data that comes in a number of parts. For example, you could store addresses in this way. Most databases only allow single response fields, and the usual method of storing an address is to define a separate field for each line of the address. Depending on the application, you may find it more convenient to assign the whole address to one multiple response field. Using the ProJect Menu 2-10 Defining a Multiple Response Field Multiple response fields may have up to nine elements; that is, you can use a multiple response field to store up to nine separate lines of text. To define a text field as a multiple response field, first decide how many elements you need. Then enter the number in the box labelled Responses in the text field dialog. Initially, the number will be set to one. Delete this using the backspace key and type in the new number. Numeric Field This field type is suitable for ordinary decimal numbers, currency amounts, integers, and exponential formats. There is a maximum of 13 digits, which you may arrange in any format around the decimal point. There are many numeric styles and features to choose from. The numeric field dialog has an upper panel that reflects the current number format. As you make selections from the buttons below, or click on the up or down arrows to left and right of the upper panel, the number format changes. You do not edit the number format directly. §$3-99999.90 ~ When it first appears, the number format is set to -99999.00. This allows up to five digits to the left of the decimal point, and two decimal places. There is also a space for a minus sign for negative numbers. Changing the Numeric Format Length Click on the arrows at either side of the number format panel. The left-hand arrows increase and decrease the digits to the left of the decimal point, the right-hand arrows increase and decrease the decimal places. Remember you may have a maximum of 13 digits in the format as a whole. Using the ProJect Menu 2-11 Selecting Numeric Format Type You can choose from four possible types of basic numeric format; the selection is always reflected in the number format panel: 9.0 This format is preselected when the dialog appears. The format shows actual numbers left of the decimal point, and trailing zeros to fill up the decimal places. For a format of 999.000: 26.200 334.456 9.9 This format shows numbers only, with leading or trailing spaces: 26.2 334.456 *.0 Inserts leading asterisks as cheque protection characters; adds trailing zeros to the right. For a format of * ** u .00: ***26.20 **334.46 0.0 Inserts both leading and trailing zeros. For a format of 0000.000: 0026.200 0334.456 Selecting Numeric Format Features You may choose from four number sign styles: This button is preselected. It causes Superbase to print a minus sign if the number is negative, a space if the number is positive. Shown as - in the number format panel. +/. Prints a minus sign if the number is negative, a plus sign if the number is positive. Shown as + in the number format panel. (.) Prints parentheses instead of the minus sign. Can be selected in conjunction with one of the above. Shown as '(' in the number format panel. None No selection means that Superbase does not leave a space for the sign as part of the format, but inserts a minus sign when the Using the Project Menu 2-12 number is actually negative. May result in non-aligned columns. There are two possible currency sign styles: $9 Places the currency sign immediately to the left of the first digit in the format: $26.20 $334.46 Shown as $9 in the number format panel. $9 The currency sign is outriding - it appears to the left of the format, always in the same place. For a format of $ 9999.00: $ 26.20 $ 334.46 Plus and minus signs also outride when this style is selected. You may choose your preferred currency sign from the Decimal Format option in the Set Options menu. This also allows you to set a trailing currency symbol for the currency sign style, as in: 26.20$ This is a global setting and may not be varied from field to field. There are three other features affecting numeric formats: (0) Blank when zero. This makes Superbase print blank spaces instead of zeros when the number to be printed equals zero. Shown as z in the number format panel. (,) Thousands separator. Numbers greater than 999 are printed \vith a separator, e.g. 1,100. Normally the separator is a comma and the decimal point is a period or full stop, but alternatives may be selected from the Set Options dialog. Shown as a comma in the number format panel. E Exponential format. All numbers whose format includes an e will be expressed with an exponential signifier at the end. This allows you to enter numbers much larger than the normal 13 digit precision permits. Shown as 'e' at the right of the number format. 2-13 using the Project Menu Overflow If the number entered into a numeric field is too big for the format, Superbase displays number signs to indicate an overflow condition: ########.## You can easily edit the numeric format to make it longer, or, if you prefer, include an exponential signifier in the format. Date Fields Date fields can accept any date (years 0001 to 9999). There are many possible styles of date expression. Date I TiMe ForMat IIbN [lli!] ~ Dav Month Year a Month Day Ym a Year Month Dav ~ ~ lID [I]O.[JO I OK II Cancel I IT!TI • It1MMM I [!!J When the date field dialog appears, the date is in the default date style. This is initially European (day, month, year), but you can reset it by altering the style with the Set Date menu option. Changing the System Date The box in the middle of the dialog shows the current Superbase system date. To change the date, click on the left arrow to increase it, or the right arrow to decrease it. Superbase remembers the new date whether you set it from here or the Set Date option. ' CAUTION. Other programs will also use this date as their system date during the current session. You can also edit the date directly by clicking in the hox. .~ The system date always reflects the current date style as determined by your selections. Using the Project Menu 2-14 Day Month Year Order Click on one of the buttons in the upper part of the dialog to set the order in which the day, month and year are presented. Month Style You can choose one of three possible month styles: MM Number from 1 to 12. MMM Three letter abbreviation: Jan. MMMM Full name of month: January. Year Style You can choose one of two possible year styles: yy Last two digits of the year: 88. This always implies the current century. yyyy The full year: 1988. Separators There are five kinds of separator to choose from. / 1/10/88 1-10-88 space 11088 1.10.88 First separator is space, second is a comma followed bya space: 1 October, 1988 or Oct 1, 1988. Dates As Numbers Although dates are expressed as text, they are stored internally as numbers. This means you can include them in arithmetical expressions, allowing the construction of date formulas and validation checks. You can also construct an index on a date field knowing that it will be kept in true date order. 2-15 Using the Project Menu Time Fields Date I TiM~ forMat ! Dm IIl';D a Seconds a MillisecDnds ® AMlPI4 clock ~ 9:28 aM [}!il IIIIIII !tn,l.itt! mo. I OK ~ lID GJ II Cancel I ~ Time fields offer a variety offormats for storing the time ofday, or for storing any elapsed time period up to 24 hours. You can choose between a 12 or 24 hour format and there are three ways of specifying the time units: hours and minutes hours, minutes and seconds hours, minutes, seconds and thousandths of a second You set the time format by clicking on the TIME panel at the top of the TimelDate dialog. The selection buttons will then present the various time format options: seconds, milliseconds, and am/pm. The default format shows the time in hours and minutes on a 24 hour clock. Click on the selection buttons to set this to another format. Uke dates, time fields are expressed as text, but are stored internally as numbers. Changing the System Time The box in the middle of the dialog shows the system time in the currently selected time format. As with the system date, you can change the system time by clicking on the arrows at the side of the box, or by editing the box directly. 2-16 Using the Project Menu External File Fields The dialog for the external file field type is exactly the same as the text field dialog, and operates in the same way. The difference between the field types is that an external file field is intended to contain a file name, while a text field can contain anything. The file names in external file fields are used in Superbase's External File System, which allows you to find and display graphic images or text files. It provides both a kind of built-in 'picture library' facility, and a 'memo fields' facility. For more details see Chapter 9, External File Management System. Field Attributes Every field in a Superbase file must be one of the five types we have looked at so far: text, numeric, date, time or external. When you look at the File Definition dialog, you will see that there are five more field selection options: Required, Read only, Validation, Calculation, and Constant. Required You may designate any field as a Required field. This means that during data entry you must enter a value - you cannot leave a required field blank. Read Only The Read Only attribute is used to protect the data in the field from being deleted or overwritten. Data cannot be entered in a Read Only field. Although any field may be designated as Read Only, normally you would only use this attribute for fields which have Constant or Calculation formulas attached to them. If you designate any other kind of field as Read Only. it will not be possible to enter data in the field, and, as a result, it will remain blank. However you may want to protect data after it has been entered in a field. In this case, you would change the field's attribute to Read Only by editing the file definition. Using the Project Menu 2-17 Validation ~/ The validation option allows you to attach a formula to a field, which sets the limits to what you can enter into the field. For example, a formula such as: lastname LIKE "Tom" OR lastname LIKE "Jerry" would restrict the lastname field to the values 'Tom" or "Jerry". Alternatively, you might want to set a numeric range: amount> = 100 AND amount < = 200 This requires the entry to be between 100 and 200 inclusive. Dates may also be validated: date > "1/6/86" The date entered must be after 1st June, 1986. Note that the interpretation of the Day/MonthlYear order of the date will depend on the system date format, not the format for the field. Constructing a Validation Formula Before you can attach a validation formula to a field, you must first Add the field (using the Add button). The reason for this is that a validation formula contains the name of the field it validates. If the field has not yet been defined, Superbase will not recognise the field name when you include it in a formula. The correct procedure, therefore, is to Add the field first and then create the formula. In effect, this means you have to define the field first, and then edit its definition. For example, if you wanted to create a date field with a formula attached to it, you would need to carry out these steps first: 1. Define the field as a date field and set the date format. 2. Click on Add - the field name will then be added to the File Definition Panel above the Field box. 3. Click on the field in the File Definition panel to select it for editing. Once you have completed this preliminary task, you can proceed to the next stage where you construct the formula and enter it in the Formula dialog. First, click on the Validation button. This action will present you with the Formula dialog (see next page). Using the Project Menu 2-18 Validation forlllula for Interest Rate File: DEPOSITS firstnallle ~ IAriD lastna\'lle m EJ m0 II m Bank Account llIount Date Interest Rate Interest Rate [][J }= B AND Interest Rate OK 0 INOT I El OJ lUKE I [Z] [B [8 m Value I G <= 15 I I Clear I ICancel I As you can see, the dialog is basically the same as the Filter dialog described in detail in Chapter 1. It has three main parts: 1. A Field Name Panel. 2. A calculator style set of Operators, including a Value Box for typing in actual values such as 'Joe" or 100. 3. A Main Box, which shows the formula changing as you make your selections. The Formula dialog works in the same way as the Filter dialog. You click on an operator or a field name to place it in the Main Box; and you can add other elements in the formula numbers, text, dates, etc. by typing them into the Value box and pressing Return. Alternatively, you can type the formula directly into the Main Box. When you've finished the formula, click on OK If you want to clear the formula from the dialog and start again, click on Clear. .----.-" Using the ProJect Menu 2-19 Validation Help Messages A validation formula sets limits to the data that can be entered in a field. If you attempt to enter invalid data, Superbase will reject your data entry. At the same time, it displays a validation error message: Can't do this ••• Lastnal1le Field does not l1latch validation 01( II Cancel I For this message, we'll assume that the Lastname field in the Deposits file, has been assigned the following validation formula: LOOKUP(Lastname.Deposits,Lastname.Clients) This is an example of a cross-file validation formula. When you enter a name in Lastname, it checks whether the name exists in the Clients file. The Validation Help feature allows you to make the message even more explicit. Instead of displaying the field name in the second line of the message, you can include a specific error message which tells the user exactly why the data is invalid. Validation Help messages are defined as part of/the formula. The procedure is as follows: 1. Construct the validation formula, as explained earlier. 2. Click in the Main Box and type ELSE at the end of the formula. i 3. Then type the help message, enclosing it in quotation marks. 4. Click on OK. If you wanted to modify the formula for the Lastname field in the example above, you would enter: LOOKUP(Lastname.Deposlts,Lastname.Clients) ELSE "Last name not found in Clients file" Using the Project Menu 2-20 Now, the validation error message will look like this: Can't do this ..• Lastna(l'le not found in Clients file Field does not ~atch validation OK II Cancel I Checklist Here are some useful facts about the Validation Formula dialog: • The maximum length of a validation formula is 255 characters. • You can place field names on either side of an operator: field 1 > field 2 • Superbase stops you making simple mistakes. It does this by produc ing an audible 'beep'. (On the Amiga, it flashes the screen). • You can use parentheses to set priority levels for your formula: amount = 10 OR (amount> 20 AND amount < 30) • To allow the user to create a blank Numeric or Date field, you must include a "zero option" in the formula: amount> 10 OR amount 0 The same applies to Text fields, except you type tIll into the Value Box instead of O. • The UKE operator is intended for text string matching, as it is case insensitive, unlike the EQUALS operator. country LIKE "England" • UKE may also be followed by a value that uses one or more of the pattern matching rules and characters. Here is a typical example: Lastname LIKE "[A-F]*" This formula accepts an entry of any length, provided it begins with a letter from "A" to "F' (either case). More details of pattern matching with LIKE are in Appendix B. = Using the Project Menu 2-21 • If you click in the Main Box, you can edit the formula directly. This is essential for making changes to an existing formula. but Superbase cannot check this kind of editing, so you could end up with an invalid formula. or one that did not do what you intended. Errors in the for mula could allow invalid data into the field, or produce error mess ages during data entry. The other use for direct editing of the formula is to add functions which are not available from the selections in the dialog. See Using Formulas for Multi-file Applications further on in this chapter. Using the Project Menu 2-22 Calculation Formula A calculation formula works out and stores a result that depends on other fields and values. Unlike a validation formula, which checks data entered by the user, a calculation formula generates the data itself. This means that you cannot edit a calculated field directly. To be more precise, if the field is not Read Only, you can attempt to edit its contents, but the formula will then overwrite your entry with the calculated result._~ Calculation formulas can be attached to any type of field. They can also be linked to validation formula, so that the result is first calculated and then checked to see if it falls within certain limits. Here are some examples of typical calculation formulas. quantity * price sUbtotal_1 + sUbtotal_2 + subtotal_3 amount * (1 + increase /100) Formulas are usually arithmetical and attached to numeric fields, and as such rarely make use of relational operators like 'greater than' or 'less than'. There are restrictions on the combinations of types of field in a formula expression. Superbase will let you know if you break a rule, by trying to multiply two text fields, for example. Remember, though, that you can treat date and time fields as numbers. You can create formulas for text fields by typing directly in the Formula box: left$ ( name,S) + " /" + str$ ( serial number) Here the formula makes use of the Superbase functions, IcCt$ and strS (see Formulas and Functions). It could produce a result like 'Johns/00042", which could in turn be the b~sis of an index. Date and time formulas are also valid. Typically, they would be used with the reserved words TODAY and NOW, to show the date and time when a record was created or last edited. All the examples given here relate to single file applications.Vsing Formulas for Multi-file Applications on page 2-32 explains how formulas can also be used to extract data from other files for insertion in the current file. 2-23 Using the Project Menu Constructing a Calculation Formula You do this in the same way as you create a validation formula, with one important difference: you do not need to include the name of the field you are working with in the formula itself. If you wanted to create a formula which added two fields together and placed the result in a field called total, you would enter: amount1 + amount2 Unless you are using the ternary operator (explained in a later section in this chapter), a calculation formula should not contain the equal sign; so it would be a mistake to enter: total = amount1 + amount2 When you create a formula, the field you are attaching it to is shown at the top of the calculation dialogs, and the result of the formula is automatically assigned to that field. This is why it is not necessary to include the field name in the formula itself. It is possible, however, to construct a formula which includes the name of the field it is attached to. We refer to this as a self-referencing formula. For reasons which are explained further on in this chapter, you should exercise caution before creating formulas of this type. Using Dates and Times in Formulas ..-/ Superbase stores dates by representing them as julian date numbers; a date's julian date number is the number of days between the date and the year AD O. For example, the date 26 July 1986 has the julian date number 725202; and the same date a year later has the value 725202 + 365. This method of storing dates makes it easy to incorporate date fields in formulas with numeric values. For example, to generate the number of days between two dates, or to set a date in the future: date1 • date2 date + 90 Time fields can also be treated as numeric fields. Superbase stores times as thousandths of a second within a 24 hour period. Using the Project Menu 2-24 Using the System Variables 'System variables' is the term we use to describe the reserved words, TODAY and NOW. Your computer system keeps track ofthe date and time; these words provide a means of displaying the date and time, and inserting them in a field. If your system has a battery-backed real-time clock, TODAY and NOW will show the current date and time; that is, the correct date and the correct time. Otherwise you can set the date and time using the Date format option on the Set menu, at the start of any session with Superbase. For the rest of the session, the system will then update these variables constantly, so that they show the current date and time. By using TODAY and NOW in calculation formulas, you can ensure that the current date and time are inserted in a record whenever it is edited or updated. Most people do not need to know the exact time when a record was updated, so NOW is less likely to be used in a formula. But it is often useful to 'date stamp' a record using the TODAY variable. To do this, first define a date field, then create a formula consisting simply of the word TODAY. Calculation formulas are not suitable if you want to show when a record was first created. For this, you need a constant formula (see the section Constants). Note that NOW and TODAY can also figure in validation formulas. For example, you could use TODAY to invalidate cheques that are out of date: Cheqdate > (TODAY· 365) When is a Calculation Performed? A record may contain just one or a numher of calculated fields. When you save a record, Superbase carries out all the calculations in the record and stores the results in the fields which the calculation formulas refer to. This applies both to new records and to edited records. Most, if not all, calculated fields will be Read Only. With these fields, calculations may also be performed while you are entering data in the record or editing it. This happens if you click on the field or if you pass through the field on the way to another field further down the field list. The upshot will be that the calculation is performed at least twice: every time you click on it and then again when you save the record. You can see this process in action by defining a time field with the calculation formula NOW attached to it. Provided you have set the time format so that Using the Project Menu 2-25 seconds and milliseconds are shown, the time field will be updated every time you click on it. Usually, repeating a calculation gives the same result, and it doesn't matter how many times the calculation is carried out. Likewise, it doesn't usually matter in what order you enter data in fields, or edit fields. The only time these considerations may be important is when a record contains linked calculations, as explained in the next section. Linked Calculations It is sometimes important to consider the order in which calculations are carried out. If they are carried out in the wrong order, you may get the wrong result. The problem only arises with linked calculations, where the result of one calculation depends on the result of another. A simple example would be a file which contains sub-total fields and a grand total field. The sub-totals are calculated by adding the values in other fields; the grand total is calculated from the sum of the sub-totals. The wrong result will be produced if the grand total is calculated before the sub-totals. NormaUy, you do not need to take the order into account. When you save a record, Superbase calculates fields in the order in which they occur in the field list; that is, it works out the result for a calculated field at the top of the record (in Record View) first and then passes to the next calculated field below. Normally, calculating fields in this order produces the correct results. Incorrect results are only produced when the order in which the records should be calculated does not match the field list order. The following example shows how this might occur. Using the Project Menu 2-26 Example This example presents two sets of calculations. In the first set the order in which the calculations should be performed matches the field list order and gives the correct results: Field Unit Cost Quantity Total Cost Discount Rate Discount Total Amount Calculation Value £2.40 10 Unit Cost * Quantity (Total Cost * Discount Rate)/100 Total Cost - Discount £24.00 20% £4.80 £19.20 Here, the calculation formulas for Discount, and Total Amount are linked to the formula which is attached to Total Cost. These formula generate the data values for their associated fields. The values in the other fields are fixed values entered by the user. What would happen if you now decided to modify the file definition in order to introduce two more fields, Tax Rate and Tax Amount? This step would be necessary if you wanted to include the local tax rate in your calculations. You would be able to modify the existing formulas in the file definition, but the two new fields would have to be added at the end of the field list. And the formula attached to Tax Amount would be calculated in the wrong order. After all the fields have been calculated once, the results would be as follows: Field Unit Cost Quantity Total Cost Discount Rate Discount Total Amount Tax Rate Tax Amount Calculation Value £2.40 10 Unit Cost * Quantity £24.00 20% £4.80 (Total Cost * Discount Rate )/100 Total Cost - Discount + Tax Amount £19.20 15% (Total Cost - Discount) * Tax Rate/lOG £2.88 You will notice that the result for Total Amount is incorrect, despite the fact that Tax Amount contains the correct value. The reason for this is that Superbase calculates the value for Total Amount before it calculates the value for Tax Amount. When the value for Total Amount is calculated, the value of Tax Amount is 0.00. ',-.-/ Using the Project Menu 2-27 The Superbase Solution Superbase supplies a straightforward solution to this problem. It is based on the fact that if you perform the calculations a second time, you will arrive at the correct result. You can do this by setting the Calculation Count option in the Set Options dialog. This feature allows you to specify the number of times a calculation (or a chain of calculations) is performed. With a more complicated set of linked calculations you may need to perform them three or four (or more) times before arriving at the correct result. In each case, you would set the Calculation Count to the number required. Other calculation problems may be solved by the Auto Calculation and Selective Calculation options in the same dialog. For further details, see Options, Chapter 7. Another solution would be to create a new file in which the fields were in the correct order. To do this, you would define the correct order with the Query Order option, and then use the Query Output to File option to create a new file from the existing file. See Chapter 11 for more details. Self-referencing Formulas A calculation formula should not normally contain the name of the field it is attached to. But if you edit a calculation formula after it has been Added to the file definition, it is possible to insert the field name in the formula, or to create a new formula which includes the name. In this way, you could create a self-referencing formula for the field total, such as: total + amount When the formula is calculated the value in the field amount will be added to the value in total and then stored in total. Although this may appear to be a useful feature, this type of self-referencing formula is not recommended. The following example should make this clear. Suppose the initial values for the two fields total and amount were: amount: 25 total: 50 After the formula has been calculated once, the new values will be: amount: 25 total: 75 Using the Project Menu 2-28 This, of course, is the correct result. But if the formula is calculated again, the values will be: amount: 25 total: 100 As you see, if the formula is calculated more than once, it gives the wrong result. Because it is difficult to ensure that a formula is only calculated once, self-referencing formulas of this type will invariably give the wrong result and should therefore be avoided. However, there are some self-referencing formulas that will always produce the desired result, no matter how many times they are calculated. Formulas which include the ternary operator (see the next section) provide one example. Another example would be a formula like this: LTRIM$(Firstname) LTRIM$ strips leading spaces from the text specified in the brackets. You might want to attach this formula to the Firstname field, in order to eliminate any leading spaces that the user might type in accidentally. Notice that this also provides an example of a calculated field which is not Read Only. When you define a calculation formula, Superbase automatically makes the field Read Only. If the field is intended to be used for data entry, you will need to tum the Read Only attribute off after defining the formula. Checklist When you attach a calculation formula to a field, it is not necessary to include the field name in the formula. • Superbase can stop you making simple mistakes, but you can still pro duce meaningless formulas if you try hard enough, or if you edit the formula directly in the Main Box. • If you need to construct a very complex formula, it may be easier to set up some intermediate calculation formulas than to try to achieve the desired result in a single very large formula. • The maximum length of a calculation formula is 255 characters. • You may use a formula for cross-file calculation, where it extracts data from another file. • The number of decimal places in a calculation result may be set with the directly entered FIX function, e.g. FIX (amount/3,2). Using the Project Menu 2-29 Constants A constant formula works in the same way as a calculation formula. It generates a result from other fields, functions, and values, and places it in the field the formula is attached to. The difference is that the result is only generated once when the record is first created. After that the formula becomes defunct and no longer operates. If you make a constant field Read Only, the field will retain its initial data no matter what changes you make elsewhere in the record. If the constant field is not Read Only, the initial data it contains can be edited or overwritten. Typical applications for constant formulas are: • To show the date when a record is created. • To set the record's serial number using the SER function. • To set some other kind of reference field such as an account number or a customer number. Usually the constant formula would do this by extracting the reference code from another file. Formulas and Functions A function is a kind of ready-made formula. It calculates a result, just as formula does. The difference is that a function is already defined. All you need to do is enter a single keyword. Thus to work out someone's age from their birth date, you would use the function YEAR in combination with the system variable TODAY: YEAR (TODAy) - YEAR(birthdate) It would not be possible to do this using a formula on its own. By incorporating functions in your formulas, you can extend the range of calculations and validation checks that they are capable of performing. You will find a list of the Superbase functions in Appendix C, together with a brief description of each. Apart from SER and LOOKUP, the functions are not described in detail in this manual. However, many of them will be familiar to you if you know how to program in Basic. If you haven't used Basic before, you may find it useful to consult a Basic programming manual (in most cases, this will be supplied with your computer). Using the Project Menu 2-30 Using the SER Function You can use the SER function to assign a serial number to each record in a file. To do this, you need to define a field which will hold the serial number. It should be defined as a constant field and should have SER("filename") as its constant formula. For example, to assign a serial number to the records in a file called Orders, first define a constant field for the number, then attach the formula: SER("Orders") When you create the first record, it will be given the value 1. This value will then be incremented by one for each record you add to the file. Using the Ternary Operator The ternary operator is one of Superbase's more unusual features. You may find it difficult to grasp the idea behind it, but it is certainly worth the effort. Put simply, the ternary operator allows you to create calculation formulas which can choose between two (or more) alternative results. Formulas like this have a decision-making ability built into them. Like many other complex features, this is best explained through an example. Suppose you wanted to create a file which stored the results of a school examination. One way of doing this would be to use one record for each pupiL The record would include a Marks field, showing the marks gained in the examination as a percentage figure. It could also include a text field called Grade which showed at a glance whether a pupil has passed or failed. By using the ternary operator we can define a formula which sets Grade to either "Pass" or "Fail" according to the pupil's percentage mark: (Mark > = 75) ? "Pass": "Fail" The effect of this formula could be translated as: If the number in the field Mark is greater than or equal to 75, store "Pass" in Grade, otherwise store "Fail" in Grade. The general form (or syntax) of the ternary operator is this: condition ? valuel : value2 The words in italics represent the specific values or conditions that are entered in a formula. In the example above, "Pass" is valuel, and "Fail" is value2. 2-31 Using the Project Menu The condition argument must be an expression that is either true or false, such as: Date > "18 July 1986" or Initial = "8" The parentheses around the condition are optional, but it is a good idea to include them. By separating the condition from the other parts ofthe ternary operator, the parentheses make it easier to understand how the formula works. If you are familiar with programming languages you will recognise the ternary operator as a more concise way of expressing the IF THEN ELSE statement. We could translate the example above to read: IF Mark> = 75 THEN Grade "Pass" ELSE Grade "Fail" = = Multiple Ternary Operations Instead of entering a value as the second alternative in a ternary operation, you can enter another ternary operator. In this way, you can create a formula which chooses between three (or more) alternatives: (Mark > = 75) ? "A" : (Mark > = 60) ? "8" : "C" Here, our example formula sets Grade to "A", "B" or "C". Marks greater than or equal to 75% are graded A, marks between 60% and 74% are graded B, any other mark is graded C. This formula can be modified again to provide further alternatives: (Mark > = 75) ? "A" : (Mark > = 65) ? "8" : (Mark > "C" : (Mark > = 45) ? "0": liE" = 55) ? The number of alternatives you can build into a formula is limited by the maximum number of characters. A formula must not exceed 255 characters, including spaces. Self-referencing Ternary Operations The ternary operator proves one of the exceptions to the rule we stated earlier, which advised against creating self-referencing formulas. Normally, the drawback with this type of formula is that it may give a different result every time it is calculated. Using the ternary operator, you can avoid the Using the project Menu 2-32 problem by placing the field name (the name of the field to which the formula is attached) at the end of the formula. In other words, the last value in the formula should be the field itself. There is no other way of making a self-referencing formula totally foolproof. Take, for example, the formula: Code = "a" ? "London": Code = "b"? "New York" :"Other" The first time you enter the letter "a" in the field Code, the formula will give the result "London". But if the formula is calculated again, it will give the result "Other". The reason for this is that Code will contain the word "London", not the letter "a". This value does not satisfy either of the two conditions so it is replaced with "Other". The correct way of insuring against a false result like this would be: Code = "a"? "London": Code = "b" ? "New York": Code Now when the formula is calculated a second time, it leaves the result as it is. None of the conditions are satisfied, so the field is assigned the value in the last alternative. Since the last alternative is the field itself, the initial value remains unchanged. Using Formulas for Multi-file Applications Superbase allows you to define validation and calculation formulas which make use of the data in other files. For this purpose, it provides the LOOKUP function. LOOKUP can only be entered in a validation formula, but it can be used in two ways: • For cross-file validation, where it checks whether the contents of a field in one file match the contents of a field in another file. • In a calculation formula for the purpose of extracting data from an other file. The syntax for LOOKUP is: LOOKUP(field1,field2) fieldl represents the name of the field to which the validation formula is attached, I.e., the current field. field2 represents the name of the field in another file. For example, you could use LOOKUP to validate the Lastname field in the Addresses file by checking it against the Lastname field in the Customers file. The formula to use would be: LOOKU P(Lastname.Address,Lastname.Customer) Using the Project Menu 2-33 When you enter data in the Lastname field, LOOKUP will check the records in the Customer file. In other words, LOOKUP checks whether the name exists in the Customer file. If it finds a record where Lastname matches the name you have entered - if the name does exist - it accepts the entry. If the name does not exist, it rejects your entry and displays a validation error message. There are a number of rules governing the way LOOKUP is entered in a validation formula: • The second field name must be the name of an indexed field in an other open file. LOOKUP cannot be used for single file validation. • You should always enter the LOOKUP function's arguments by typ ing them into the box at the bottom of the validation dialog. In other words, even if your LOOKUP formula contains a field which is shown in the field list above, you should type the field name into the box instead of clicking on it. • It is important to include the file name as an extension to any field name used with LOOKUP. This applies to all fields irrespective of whether their names are unique to one file or not. For example: LOOKUP(Forename.Address,Firstname.Customer) is correct, while: LOOKUP(Forename,Firstname) may cause problems. • LOOKUP will not work with date/time and numeric fields that have null values; i.e., fields that have been left blank. If you wish to use LOOKUP on fields of this type you must use a string function to force them to give an empty string instead of a null value. For example LTRIM$(DATE$(date field)) will give an empty string when the 'date field' has a null value. • LOOKUP is case sensitive, so there must be an exact match between the data in both fields; i.e., if the data in the first field begins with a capital letter, the second field must also be capitalized. Cross-file Calculation If LOOKUP is successful- if it finds a matching field - the record containing the expression becomes the current record, even though the file may not be the current file and is not displayed on screen. To understand what is involved in this process, you need to be clear about the idea of a current record. Each open file has a current record. The current record for the current file is simply the one that is displayed on the screen. Although the other files are behind the scenes, you can access their fields in 2-34 Using the Project Menu the same way as with the current file. When you refer to a field in a file other than the current file, Superbase looks for data in the current record for that file. These features provide a way of inserting the data from another file in a new record, using LOOKUP in a ternary calculation formula (see Using the Ternary Operator, page 2-30). We can illustrate this with an example involving two files, Orders and Stock. Each record in the Stock file contains details of a particular product, such as its stock code, its price and a description of the product. Orders contains details of a customer's order; these include a stock code for each product item ordered and the quantity of items ordered. Note that the stock code field is common to both files and provides the relational link between them. When a new record is created in the Orders file (or when an existing record is edited), the stock code and quantity will have to be typed in. But by using LOOKUP in combination with the ternary operator, we can ensure that the price (the unit cost) of a product and its description are automatically read into the new record from the Stock file. The calculation formula to attach to the Unit_Cost.Orders field would be: LOOKUP(Stockcode.Orders, Stockcode.Stock) ? Unit_Cost.Stockcode: 0 The effect of this formula is to force a LOOKUP on the Stock file whenever new data is entered (or existing data is edited) in the Unit_Cost.Orders field. First it checks to see whether the stock code in the current record in the Orders file exists in the Stock file. If it does exist, it makes the matching record in the Stock file current. The condition expressed by the ternary operator has been satisfied, so the first value after the question mark - i.e. the contents of Unit_Cost.Stock - is assigned to Unit_Cost.Orders. If the condition is not satisfied, the second value - in this case, a value of zero - is assigned. With a string field, the second value must be a text string, so the calculation formula for the Description.Orders field would be: LOOKUP(Stockcode.Orders, Stockcode.Stock) ? Description.Stock: "" Here, the empty string is assigned to Description.Orders if the stock code doesn't exist in the Stock file; in other words, the field remains blank. Using the Project Menu 2-35 It is up to you to decide what action is to be taken if the LOOKUP is unsuccessful. With string fields, you may want to assign a text string indicating that an error has occurred, as in: LOOKUP(Stockcode.Orders, Stockcode.Stock) ? Description.Stock: "Error" Now if there is no match between the stock codes in the Orders and Stock files, "Error" will be assigned to the Description.Orders field. Normally, however, you would also use LOOKUP in a validation formula attached to the Stockcode.Orders field, so the situation would never arise: the stock code in the Orders file will always be matched with a stock code in the Stock file and, as a result, the condition in the calculation formula will always be satisfied. dBase Compatibility New File is the option to use if you want to convert files from dBase II and dBase III to Superbase format. The exact procedure is as follows: • • c~c • • • Select Project New File. Give the name of the dBase file you wish to convert, omitting the '.dbf extension. You can include a drive specifier if you are reading the dBase file from another device. Enter password(s) if required. Select required index fields. Superbase performs the conversion and creates new '.sbd', '.sbf and index files in the current Superbase directory. Creating Indexes for a File: New Index Overview A Superbase index is a separate file that is related to the main data file. It corresponds to one of the fields in the File Definition. The index keeps a copy of all the data you enter into that field, stored in alphabetical order (actually spaces, punctuation marks and numbers come before the alphabet). An index file on disk has a name of the form "file name.nnn", where "file name" is the same as for the data file to which the index is related, and "nnn" is a number corresponding to the position of the indexed field in the File Definition's list of fields. Example: "Address. 1". Using the ProJect Menu 2-36 An index is used in two ways: to provide a quick method of looking up individual records, and to provide a sequence for the presentation ofrecords. IXD and IXU. These are the attribute abbreviations you see in the File Definition Panel. An IXD field has an index which allows duplicate entries, such as many occurrences of the name "Smith". IXD indexes are compulsory when the field already exists. An lXU field has an index which does not allow duplicate entries: each entry must be unique. You use the Key Lookup button on the Control Panel to enter an index value when you want to retrieve a single record by key. You use the Open Index option when you want to switch the order of presentation from one field to another. You can select the New Index option at any time to build an index on any field in the File Definition. When you're creating a new file, however, you are forced to pass through this dialog, as every Superbase file must have at least one index. You may have up to 999 indexes for each file, using any of the first 999 fields in the File Definition. All indexes are automatically updated when you add records to the file. If you create a large number of indexes, updating them will obviously take longer than if there are only a few indexes to process. Selecting Fields for Indexing The New Index dialog shows a list of all the fields that do not have an index built on them, and asks you to select one. Hew index Title Forenall\!! Street Code i ---- m ® HDrMal index a Unique index mClliillB Click on the name of the field on which you want the file to be indexed. Superbase copies it into the Selection box. If you have entered this dialog from the File Definition dialog, you now have to decide whether the index 2-37 Using the Project Menu is to contain unique entries only or to permit duplicate entries. Click on the appropriate button. Now click on OK. What happens next depends on whether you are creating an index for a file that already has records in it or for a new file that has no records. Note that you should create an index for any field which will be used for relational purposes. Existing Files If you are adding an index to an existing File Definition, Superbase shows a warning message: Building an index May take SOMe tiMe. Do you want to proceed? OK ICancel I Click on OK to proceed. If you have been specifying indexes for a new file, Superbase creates all the disk files that comprise the database file: the ".sbf' extension file for the record data, the ".sbd" file for the definition, and the ".nnn" files for the indexes. Otherwise, if the file already exists, Superbase spends some time reading through the records and creating an index from their contents. You may select the unique index option for an existing file. Superbase will then attempt to create a unique index, checking for any duplicate entries. If it finds a duplicate entry, it will display a dialog which lists the entry and asks if you want to create a non-unique index for the field. At this point, you can click on OK if you want to create a non-unique index, or you can cancel the operation. Using the Project Menu 2-38 The Superbase Working Environment In the Superhase system, you can have any number of database files. Each file can have as many as 999 indexes, and there is no limit to the number of fields per record. This effectively gives you the freedom to construct your database as you wish, without having to worry about whether you're going to bump into inconvenient system limits. However, when it comes to actually working with the system, such a sense of limitlessness can be confusing. Most people prefer to have a well defined structure that they can manage easily. Superbase certainly gives you this, but without sacrificing the flexibility that the basic 'no limits' philosophy implies. In this section we'll be looking at how to define your area of work to suit your immediate purpose. Basically, Superbase allows you to select four components to make up a working database: • • • • A File An Index A set of Fields A current Query Open File This option lets you choose the files you want to work with. Open file Using the Project Menu 2-39 Superbase presents you with a list of all the files in the current directory. To open a file: 1. Click on a file name and when it appears in the Selection Box, click on OK. '~< OR 2. Double click on the file name. If you want to alter the name in the Selection Box, you can: • Click on another name to replace it. • Click on Clear to empty the box. • Click in the Selection Box and edit the contents. You might need to do this if your file is in another directory and you need to insert the pathname, or the file requires a password. Passwords Ifyou have set a password against a file, Superbase will display another dialog into which you must type the password that you specified when you originally created the file. If the password is valid for this file, Superbase will open the file, giving you the access privileges for that password. Opening the Current File When you select a file name and click on OK, Superbase finds the File Definition for that file and returns you to the Main Display. If the file is being opened for the first time in the session, Superbase automatically selects the first index for the file, determined by the position of the index field in the File Definition. The record selected for display is then the first record according to this index. If you have already opened the file during the session, Superbase returns to whichever index and record were current when the file was last used. The file you see on the Main Display is known as the current file. You can always tell which is the current file by looking at the title bar of the main display window, which names both the file and its current index: Superbase: Address indexed on Number There is only one current file at a time, although you may have many files open. 2-40 Using the Project Menu Current File and Open Files You can return to the Open File dialog and open as many files as you want, each time choosing from the list offiles in the directory. Each time you select a file, it becomes the current file. However, all the files you select in one session remain open and available to other Superbase functions, unless you specifically close them with the Close File option. Superbase functions that use the list of open files are: Project Close File Project Edit Project Remove File Process Update Process Query System Status System Open Fields This is one of the most important options in the whole Superbase system. You use it to select a group of fields from the list of fields in the File Definition. These fields then become the default fields for many Superbase functions, including the Main Display. Thus if you have a file with many hundreds of fields per record, you can choose, if you wish, just three or four to work with. Using the Project Menu 2-41 Once you've selected Open Fields from the Project Menu, the basic procedure is simple: 1. Click on a field name in the left-hand panel. Superbase copies it into the right-hand paneL 2. Repeat until the selection of fields you want is in the right-hand panel. 3. Click on OK. The list of fields in the right-hand panel is called the Open Fields List. Here are some tips to keep in mind when using this function: • You can select fields in any order. • You can repeat fields. • You can remove a field from the Open Fields List: click on its name, then click on the Delete button. • Repeated clicking on Delete removes field names from the bottom of the list. • To move a field to a new position in the list: click on its name in the right-hand panel; click on Delete; click on the field before the desired new position in the right-hand panel; click on the field name in the left-hand paneL • To remove the Open Fields List completely, click on Clear. Ifyou want to temporarily suspend the Open Fields List so you can view the full set of fields, use the Close Fields option. The Open Fields list Superbase uses the set of open fields in most of the menu options: • The Main Display, Record, Form and Table View. • Record New, Record Edit, and Record Duplicate. • Process Query, Process Import, Process Export, Process Print, and Process Labels. The open fields list for the current file can be saved with Save File option. It will then become the default fields list when the file is next loaded. Using the Project Menu 2-42 Open Index The index that you select determines the order in which the records in the current file are presented. If, for example, you have a file of addresses for which Superbase maintains indexes on the Lastname field and the City field, you can choose to view or print the records in the alphabetical order of either Lastname or City. Superbase allows only one current index at a time, as indicated on the title bar of the Main Display. It's important to note two things about the restriction to one index at once: • • It does not restrict your ability to specify multiple values when search ing for a group of records in the file using a filter. It does not limit your ability to produce reports with many levels of sorting and subtotalling. When you select the Open Index option, Superbase displays a dialog with a list of all the indexes for the current file. Open index Choosing an index from the dialog is easy: 1. Click on the name of the index you want. When the name appears in the Selection Box, click on OK. OR 2. Double click on the Index name. If you make the wrong selection, change it by clicking on another index, clicking on Clear, or typing directly into the Selection Box. Using the Project Menu 2-43 When you click on OK, Superbase opens the required index and returns to the Main Display. The name of the open index appears on the title bar: Superbase: Address indexed on Lastname All browsing operations done from the Control Panel now follow the order of the index. The Key Lookup button allows you to type in a single index entry in order to retrieve an individual record directly. Changing the Index To switch from one index to another, use this menu option and select the required index as described above. Superbase will not change the current record when you do this, but all Control Panel browsing operations will follow the order of the new index. If you need a new index on a field that doesn't have one, you must use the New Index option to build the index. Each index points to one record in its file. This means you can swap to another index, browse through the file in the order of that index, and then return to the first index and view the record it was originally pointing at. Using the Project Menu 2-44 Close File You will need to close a file in two situations: • To restrict the open files to the ones required for the Process Query and Process Update functions. • To release memory for other uses. The dialog provides a list of the currently open files, including the current file. Close file The procedure is standard: 1. Click on the name of the file you want to close. 2. When the name appears in the Selection Box, click on OK If you make the wrong selection, change it by clicking on another file name, clicking on Clear, or typing directly into the Selection Box. If you close the current file, Superbase makes the first open file in the list into the current file, and returns to the Main Display. If you close all the files in the dialog, you'll see the "Superbase: Please open a file" message which the system shows when you start up. Note: If you are having difficulty displaying the pictures from the External File System, it is advised that you close all the files that you have open. Once you have done this, then open the Pictures file. Freeing memory in this way will ensure that you achieve the maximum size of available memory. Using the Project Menu 2-45 Closing Dependent Files As explained on page 2-32, the LOOKUP function allows you to define relational links between files. When you open a file which sets links in this way, Superbase will automatically open any other files that are specified with the LOOKUP function. If we designate the first file as the master file and the others as dependent files, it should be apparent that you cannot close a dependent file without closing the master file first. The master file makes use of the data in its dependents for cross-file validation and calculation: closing one without the other would risk corrupting the data in memory. If you attempt to close a dependent file while the master file is still open, Superbase will display the following message: Can't do this ... FILE NAME In use by another file A similar restriction occurs when you click on Cancel after editing the file definition for a dependent file. In order to cancel any changes made to the file definition, Superbase needs to load the original file definition from disk. But to do this with a dependent file, it would have to close the file first. So, instead, Superbase displays the message: Can't do this ... Cannot re-open FILE NAME In use by another file Close Fields Superbase suspends the Open Fields List, notifies you of its action, and returns to the Main Display. The full set of fields for the file is then used by the current View format. To re-activate the Open Fields List, select the Open Fields option and click on OK. Using the Project Menu 2-46 Edit: Changing a File Definition However careful you are when you design and create a new file, there inevitably comes a time when you want to change some details. Maybe you made a text field too short, or you find overflow characters appearing when you try to enter data into a numeric field. Or perhaps you decide that a certain field needs a range check adding to ensure the integrity of the data in it. Superbase lets you make almost any change to the original File Definition, and carry on using the file without any delay. You even have a choice which allows you to use the File Definition settings experimentally until you're sure they are what you want, before saving them permanently. First, you make the file you want to change into the current file, by opening it. Then you select Edit from the Project menu. The dialog is the same as the one used in New File. File de'inition Field naMe Attributes NuMber TXT REQ IXD Title TXT ForenaMe TXT LastnaMe TXT IIID Street TXT City TXT IIU) Code TXT Ii) Text 0 External o Nu~eric 0 Required o Date I Tillie 0 Read only Fidd • • • • []'[] IDelete I Forlilat 10 10 15 15 30 15 12 o Validated I m ID UII o Calculation o Constant You will notice that the File Definition Panel contains the first seven fields in the definition. If there are more than seven you can bring the others into view with the scroll bar at the side of the Panel. Here is a summary of possible changes to a File Definition. You can: • • • • • Use Add to add new fields to the end of the list of fields. Use Delete to mark a field as deleted. Change the field type. Change the field's attributes. Change the Format details of a field, such as length, date style, time format; change validation, calculation or constant formulas. ..~ .. Using the Project Menu 2-47 Adding a New Field Do exactly what you would do if creating a field in the New File option: 1. Ensure the Field box is empty - click on Clear if necessary. 2. Type in the new field name. 3. Click on the appropriate attribute button and add the required details in the Field Type dialog. 4. Click on Add and the field name will appear at the end of the existing list. Changing a Field The basic procedure for changing a field is similar to that for creating new fields: '~ ,--/ 1. Click on the name of the field you want to change. Superbase copies its name into the Field box, and selects the buttons that correspond to the field's attributes. 2. Change the field name if you want to. Use the backspace key to delete the existing name, type in the new name, and press the Return key. 3. Click on an attribute button to bring up a Field Type dialog so you can alter the details of the field. You can choose a different type from the existing type. 4. When10u click on OK in the Field Type dialog, Superbase updates the File Definition Panel with any changes you made. 5. If a field is an indexed field, you will have to remove the index before you can change its field type. 6. When you've finished making changes to fields, click on OK in the File Definition dialog itself. Superbase asks you whether you want to save the modified definition. You also have the option to try it out in memory, either saving it or abandoning it later. Rules for Changing Fields Text Length may be varied freely. • Validation, Calculation or Constant formulas may be added, changed or removed. • Required status may be added or removed. • Read Only may turned on or off. • Multiple response fields may be added or removed • Type may be changed to numeric, date, time or external: Using the ProJect Menu 2-48 If numeric, all text will be lost when the field is next saved. If date, all non-date text will be lost when the field is next saved. If time, all text in the field will be lost when it is next saved. If external, Superbase will not be able to find non-existent external files, and will reject any text that would be an illegal file pathname. Numeric Number pattern and features may be varied freely. • Validation, Calculation or Constant formulas may be added, changed or removed. • Read Only may be turned on or off. • Required status may be added or removed. • Type may be changed to text, date, time or external: If text, the number will become a character string. If date, the number will be treated as a julian date and interpreted according to the style you choose. If time, the number will be treated as thousandths of a second and interpreted according to the time format you choose. If external, Superbase will not be able to find non-existent external files, and will reject any text that would be an illegal file pathname. Date Date styles may be varied freely. • Validation, Calculation, or Constant formulas may be added, changed or removed. • Required status may be added or removed. • Type may be changed to text, numeric, time, external: If text, the date will become a character string of the julian date, i.e. a string of numbers. If numeric, the date will be displayed as a number according to the numeric format you select. If time, the date's julian date number will be treated as thousandths of a second. If external, Superbase will not be able to find non-existent external files, and will reject any text that would be an illegal file pathname. ~/ Using the Project Menu 2-49 Time Time formats may be varied freely. • Validation, Calculation, or Constant formulas may be added, changed or removed. • Required status may be added or removed. • Type may be changed to text, numeric, date, external: If text, the time will be shown in thousandths of a second as a character string. If numeric, the time will be displayed as the number of thousandths of a second. If date, the time in thousandths of a second will be treated as a julian date number. If external, Superbase will not be able to find non-existent external files, and will reject any text that would be an illegal file pathname. Validation, Calculation and Constant The details of the formula may be varied freely. • The formula may be removed by clicking on Clear, then OK.. • Required status may be added or removed. Note: Direct editing ofthe formula may make it invalid. Read Only May be added or removed. Required May be added or removed. Note: Increasing the length ofafield may cause it to overlap with anotherfield in Form View, creating a confusing display until the Form View is changed. Using the Project Menu 2-50 Deleting a Field First select the field by clicking on its name so that the name is copied into the Field box. Then click on the Delete button. Superbase places the DEL abbreviation in the Attributes column of the File Definition Panel. When you do this, Superbase leaves the field data in place in the'.sbf file, and leaves the field name in place in the File Definition, until EITHER • You tidy up the file with the System Reorganize menu option; OR • You use the Process Update menu option. In this case Superbase removes the data from the file for the records it actually processes during the update. The File Definition is not affected by Update. Because of the delay between marking a field as deleted and actually removing the data, you can recover deleted fields by clicking on them and selecting the appropriate Attribute type button, as for a new field. Concluding File Editing When you have finished making changes to your File Definition, you must click on OK to put the modified definition into effect. Superbase displays the Save File Definition dialog, which is explained below. Using the Project Menu 2.-51 Save File This option stores the File Definition of the current file. Save file definition OK I ICancel I All the current settings as shown in the File Definition dialog are saved, together with any Validation or Calculation Formulas. Superbase also stores the coordinates of all the fields as most recently arranged in Form View, and the open fields list for the current file. If you click on OK, Superbase will save the File Definition as a '.sbd' file, and the present settings will be the ones used the next time you open the file, unless you edit it again. If you click on Cancel, however, you can continue to work with the settings as they are, without making any permanent change to the '.sbd' file. This allows you to experiment freely with the details of the File Definition, testing out various settings and formulas until you're sure you've got them right. When you're satisfied, you simply select the Save option on the Project menu, select File from the Save dialog and click on OK when the dialog appears. Note that you are not required to to select the Save File option after creating a new file. Superbase automatically presents the Save File dialog when you complete the process of defining the file. As explained in the previous paragraph, at this stage clicking on Cancellet<; you postpone the Save File option until you have tested the file definition. You only need to select Save File if you have chosen Cancel beforehand. Save File is also used for these purposes: • • To save the layout after setting the position of fields in Form View. To save the fields list for a file after using the Open Fields option. Using the Project Menu 2-52 Remove File Remove File erases all traces of the chosen Superbase database file from the directory: the '.sbf file, the '.sbd' file, and any indexes associated with the file. This function does not remove records from inside a file while leaving the File Definition intact - you use the Process Remove option for that. Superbase presents a standard dialog with a list of all the open files. You select a file in the normal Superbase way: 1. 2. Click on its file name. When the name you want is in the Selection Box, click on OK. To be able to remove a file, you must have opened it with delete privileges. You automatically have these unless more than one password has been set. Before finally removing the file, Superbase asks for confirmation that this is indeed what you wish to do. Remove Index From time to time you may wish to drop an index if you find it is rarely used. This will improve performance slightly and use less memory, as Superbase will no longer have to update the index when you add or replace a record. As for Remove File, Superbase presents a standard dialog, this time with a list of all the indexes for the current file. You select an index in the normal Superbase way: 1. 2. Click on its file name. When the index name you want is in the Selection hox, click on OK. As this too is irreversible, Superbase asks for confirmation that this is indeed what you wish to do. Should you wish to rebuild an index after removing it, use the New Index function. Removing Other Files Other files such as Export files, should be removed using the Delete option provided by the System menu. See Chapter 8. Using the Project Menu 2-53 Quit When you want to leave Superbase, you can do so by selecting this option. If you prefer, you can click on the Close box in the top left-hand corner of the Superbase window. ,-/ If you have modified records or file definitions, and you have not saved them, Superbase will ask for confirmation and then ask if you wish to save them before closing down the system and returning you to the Desktop (Workbench on the Amiga) screen. Similarly, if you have modified a text file or a program, Superbase will alert you to the fact and ask if you wish to proceed. CHAPTER 3 TUTORIAL: SETTING UP A NEW FILE Now that you've read about setting up a file and defining fields, let's go through an example to see how you do it in practice. In this example you are going to set up a Bank file, which will include names, addresses and bank deposit details. The tutorial will take about thirty minutes to complete, so allow yourself enough time. Briefly, there are four stages to this tutorial: 1. Select New File from the Project menu. Once the New File dialog is displayed, type in the file name. 2. Type in a password. 3. Enter the field names and details. 4. Specify index fields. Start by selecting New File from the Project Menu. New File Name Dialog Superbase displays the following dialog: - Hew file I OK "Cancel'. You now have to type in a file name. For this tutorial we are going to create a file called Bank. Now type in "Bank", and press Return. Tutorial: Setting up a New File 3-2 Superbase now displays the Password dialog. Type in a single password, so that you will have all levels of privilege. Keep it simple and easy to remember as you'll need to enter the password each time you open the file. Once you've typed in your password click on OK. Superbase then displays the File Definition dialog: File definition Field naMe Attributes a External ® Text a Required a NUlIleric a Date I TiMe a Read only ForMat a Validated a Calculation a Constant Field We can now define the fields for the Bank file, which are: • Number Forename Lastname Bank Account Type Date Amount Interest Rate Annual Interest • • • • • • • • Tutorial: Setting up a New File 3-3 Number This is going to be the reference number for each record and will be a required field. We'll set up this field as a text field because it will contain both alpha and numeric characters. The procedure for defining a field is quite simple. First the field name must be typed into the field box. So click in the Field Box and type in the field name "Number". Next, you have to define this field as a text field, so click on the Text button. Superbase then displays the Text format dialog. Text forMat ~ ~ a Upper case a Lower case a Capitalize ID Responses I OK C-an-cel!!"""ll II'""'!I This dialog enables you to set the length of each Text field and various other attributes such as the number of responses the field will accept. At the top, you will see the Field Length box. The default value is 20 characters, which is the value you can see on your screen. The Number field only needs a length of 10 characters, so erase the existing figure using the Backspace key, and then type in 10. For this example, we'll ignore the other Text format options. Once you've set the field length click on the OK button to clear the screen and return you to the File Definition dialog. Now we have to make the number field a Required field, so that it can't be left blank by mistake. So click on the Required button. Superbase places a dot in the middle of this circle to show that this attribute has been selected, making the Number field a required field. This field is added to the file by clicking on the ADD button. Do this now and watch the screen. 3-4 Tutorial: SeHing up a New File Superbase displays the field name in the File Definition Panel along with its attributes and field length. Check that these details are correct before moving on to the next field. Forename The next field to enter is Forename, which will also be a text field, but not a required field. Move the pointer and click in the field box, then type in Forename. Click on the Text button to call up the Text Length dialog. You'll see that Superbase carries over the value from the last time you used the dialog, so you need to adjust it for this field, which is to be 20 characters long. When you've done this, click on OK to exit back to the File Definition dialog. Now you can add this new field by clicking on the ADD button. Once you've done this if you look at the File Definition Panel you will see that the field you have entered is shown on the second line. Lastname, Bank, Account Type You can create these three fields even more easily than the last two. Enter the field name, but don't click on the Text button. Click instead on the ADD button, and you'll see that Superbase adds the field with the value taken from the last time you used the Text Length dialog: 20 characters. This is only possible with text fields. Add these three fields now before going on to the next field. Date This is slightly different from the fields you've created so far because we are going to define it as a Date field. However, you start off the same way. Move the pointer and click in the field box and type in the field name, which is Date. Now you must define the format in which dates are to be displayed. Click on the Date I Time button. Superbase displays the following dialog: Tutorial: Setting up a New File 3-5 Date I Tine tornat 'tdi- I Tine I ~ Da, Month Year a Month Day Year a Year Month Da, ~ [illD lID IMInIM I [!!] ~ am 0DII[][] I OK II Cancel I If you look at the dialog you will see the current system date is displayed in the default format of Day, Month, Year (DD MMM YYYY). In this format DD is the day, MMM is a three letter month abbreviation and YYYY is the full year. We will use this format, so click on the OK button. Finally, add the field to the file by clicking on the ADD button. Tutorial: Setting 3-6 up a New File Amount This field will contain the balance for each record within the Bank file and therefore we must define it as Numeric. Once again the field name is entered in the same way as before, by typing the word Amount into the Field Box and pressing Return. However, this time you must click on Numeric instead of Date. Superbase will display another dialog which looks like this: NUMber ForMat §;3-99999.00 ~ As with the Date Format dialog, Superbase will show the default Format. We will change this to include a currency symbol and a separator for thousands. Move the pointer and click on the $9 button, then click on the (,) button. Once you've done that click on the OK button, and when you're back at the File Definition dialog click on the ADD button to add this field to the file definition. Interest Rate This field will be set up as a Numeric field, and we will introduce a validation check to limit the range ofvalues that can be entered. We'll define this range as being greater than zero and less than 15. Type in the field name in the usual way, then click on the Numeric button. Notice that Superbase has carried over the format and the features from the previous numeric field. This can be very useful when you have to create many fields with the same format one after another. For Interest Rate, we will need to change the Number format. First, the number is not going to need provision for a sign, as it's never going to be less than zero. So, click on the - sign button to deselect it. Then deselect the $9 and the (,) buttons in the same way - these features are not needed for this field. .-~ Tutorial: Setting up a New File 3-7 Next you need to shorten the number format. Click on the down arrow on the left-hand side of the number format panel. As you do this you will notice that the number format changes from 99999.00 to 9999.00. Click the arrow until the number is reduced to 99.00. Once you've done that click on OK. Now click on the ADD button. Superbase adds the Interest Rate field to the File Definition Panel. Next you're going to add a range check to this field. Click on the Interest Rate field name to res elect it and copy its name into the Field Box. Now click on the Validation button. Superbase displays the Formula dialog. Validation forMula for Interest File: bank ~ orenal1le 0 ~ astnal1le IT] ank ccount type ~ [8 ate IT] Mount Value nterest Rate Interest Rate }: 0 AND Interest rn rn m I Rate I AND I 0 [Q[] c::J INOT I 0 ILIKEI [2] Rate (: 15 This dialog enables to you to create the validation formula that will be used by Superbase each time a value is typed into the Interest Rate field. The formula will ensure that every interest rate is within the permitted range. The formula you want is: Interest Rate> = 0 AND Interest Rate < = 15 Do this in stages. Move the pointer into the Field Name Panel and click on the down arrow to bring the field name Interest Rate into view, and then click on Interest Rate. Next, click on the > = button. Now you have to enter oin the Value Box. You do this by moving the pointer into the Value Box and clicking on the mouse button. This produces the cursor. You can now type in "0" (omit quotation marks), and press Return. Superbase has copied your selections into the Main Box, and your Validation Formula should read like this: Interest Rate > =0 Tutorial: Setting 3-8 up a New File To make a link to the next part of the Formula, you click on the AND button. Now repeat what you did before: click on Interest Rate, then (slightly different) on the < = button, and then in the Value Box, where you type "15", and press Return. Your Formula should look like this: Interest Rate > = 0 AND Interest Rate < = 15 If you've made any errors, you have a choice of how to correct them. Either click in the Main Box and edit the Formula directly, or click on Clear and repeat the steps above. Once the formula is correct, click on the OK button, and Superbase will return to the File Definition dialog. Notice that Validation is now shown as selected. Superbase updates the File Definition Panel to show VAL under the Attributes column, but it does not show the Validation formula; you can use System Status File to look at it later. Annual Interest This is the last field we need to enter for this file, and it's going to be a Calculation Formula field. This means that Superbase will calculate a result for the field based on the values of the fields referred to in the formula, in this case Amount and Interest Rate. So, click on Clear to remove Interest Rate from the Field Box, and then click in the box and type in the field name Annual Interest. Click on the Numeric button. The format needs to be reset from the format used for Interest Rate. Click on the $9 and (,) buttons to set the currency sign and thousands separator, and the - button to provide for a minus sign. Then click on the left-hand up arrow four times to expand the format, which should look like this: -$999999.00. When it's right, click on OK to exit back to the File Definition dialog. Don't click on ADD yet. Next, click on Calculation. Superbase displays the Calculation Formula dialog, which works exactly like the Validation Formula dialog you have just used. Notice that the previous formula is carried over. What we want Superbase to do is to calculate how much Interest is due for each balance based on the current Interest Rate, and then display this value in the Annual Interest field. Tutorial: Setting up a New File 3-9 So, the formula to calculate the amount of interest is: Amount * Interest Rate /100 ...~ You should be able to do this without detailed guidance. Click on Clear to empty the Main Box. Now click on the field name Amount, the * button, the field name Interest Rate, and the / button. Then click in the Value Box and type in the value "100". Press Return. The Formula should read as above. Once it's correct you can click on the OK button. This field is then added to the file in the usual way by clicking on the ADD button. That completes the entry of the fields, so now you can click on OK in the File Definition dialog. New Indexes Superbase now clears the dialog from the screen and displays the New Index dialog. I He", index NUMber iii ForenaMe Lastnaflle Bank Account type Date ~ AMount III NUMber ® Norlllal index a Unique index OO[]!!E]S This is the last part of the process of setting up a file, which is to specify the field names you want to use as indexes. If you look at the screen you will see a list of the field names you have just entered. What we have to do now is to decide which fields to use as indexes. For the Bank file we want indexes on Number, Lastname, Bank and Amount. You can only specify one index at a time. So, move the pointer and click on Number. As you do this Superbase displays this field name in the box at the bottom of the list. Also notice that Superbase has highlighted the Normal 3-10 Tutorial: Setting up a New File Index button, indicating that duplicate index entries may be allowed. Since the Bank file may have several deposits for each customer, Normal is the right type for this index. So, click on the OK button. You can now repeat this exercise for Lastname, Bank and Amount, creating a Normal index for each one. Notice that each time Superbase re-displays the New Index dialog, the field name you used to specify the previous index has been removed. When you have completed that, don't select anything else from the list, but click on the OK button. This informs Superbase you have finished making your selections and it can proceed to save the File Definition and create the Index Files. Once the indexes have been built Superbase displays the file in the format of the current view. The file will be indexed on the first index you specified, in this case Number, as shown by the message on the title bar at the top of the window. Superbase also displays a blank record showing the field names you set up in the File Definition. You can now begin to enter records into the file. For further information please see the next section, Using the Record Menu. That's the end of the tutorial. By now you should be able to create a file of your own, and we recommend that you do this for practice before moving on to the next section. Remember to write down the fields that you want, and to decide what type of fields they are going to be, before you start creating your file. Good luck! CHAPTER 4 USING THE RECORD MENU This section explains how to use the Record Menu. The Record Menu includes a number of options for maintaining the data in the current Superbase file, as well as two options for manipulating records in the External File System. We shall cover all the menu options: ,--. • • • • • Adding a new record to the file. Editing an existing record. Making a 'snapshot' copy of a record (Duplicate). Saving and removing single records. Manipulating records in the External File System. This chapter ends with a Twenty Minute Tutorial, which will give you practical experience of using the Record Menu. Editing Features Most of the options on the Record Menu involve typing on the keyboard, and as the rules for editing Superbase fields are the same in all options we shall look at them in one place. The Basic Editing Screen You can edit and create records from either Form or Record View. If you select Record New, Edit or Duplicate when Table View is set, Superbase automatically switches into Form View. In both Form and Record Views, you can use the scroll bars to bring any part of the record into view. In either Form or Record View, you can edit the current record at any time by moving the mouse into a field and clicking to obtain a cursor. 4-2 Using the Record Menu All Fields or Open Fields? The field names that appear may be all the fields or just a few of them. This depends on whether there is an Open Fields List active. If you only want to enter data into a few of the fields in the record you should open only those fields. If you do use an Open Fields List, Superhase still processes the fields that do not have data entered into them. If a field fails a validation check because you've left it empty, Superbase will tell you. If indexed fields are left blank:, Superbase makes an entry of spaces in the index. Such records come first in the sequence when that index is used. Field Selection by Menu Option If you select Record New in Form View, Superbase automatically positions the cursor in the first field of the Form, usually at the top left-hand corner. If you select Record Edit or Duplicate, Superbase automatically positions the cursor in the first field on the screen. Ifyou select Record New in Record View, Superbase automatically positions the cursor in the first field of the Form, at the top of the screen. If you select Record Edit or Duplicate, Superbase automatically positions the cursor at the beginning of the first field on the screen. Field Selection with the Mouse Use the mouse to move the pointer to the field you want and click once. If you click inside the field, Superbase produces a cursor at the location of the click. In Record View, if you click heyond the end of the field, Superbase moves the cursor just into the editing area; if you click before the start of the field, Superbase moves the cursor to the start of the field. However, if you click below any of the fields Superbase assumes you have finished editing and makes the cursor disappear. Field Markers Each field starts one space after the end of the field name zone. In Record View the end of the field that the cursor is in is marked by a single vertical bar. In Form View all fields have end of field markers. Using the Record Menu 4-3 Moving from Field to Field Several methods are available: ,/ ,-----". • Cursor up or down. In Form View, cursor up or down moves the cur sor to the next field above or below the current field (the exact move depends on the exact position of the cursor in the field and whether the field names begin in the same column). In Record View, cursor up or down moves up or down a field respectively. • Return moves the cursor to the next field. Control-Return moves the cursor to the previous field (Shift cursor up). • Move the mouse and click. Editing Inside a Field All typing uses automatic insertion, so ifyou want to remove characters you must first delete them with the Backspace or Del keys which function in the normal way. CIRL X clears the field; if you clear a field by mistake, use CIRL U to restore the field data. CIRL U also undoes any changes you have made within a field, provided you have not pressed Return. The cursor left and cursor right keys move the cursor around in the field. The Home key (Shift left cursor) moves the cursor to the start of the data in the field and the End key (Shift right cursor) moves the cursor to the end of the data in the field. The Tab key skips the cursor along eight spaces at a time. Shift Tab effects a reverse Tab movement. Entering Dates For a date field, Superbase uses the format specified for the field in the File Definition as the basis for display. This allows useful short cuts like entering "6986" and having it displayed as "6 September, 1986". The only requirement is that you get the Day Month Year order right. A date in a Validation Formula must conform to the Day Month Year order in the format for the system date as specified in the Set Date option. Using the Record Menu 4-4 Entering Times Times must be entered in the format specified in the File Definition. Entering Numbers As with dates, Superbase uses the format specified for a numeric field in the File Definition as the basis for display. Superbase is very tolerant of spaces in your editing. You can enter, for example, "2300.5" and have it neatly redisplayed as " 2,300.50". Required Fields If a field has Required status, you must enter some data into it. You can skip it with Return, but Superbase will catch an empty Required field when you go to save the record. Read only Fields You cannot enter data into a Read Only field. If you attempt to do so, Superbase will move the cursor on to another field. Entering Data into Validated Fields If you have specified a validation check for a field, any data you enter must pass the check. If it does not, you will see the following message: Can't do this ... Lastname Field does not match validation 01< II Cancel I If you can't remember what the rules for the field are, click on the Cancel button on the "Can't do this" dialog. Now select Status File from the System menu. This will show you the Validation Formula for the field you are editing. Once you have read the appropriate Validation Formula, select Edit from the Record menu. Now you can fmish your editing activity. If you know what the Validation Formula is, then click on the OK button of the "Can't do this" dialog. This will put you back in the editing mode, and you can finish off your editing. Using the Record Menu 4-5 You may want to be able to skip over a field that has a validation check attached. If so, you must include a zero or null option in the Validation Formula when you specify it. There are examples of these in the section on setting up a Validation Formula. Calculation Fields Fields that have calculation formulas attached to them will generally be Read Only Fields. This means they cannot be edited directly. You can only edit the component fields of a calculation field. If they are not Read Only, you will be able to enter data in the field but it will be overwritten when the calculation is performed - unless it is a self-referencing calculation (see Chapter 2). When you are entering data to a new record or editing an existing one, Superbase does not display the results of a calculation formula until you: • • • Click on the calculated field, or Cursor through the field, or Go to save the record Constant Fields Fields with constant formulas attached to them cannot be edited directly if they are Read Only fields. Otherwise, you can edit these fields in the usual way. Remember that Superbase only works out the result of a constant formula when the record is first created. Thereafter the formula becomes inoperative. Any data you enter will therefore overwrite the result of the formula. Stop Editing If you move the pointer outside any of the fields and click the mouse, Superbase assumes you have finished editing and makes the cursor disappear. If you double click the mouse, Superbase assumes you want to save the record. We discuss this in detail later on. If you have made any changes to the current record, or added any data to a new record, Superbase does not let you perform any other action that involves selecting a record without asking whether you want to go ahead and save the record first. Using the Record Menu 4-6 Record New Each record in a file has the same format, as set out in the File Definition, consisting of a number offields of different types. If it helps, you can imagine each record as a card in a card index, or a form in a folder. Whenyou want to create a new record ('add a card to the box', or 'add a form to the folder'), you have to follow a simple procedure: 1. Select New from the Record Menu or press ALT N (Amiga N). 2. Type data into the fields. 3. Save the record. Before you can begin you must have a file open. If necessary, select Open File from the Project Menu. Then select the New option from the Record Menu or use the keyboard alternative, ALT N (Amiga N). Typing in Data Superbase displays the field names for the current file. The example given below shows the screen you would get if you were entering a record into the Address file, which is on your demonstration disk. Project Record HI PrOCU5 Set SUDerbase: SYSt4!M ADDRESS indexed on Nu/llber SBP •• :Imm;m , ::(:::::::X:::::::::'::::::::::::':::::::(::::(::::::': :::::(:::::::::::::::::::::::::;:;:;::(.::::;:::::;:;:;::::::':;:(:::::::::::::::::;:;:::::::(':::::'::::::::::::::;::::::':::':::::::':::'1 • II" Using the Record Menu 4-7 Once you've decided where to start, you simply enter the data for each field in turn. If you've set up Validation Formulas, these can ensure that the data you enter is correct for each field. If you make mistakes while typing in data, you can correct them using the Backspace and Delete keys together with the other editing controls explained above. Record Save Once your record is complete, you save it on disk using one of three methods. The first is by double clicking the mouse, the second is to use the Save option from the Record Menu, and the third is the key combination, Alt-S (Amiga S). Double clicking the mouse will produce the Save Record dialog. Save this record? D.DB This dialog gives you two options. You can either click on the OK button, and save the record on the disk. Or you can click on the Cancel button. This leaves the data on screen, so you can do more editing if you need to. You may find that the second and third methods of saving a record are quicker than double clicking the mouse button. Neither method produces the Save dialog: the record is saved automatically. This means that you can speed up data entry by keeping your hands on the keyboard. If one of the file indexes accepts unique entries only, and you try to save a record which would cause a duplicate entry, Superbase prevents you from going ahead. If you leave an index field empty, Superbase still gives it a value, so you can't store more than one empty index field in a unique index. After a new record has been saved, Superbase displays a blank: record. This means that straight away you can enter data for another new record without having to select Record New first. Using the Record Menu Batch Data Entry 'Batch data entry' refers to the process of creating a number of new records, one after the other, as a single 'batch'. The Batch option provides a way of reducing the time Superbase takes to save a batch of records. You toggle Batch on and off by selecting it from the Record menu in the normal way. Before we can describe the Batch option in more detail, we need to explain how Superbase saves records. The internal procedure for saving a record is rather more complicated than you might think. It is not just a matter of copying data to disk from the computer's memory. For every record saved, Superbase performs a number of operations such as opening and closing the file, and flushing the disk buffer. These operations are necessary to guarantee the safety of your data. If you suffer a power failure or if you turn off the machine accidentally, the most you will lose will be the record you are working on at the time. When Batch is on, Superbase dispenses with these safety measures. It only carries out the full procedure twice; once when you start batch data entry (when you save the first record) and once when you finish. As a result, the time taken to save a large number of records is greatly reduced. On the Amiga, disk operations may be speeded up quite significantly when Batch has been turned on. The drawback is that the data you enter will be not properly secured on disk until you turn Batch off. This last step is particularly important. Whenever you enter a number of records as a batch, you must complete the operation by turning Batch off. Superbase will then take all the steps necessary to store the data safely on disk. If you do not do this you run the risk of losing the data you have just entered. In fact, Superbase also makes the record data secure on disk when you Close the file and when you Quit; but you should still remember to turn Batch off after saving records. Note that Batch can also be used to improve the speed of disk operation when you are editing records or deleting them (with the Remove option). Caution: Do not remove a disk from the drive when Batch has been turned on. Using the Record Menu 4-9 Record Edit This section describes selecting the Record Menu Edit option. Remember that in Form or Record View you can start editing a record at any time just by clicking in any field. You can only edit the current record. So you must first select the record you wish to edit. You can do this in one of two ways: • Direct retrieval with the Key Lookup button. • Browsing in either Form or Table View, using the Current Record button to confirm that you have the right record. Once you have selected a record for editing, select Edit from the Record Menu. IfTable View is set, Superbase switches to Form View with Paging on. If you are already in Record View or Form View, editing takes place in that View. Superbase positions the cursor in the first field on the screen. You can now edit the record using the techniques explained earlier. When you've finished, save the record either with the double click which will bring up the Save Record dialog, or by selecting the menu option (the keyboard equivalent for this is Alt S or, on the Amiga, Amiga S) which will save the record without asking for confirmation. Record Duplicate This option allows you to cut down on the time taken to enter records where some of the data is the same. You make a 'snapshot' of the current record in memory, edit in any changes you want, and then save it in the normal way. First select the record you wish to duplicate. Then select Duplicate from the Record Menu. Superbase informs you that a copy of the record has been created in memory. Now edit the record as you wish. When you've finished, save the record with either the double click or the Record Save menu option. .~ Note that the Duplicate option re-intializes any constant formulas. This means you can duplicate a record which contains the constant formula SER without duplicating its serial number. Similarly, if a file uses the constant formula TODAY, creating a new record by duplicating an existing record does not reproduce the original date. Using the Record Menu 4-10 Record Remove From time to time you may find that a record is no longer needed. This menu option discards the current record. Select the record you want to remove; Then select Remove from the Record Menu. Superbase displays the Remove Record dialog. Remove this record? I OK I ICancel I As you can see it is very similar to the Save Record dialog. You have two choices: you can click on the OK button to remove the record, or you can click on the Cancel button to change your mind. External > > and External < < Both> > these menu options are used in conjunction with the Superbase External File System, and enable you to select pictures or text files individually, within a single record. For more details, see Chapter 9. Twenty Minute Tutorial In this example you will use the Bank file you created earlier to create, edit, duplicate and remove records. Select Record View from the Set Menu for this exercise. Opening a File Next, open the Bank file that you created in the last tutorial. By now you should becoming quite used to using the menus, so we won't go into detail. Select Open File from the Project Menu, then click on Bank. Once you have opened tbe file, you will be able to see tbe field names down the left-hand side, witb no data on tbe right-band side. This is because the file is empty. Using the Record Menu 4-11 Entering Data Move the pointer to the menu bar and highlight the Record Menu. This is the menu you use when you are creating, editing, duplicating or removing records. The option to use when you are entering a record for the first time is New, which is the first option on the menu. Select New now. If you look at the screen, you will see that Superbase is displaying the cursor in the first field of the record. The end of the field is shown by a vertical bar. You are now going to enter your first record into a Superbase file. Here is an example record: Number: Forename: Lastname: Bank: Account Type: Date: Amount: Interest Rate: ROX001 Jane Roxann Harvard-Otterway Deposit 12 Jun 86 1000.00 9.5 Start by entering the Number. When you've typed the example data, press Return. The cursor moves to the next field. You can then continue and type in the rest of the data. Remember to make sure you are entering the data against the correct field. Don't worry about making mistakes, as these can be corrected as you go along by using the Del or Backspace keys. ::::::' '. ',::::.'.::: ;':;,':: Using the Record Menu 4-12 Now you can save the record. Use the simplest and most convenient method - double click the mouse. This produces the Save dialog. Respond to it by clicking on the OK button. Superbase saves the record. Alternatively, you can use the key combination Alt-S (Arniga S). This may be a quicker method of saving a record if you are entering multiple records, as it means you don't have to take your hands away from the keyboard. Done that? Right, let's type in another two records: Number: Forename: Lastname: Bank: Account Type: Date: Amount: Interest Rate: SMIOO! William Smith Allied Irish Gold Plus 30 Jun 84 100.00 9.50 Number: Forename: Lastname: Bank: Account Type: Date: Amount: Interest Rate: JONOOI Peter Jones First National Silver 28 Nov 85 4000.00 9.75 You can enter these records in exactly the same way as you did before, but remember to look at each field as you type in the data, to make sure it's the right one. Remember also to save the first record before moving on to the second. Editing a Record Supposing you want to change some of the details in William Smith's record. How do you do it? First of all you have to select William Smith's record. Use the Control Panel Next and Previous Record buttons until this record is on the screen. Move the pointer and select Edit from the Record Menu. Superbase positions the cursor in the first field of the record. Look at the record, and find the Date field. You are going to change this from ''3~ Jun 84" to "01 Jan 83". Use the mouse to move the pointer into the Date field. Then click the mouse once. This action produces a cursor in the Using the Record Menu 4-13 field. Now use the Backspace or Del key to remove the date that is already in this field. Type in "01 Jan 83" and press Return. That's it, you've now edited the record. Save it by using the key combination Alt-S (Amiga S), or selecting Save from the Record Menu. The example you've just worked through is an easy standard procedure for editing a record. You can also edit records in Form View, and ofcourse there are many more editing features available to you, which are described at the beginning of this section on the Record Menu. Duplicating a Record If you want to create a new record that has very similar data to another, you can do so using a convenient shortcut, the Duplicate option. What you're going to do now is duplicate Jane Roxann's record and create a record for her sister. So select Jane Roxann's record using the Control Panel buttons. You should be able to do this without detailed guidance by now! Now move the pointer onto the Record Menu and select the Duplicate option. Superbase displays a message to say that the record has been copied in memory, and you can now edit it. You only need to change the information in three of the fields, these are Number, Forename and Amount. If you look at the screen you can see the cursor is already at the Number field. So use the Backspace or Del key to delete the number that is already there. Now type in the new number, which is "ROX002". Once you've done that press Return to move the cursor to the next field, which is Forename. This time use CTRL X (Amiga X) to delete the contents. Now type in the new name, which is "Candy". Now press Return until the cursor reaches the Amount field. Are you there? Right, use CTRL X again and then type in 5000. Superbase redisplays it as 5,000.00. That completes the editing for this record so you can now save it in the usual way. Removing a Record After you have been using Superbase for a while you may want to remove a record from your files. The procedure is straightforward, so let's run through it now. We'll remove Jane Roxann's record from the Bank file. Select Jane Roxann's record as you did before. To remove the record you have to select Remove from the Record Menu, so do this now. Superbase displays the Remove dialog, asking you to confirm that this is the record you want to discard. Click on the OK button to proceed. Superbase returns to the Main Display showing the next record in the file. 4-14 Using the Record Menu That's it, you've now removed the record. If you want to remove groups of records, you should use the Process Remove option. That concludes this short tutorial. CHAPTER 5 USING THE PROCESS MENU The main database processing functions are contained in the Process Menu. It provides all the facilities for managing and manipulating your data, ranging from simple mailing label printing to complex multi-file queries and updates. The Filter ..~. All the Process menu functions make use of filters to determine which records are to be processed. The Filter concept is described in detail in Chapter 1 so you should refer to that chapter if you need to refresh your memory. Update The Project menu Update option allows you to make changes to individual fields in your files. Update provides a multi-file facility, like Query, and you can use records in one file to determine what happens to fields in another. Since multi-file options are more complicated and more powerful than single file options, and since Update can by definition alter the data in your files, we recommend that you gain a good understanding of the Superbase system before starting to use the option. Also, you should be sure to make a backup of your data before updating it. You can do this using the Copy option provided by the System menu. The Update Menu Options There are three Update menu options: Edit, Load and Save. You use Edit to create a new Update, or to edit an Update which has been loaded from disk. Load is used to load an update from disk, Save stores an Update on disk. When you save an Update, Superbase also saves the names of the database files associated with it. These files will then be opened automatically when the Update file is next loaded. 5-2 Using the Process Menu Update Load When you click on this option, Superbase displays a file dialog showing a list of the Update files in the current directory. After you have selected a file, you will be presented with a filter dialog. If you click on OK, you will then be presented with a fields dialog. Both these dialogs are explained in the Update Edit section, further on in this chapter. At this stage, you can stop and edit the current Update. If you want to run the Update you have loaded, click on OK in both dialogs. Update Save Select this option to save the current update. A file dialog will appear showing the names of the Updates in the current directory. To save the current Update under an existing name, click on one of the names in the panel. To save a new Update, or a new version of an existing Update, type the file name in the Selection Box. Update Edit Edit gives you access to the two Update dialogs, Filter and Fields. If there is already an Update in memory, you can edit the command lines in these dialogs; or you can use the dialogs to create a new Update. Starting a New Update Update can use only the open files, so if you want to alter or refer to a field in the Update Command Lines you must first make sure the file that contains the field is open. Use Project Open File to do this. Close any files you do not want to use in Process Update or Query. Now highlight the Process Menu and select Edit Update. Superbase displays the Update filter dialog. Using the Process Menu 5-3 Update filter File: ADDRESS ~ Selecting File and Fields The filter is like the Control Panel filter, except that the File Name Box at the top of the dialog has an upward pointing arrow at its right end. This arrow enables you to display the fields from all the open files in turn. Each time you click on it, the fields from the next open file are displayed in the Field Name Panel below. If you go on clicking, the list of files cycles back to its beginning. Creating the Filter Command Line This is done in the normal way, by clicking on field names and operators, and entering values in the Value Box. Superbase copies the results of your selections into the Main Box below. You can edit the Main Box, but since this increases the risk of errors, you should only do this when you have some experience of the system. The Filter Command Une can contain any combination offield names from the open files, and can have a maximum length of 512 characters. When you are updating one file on the basis of the contents ofanother, you must specify a link between the files: Cust Number.Customers = Cust Number.lnvoices This would ensure that the customer file will only be updated with values from the invoices file when the Cust Number field in a record in the Invoices file is EQUAL TO the Cust Number field in the Customers file. Of course in an example like this, you would probably include other conditions in the Filter Command Une to limit the updating by date or some other factor. Using the Process Menu 5-4 When you have created the Filter you want, click on OK. Superbase then displays the Update Fields dialog. Update fields File: ADDRESS ~ Calculation sepal"atol" The Update Fields Dialog In this dialog, you specify the precise updating actions you want Superbase to perform on certain fields. Typical updating requirements might be • • • Setting a numeric field to zero. Adding transaction amounts to balances. Setting a status indicator field to a new value. Each updating action is defined the same way. An example: Code = "Y" This sets the Code field to the value "Y", irrespective of its previous value. Another example: Balance = Balance + Amount Here the Balance field is mentioned twice. This has the effect of adding the Amount field to the Balance, instead of replacing the old value of Balance with the new value ofAmount. The third example increases the Amount field by ten percent: Amount = Amount'" 1.1 Using the Process Menu 5-5 Creating the Update Fields Command Line You start by clicking on a field name. Superbase copies it into the Main Box, and automatically adds an EQUALS sign operator. Next you click on another field name, or in the Value Box, where you type in the value you want, remembering to press Return as you finish. The maximum length of the Command Line is 512 characters. Using the Colon Separator Each time you enter an update expression, you must set it off from the previous one by clicking on the Colon button. This inserts a colon in the Command Line. If the examples above were all in one line, they would be separated like this: = Code "V" : Balance Amount * 1.1 = Balance + Amount: Amount = Completing the Update Fields Dialog Click on OK to finish the Command Line and initiate the Update processing. Caution In some circumstances the Update option may skip some of the records in the file it is updating. The problem occurs when the update modifies a field which also forms part of the Update filter; for example, it would occur if the Update fields instruction was: Salary = Salary * 1.075 and the Update filter was: Salary> = £12000 The solution is to enclose the filter statement in parentheses, as in: (Salary> = £12000) Using the Process Menu 5-6 An Update Example As this example works with the Deposits file supplied on the demonstration disk, make sure that you are using this as your data disk. Before you can construct an update on Deposits, you need to open the Clients file, and then the Deposits file. The Deposits file shows the details of the bank deposits made by each of the individuals in the file, using a separate record for each deposit. Along with the name of the depositor, it gives the bank name, the type of account, the amount deposited, and various other details such as the interest rate for that type of account. If you browse through the file, you will notice that some types of account are used by several different people. For the purposes of this example, we will assume that the Gloster bank has decided to increase the interest rate on its Share Account. The old interest rate was 7.12%, the new rate is 7.5%. We now need to alter the records for this type of account so that they show the new interest rate. One way of doing this would be to go through the file and edit each record by hand. But by using Update, we can carry out the same task far more efficiently and quickly. The first step is to click on Update Edit. Now construct a filter line (in the Update filter dialog) that will select the records which are to be updated. W e are only interested in records where a deposit has been made in the Gloster Share Account, so the filter line should be: .~ Bank = "Gloster" AND Account = "Share Account" As it happens, the Gloster bank does not provide any other type of account - at least, not in this file - so the second condition in the filter is not strictly necessary; the first condition on it own would be sufficient to pick out the relevant records. But in a real application, a bank might offer a choice of several types of account, so we will let this line stand as it is. Once you have entered the filter line, click on OK. The next step is to specify how the records are to be updated, using the Update fields dialog. In this case, you only want to change one field, Interest Rate. The line to enter in the command line for the Update fields dialog is Interest Rate = 7.5 When you have set up the command line correctly, click on OK. Superbase will then update Interest Rate in each of the records selected by the filter, and save the record on disk. ,-. Using the Process Menu 5-7 You may have noticed that the Annual Interest field in the Deposit file records is linked to the Interest Rate field by a calculation formula. Before saving an updated record, Superbase also recalculates Annual Interest using the new interest rate. This example can easily be adapted to illustrate a multi-file application. The details ofbank interest rates could be stored in a separate file, say a file called "BankRates". If this were the case, you could change the fields command line so that it extracted the new interest rate from the BankRates file. Assuming BankRates used the same field names as Deposits, the line to use would be: Interest Rate.Deposits = Interest Rate.BankRates You would also need to specify a more complex filter line, such as: = Bank.Deposits Bank.BankRates AND Account.Deposlts = Account.BankRates AND Bank.Deposits = "Gloster" AND "Share Account" Account.Deposits = The first part of this line establishes a 'join' between the two files; the second part is the same as before. 5-8 Using the Process Menu Query: the Heart of Superbase Query is the most sophisticated of Superbase's menu options. It allows you to produce formatted output from one or more files, with a great degree of control over both the selection and the presentation of record data. Query is a mUlti-purpose option which has five main areas of application. It is used for: 1. Creating complex filters. In many applications, you may find that you need to retrieve the same set of records over and over again; you may need to check groups of records on a regular basis using the same or similar selection criteria. If you used the Control Panel filter you would have to enter the filter conditions in every session. One of the advantages of using Query is that you can save a Query on disk. 2. Multi-file applications. By setting up a relational link in the Query filter, you can select data from several files at the same time. 3. Reporting. Query provides a wide range offeatures for creating printed reports. You can define a title to appear on each page; you can request totalling, subtotalling, averages, and counts for any field; and you can sort fields into groups according to different criteria. These features can also be used as an adjunct to data retrieval - to provide additional information about the results of a search, such as record counts or field totals. 4. Sorting. Query output can be sorted into any order. Indexing already provides one way of sorting a file, but with the Query facility you can sort records in either ascending or descending order. You can also specify several levels of sorting, using a different field for each level. 5. Output options. The output from a Query can be directed to one offour possible destinations: the screen, the printer, an ASCII file on disk, or a new database file. This last output option lets you create a new database file which combines the data from a number of existing files. Using the Process Menu 5-9 The Query Options There are three Query options on the Project menu, Edit, Load and Save. Note that these are unavailable until a database file has been opened. Query Edit and Query Load present the user with the main Query dialog: Query definition Title I Date I• • • • • • • • • • • • • • • • • In addition, there are four other dialogs attached to the four Query command lines - Fields, Report, Filter and Order. The next three sections describe the Project menu Query options, but they do not explain how to use the Query dialogs. For a full understanding of these and other aspects of the Query options, you will need to read Chapter 11, Using Query. To see Query in action, load one of the demonstration Queries and when the main dialog appears click on OK. Then turn to Chapter 11 for an explanation of how these demos work and how to create your own Queries. Edit Query Selecting Query Edit displays the main Query dialog. If there is already a Query in memory, you can then edit it; or you can use the dialog to create a new Query. There are two ways of editing an existing Query: by clicking in the command lines and typing directly into them, you can edit the Query without leaving the main dialog. If you do this, you must press Return after editing a command line. Alternatively, you can click on the buttons at the left of the command line (the Fields, Report, Filter and Order buttons) and then edit the line in the secondary dialogs. Before defining a new Query, you need to decide which files you want the Query to work with. You can quickly check which files are open with System Status System. If necessary, close any files which are not needed, and open any which are, using the Open File and Close File options on the Project menu to do this. 5-10 Using the Process Menu Note that you only need to open files when you create a new Query. Superbase automatically opens any database files associated with a Query, when it loads the Query from disk. You can also output either the open fields for the current file or a set chosen just for the Query. If you want to use the currently open fields, you must select the set you want before you select Query. Use Project Open Fields to do this. Once you have done this, selecting Edit presents you with the main Query dialog. Chapter 11 explains how to proceed from there. Query Load Select this option to load a Query from disk. A file dialog will appear, with a list of the Query files on disk, and you can then select a file in the usual way. Once it has loaded, you will be presented with the main Query dialog. Click on OK if you want to run the Query and see the results on screen. For details of the other output options, see Chapter 11. Query Save Use this option to store the settings from the current Query dialog. Superbase displays a file dialog showing the names of the Query files on disk. If you want to save the Query under a new fIle name, type the name directly into the Selection Box. To save an edited Query under the same file name, click on one of the names listed in the panel above the Selection Box. Along with the Query settings, Superbase stores the details of the database files that the Query refers to. When you load the Query, Superbase will automatically open these fIles for you. Using the Process Menu 5-11 Process Remove This option discards a set of records or all the records from the current file. It uses a Filter, allowing you to specify the conditions under which a record is to be removed. Single records should be disposed ofwith the Remove option on the Record menu. Using Process Remove Select Remove from the Process Menu. Superbase displays the Remove Records Filter dialog. Re~ove records filter File: ADDRESS IQ] lAND I G [}]~D INOT I 0 [] IUKEI [ZJ [8 01< I I Clear I ICancel I The dialog is the same as the normal Filter dialog. See Chapter 1, for a detailed explanation of how Filters work. Example 1: Removing Selected Records In this example we'll use the Address file, so make it the current file if you haven't already done so. Then select Process Remove. Your objective is to remove from the file all the addresses where the Country field has the value "England". Click on Country. Superbase copies the field name into the Main Box. Now click on the LIKE operator. Then click in the Value Box, and type "England" (omit quotation marks). Press Return. Your Filter Command Line should read: country LIKE "England" Using the Process Menu 5-12 If it doesn't then click on the Clear button to clear the Filter, and start again. (If you click on Cancel it will have the same effect, but Superbase will assume you've finished with the Filter and remove the dialog from the screen). When you've got the Filter Command line right, click on OK. Superbase now checks the Filter Command line to see whether there are any errors in it. If you've entered the example correctly there shouldn't be any. Next comes a confirmation dialog, as Superbase does not allow records to be removed with a single action. Click on OK to go ahead, Cancel to abandon the action. Provided you click on OK, Superbase processes the file using the Filter. Superbase automatically removes all the records that match the Filter. The Filter Command line is then cleared out, and Superbase returns to the Main Display. Example 2: Removing All Records We'll explain how to do this, but don't actually go through the steps yourself unless you're sure you want to discard all the records in the current file. 1. Select Process Remove. 2. When the Remove Records Filter appears, click on OK. 3. When the Confirmation dialog appears, click on OK. Superbase will remove all the records in the file by initializing the file. Using the Process Menu 5-13 Process Import This function creates new records in a Superbase database file by reading in data from an ASCII disk file. If your spreadsheet, communications package, or other application is capable of producing an ASCII file on disk, then that file can be loaded into Superbase to give you all the management advantages of the database. Likewise, an ASCII file produced by exporting from one Superbase file can be imported into another Superbase file. In Import and Export operations, the items of data (fields) in the ASCII file are separated by special characters, so that Superbase can tell where each one ends. Likewise, each record is also followed by special separator characters. The default settings for the field and record separators are respectively the comma and the carriage return. However, if the file to be imported uses other characters, you can instruct Superbase to use them through the Set Options dialog. You cannot use Import to move data directly from one Superbase file into another. If you want to do this, use the Query function to output data into a new file. Import uses a Filter to determine which records in the ASCII file will be accepted into the Superbase file. You can import data into a limited set of fields in each record if you open the required set of fields before you do the import. Note: You do not need to use the Import option with files from dBase II and dBase III. Superbase automatically converts dBase files to its own format. For more details, see dBase Compatibility, Chapter 2. Using Process Import Select Import from the Process Menu. Superbase displays the Import Filter. The dialog is the same as the normal Filter dialog. See Chapter 1, for a detailed explanation of how Filters work. Build up your Filter Command Line in the normal way. When you click on OK, Superbase displays the Import File Name dialog. Enter the name of the ASCII file from which the data is to be imported. Using the Process Menu 5-14 IAport filter File: BANK Even though the Filter operates in the same way for Import as for the other Filters, there are a few important extra considerations: • The file into which the data is to be imported is always the current file. • The fields into which data is to be imported must be of the correct type: a numeric field for numbers, a date field for dates, etc. • If you are importing into just the set of open fields, Superbase will create records with the other fields left blank. Index entries for such fields will be made, but they too will be blank. • Superbase will signal an error if Import tries to store a blank field that has Required status. Remove such status temporarily with Pro ject Edit. • Validation checks will be made on all fields in records created by Im port, whether they are being imported into or not. Again, you may need to temporarily remove Validations using Project Edit. 5-15 Using the Process Menu Process Export The function creates an ASCII file on disk as a copy of the data from selected records and fields in a Superbase file. You may have an application that can accept ASCII files. Word processor mailing packages, spreadsheets, and communications packages often can. Also, an ASCII file can be imported into another Superbase file. You can set up your own field and record separator characters in the Set Options dialog, and specify whether quotation marks should be placed around the exported fields (this is necessary ifthe data contains the character used as a field separator; for example, addresses, dates or numbers may contain commas). You cannot use Export to move data directly from one Superbase file into another. If you want to do this, use the Query function. Export can only process a single file, so if you need to Export data from more than one file, you should use Query first to combine the data into one new file. Export uses a Filter to determine which records from the Superbase file will be copied to the ASCII file. Using Process Export Select Export from the Process Menu. Superbase displays the Export Filter. Export filter File: ADDRESS I::] B2J II] II] IB [8 [I] IT] Value OK lAND I G 00 0 INOT I 0 ILIKEI [I] Using the Process Menu 5-16 Build up your Filter Command Line in the normal way. When you click on OK, Superbase displays the Export File Name dialog. Enter the name you want to give to the ASCII disk file. We suggest that you adopt a convention for naming Export Files, such as ending each name with the extension' .exp'. Superbase then processes the database file, checking each record to see whether it matches the conditions set up in the Filter. If it does, Superbase creates a copy of the data in the currently open fields and adds it to the Export File. I I I I I Process Print The Print option provides a quick and easy way of obtaining a printout from the current file. The function outputs the currently open fields in the column format set for Table View. It uses a standard Filter. N ate: If you are using Superbase with DOS-Plus make sure that your printer is connected and is on-line before you commence any printing. Using Process Print Select Print from the Process Menu. Superbase displays the Print Filter. Print filter File: ADDRESS OK I I Clear I ICancel I The dialog is the same as the normal Filter dialog. See Chapter 1 for a detailed explanation of how Filters work. I I I I I Using the Process Menu 5-17 Build up your Filter Command tine and click on OK. Superbase prints out the records that match the Filter. Certain print formatting conventions are observed: • The field names appear as column headings, separated from the first line of data by a blank line, on each page. Process Mail Merge Using Mail Merge, you can generate a large number of personalized letters from a single Text editor document. Each letter will be based on the same 'form' letter which you have created in the Text Editor, but the names and addresses will be inserted from a Superbase file which holds a mailing list. Prerequisites Two things are required before you can print out letters with Mail Merge. First, you need to create the form letter which will be merged with these names and addresses. Second, you need a file containing the names and addresses of all the people who are to receive a letter the targets of your mailing. Creating a Form Letter You create a form letter using the Superbase Text Editor. In appearance, it will be like any other letter except instead of actual names and addresses it will contain field names. The procedure is as follows: 1. Open the Text Editor window. 2. Open the Superbase file containing names and addresses. Alternatively, ifyou prefer to use the Text Editor over the whole screen, make a note of the field names in the Superbase file. Then click on the full screen gadget at the top of the Text Editor window (on the Amiga, resize the window). 3. Type the field names which refer to the individual parts of the name and address into the Text Editor document. The field names should be positioned on the page at the points where the name and address will appear. Place the & character at the beginning and end of each field name. This character acts as a delimiter. It tells Superbase that the word it encloses is a field name, not text to be printed. 4. Type the rest of the letter, the part that will remain the same for everybody in the mailshot. 5. Save the letter as a Text Editor document. Using the Process Menu 5-18 Steps Three and Four can in fact be performed in reverse order. If you wish, you can write the letter and insert the field names later, or as you go along. The first part of the letter might look like this: SStl"eetS &City& &Post CodeS July 26th 1988 Precision Software 6 Park Terrace Worcester Park Surrey KT4 7JZ li~ted Dear &Title& &lastnaMe&, Ma~ we reMind you to co~lete your User Registration Card ano return it to Precision SoFtware at the above address. As a registered user, you will be eligible for free soFtware support. In this example, we have used Precision Software's address for the letter heading. You would enter your own address here, or, if you were using paper with the letter heading already printed, you would leave a blank. When you run Mail Merge, the letter heading and the rest of the text will remain as they are but the field names will be replaced by the contents of the fields. I I Superbase also lets you insert the system date or the system time in a document. So instead of: July 26th 1987 you could enter: I I I &Today& Setting the Print Style The contents of a field can be printed in any of the Text Editor's style options bold, italic or underlined. To do this, set the print style for the field name and its delimiters (the ampersand characters enclosing the name). Select the style you want from the Style menu, then type in the field name and its delimiters. For instance: I I I I I Using the Process Menu 5-19 Dear &Title& &Lastname& would produce a letter to a Mr Smith that started like this: Dear Mr Smith Fixed Length You may want to layout a form letter in such a way that the contents of a field always start in the same column on the page. Normally, if a letter has two fields on the same line, the second field may be printed in a different position in each letter, depending on the contents of the first field. The fixed length option lets you set the length of the first field. By doing this, you can ensure that the contents of the second field are always printed at the same position. If the contents of the first field are shorter than the specified length, Superbase inserts spaces (if they are longer, it truncates them). You set a fixed length for a field by typing minus signs between the end of the field name and the second ampersand. The length is specified by the number of characters from the first ampersand to the second ampersand. For example: &Firstname----& &Lastname& The fixed length for the Firstname field is 15 characters. If the contents of this field are printed at column 1, the last name will always be printed at column 17, no matter how long or short the first name is. Other Mail Merge applications Mail Merge does not restrict you to names and addresses. This is simply the most common mail merge application. Any field name may be used and it may be placed anywhere in a document. You could create a form letter which said: We would like to remind you that payment on the invoice dated &Date&, for the sum of &Amount&, is now 60 days overdue. In this case, though, the fields Amount and Date would have to be present in the same file as the name and address fields. It is possible to use field names from more than one file, provided the file name is given as well as the field name. However, when the letters are printed, Superbase will only select records from the current file. The current record in another file will stay the same and a field from this file will print the same data in each letter. Using the Process Menu 5-20 Nonetheless, there are some circumstances in which Mail Merge's multi-file capability can be useful. Suppose your company was sending out letters in batches, where each batch included all the customers in a particular area. By using the file Dealers you could give each customer information about the dealer in their area. The form letter would include the line: The dealer for your area Is &Name.Dealers&, &Address.Dealers& To do this, you would need to select the required record from the Dealers file before printing each batch of letters. Fields may also be repeated in a letter. A typical application for this feature would be to emphasise a point by repeating the subject's name. For example, in advertising a product: Yes, &Title& &Lastname&, a brand new, totally automatic cocktail mixer can be yours for only £8.50 a week. Running Mail Merge The procedure for printing letters using Mail Merge is as follows: 1. Switch on the printer. 2. Open the database file containing the data which is to be inserted in the form letter. 3. Select Text from the Project menu and then open the text file containing the form letter. 4. Return to the database by clicking in the database window. 5. Select Mail Merge from the Process menu. 6. You will be presented with a filter dialog. Set the filter conditions for the current database file. (This is explained in more detail in the next section.) 7. When you click on OK, another dialog will appear: Output to printer? DD~ 8. Click on OK again to start the Mail Merge operation. Using the Process Menu 5-21 The third step in this procedure is, in fact, optional. If you have not already opened a text file, you will be presented with an Open File dialog when you click on OK in the filter dialog. Mail Merge takes data from the records specified by the filter. It starts with the first record in the current index sequence. It replaces the field names in the form letter with the data from the corresponding fields in the record. It prints the letter and then fetches the next record. This process is repeated one letter for each record until the last record has been merged with the form letter. Setting the Mail Merge filter You can use the Mail Merge filter to specify which records are to be used. If you leave the filter line blank, Mail Merge will print a letter for each record in the file. Mail Merge presents you with the standard filter dialog, and you build up your filter command line in the usual way. Here are some examples of a Mail Merge filter line: Date> "25 July 1986" AND Date < "25 August 1987" This line selects all the records where the date field falls between these two dates. If you were a club secretary, you might use a filter like this to send letters to people who had not paid their subscription fee. Lastname LIKE "S*" This filter instructs Mail Merge to print letters for all the people in the file whose names begin with S. Previewing Mail Merge Mail Merge allows you to preview letters on screen before committing them to print. This enables you to see what the letters will look like when the names and addresses have been inserted in them. The Preview option is selected at the stage when the Output to Print dialog appears. Clicking on Cancel instead of OK causes Mail Merge to output letters to the screen. Preview displays each letter in turn, from the first letter onwards. If you set Paging on, it will pause between letters. Click on the Pause button or press the Space Bar when you want to move on to the next letter. Using the Process Menu 5-22 Click on the Stop button or press CIRL C to bring the process to a halt. Otherwise, Mail Merge will preview all the letters that have been selected by the filter. If you intend to print a large number of letters, previewing all of them may take some time. Notice that letters are reformatted after the record data has been inserted. This means that the contents of a field may move the text which is on the right onto to the next line. As a result, text on the last line of the page will be moved to the start of the next page. Process Labels You can print mailing labels up to four across using this option. You can control the dimensions of the label, as well as the number of fields per line. Labels uses a standard Filter. Only the open fields from the current file are printed on labels. Using Process Labels Select Labels from the Process Menu. Superbase displays the Labels Filter dialog. The dialog is the same as the normal Filter dialog. labels filter File: ADDRESS When you click on OK. Superbase displays a dialog to specify the shape and content of the labels to be printed. 5-23 Using the Process Menu label definition Fields per line line 1 line 2 line 3 line 4 line 5 line 6 line 7 line 8 line 9 line 10 Test I 0 0 0 0 0 I!I iii iii iii iii I label diAensions 0 1m D II 0 f:I First label Aargin label text width Second label nargin First line next label Copies per label labels per line ~ Increase [Y] Decrease 1Single I I OK IICancel I The dialog has three parts. On the left is a panel in which you specify the number of fields per line on the label. To the right are a number of boxes for input of dimensions and other parameters. Below are some extra control buttons in addition to the usual OK and Cancel. Fields Per Line Superbase uses the Open Fields List if there is one to determine which fields are to be printed in which order. The number of fields per line varies from one to four, and you can have up to ten lines of data per label. You select the number of fields like this: 1. Click on one of the boxes in the left hand panel. This represents one of the ten possible lines of the label. 2. Click on the up arrow gadget to increase the number in the panel, or the down arrow to decrease it. If you don't want any fields to appear on a specific line, set it for zero fields. If Super base finds a blank field in a record, it compensates by closing up the label lines. Using the Process Menu 5-24 A typical Open Fields List is this: The actual label format is this: Title Firstname Surname Address City State Code Title, Firstname, Surname Address City State, Code You should arrange the Fields Per Line panel like this: 3 1 1 2 o o o o o o Superbase automatically inserts a space between fields when there are mUltiple fields on a line. Label Format I Save Format To alter any of the settings, click in the box to select it, and then click on the up or down arrows as required. After defining a new label format, you can save it as a default setting in the parameters file. To do this select Options from the Set Menu, then click on OK. First Label Margin This controls the first printing position for the left-hand column of labels. You may have to increase the Second Label Margin before increasing the First Label Margin to ensure that you leave enough room for the label itself. Using the Process Menu 5-25 Label Text Width This measures the overall width of the label in characters. Superbase won't let you make it overlap the Second Label Margin. Second Label Margin This controls the first printing position for the second column of labels. Superbase won't let you decrease it to overlap with the first label. First Line, Next Label This sets the interval between labels, by specifying the line on which the first field of the second row of labels is to appear. Labels Per Line This enables you to vary the number of labels you want to print on each line. This can vary between one and four. Copies Per Label You may specify up to 99 copies of each label. Test Button The label format can be tricky to get right, especially if you're using a non-standard size. We have provided a special test function to help you avoid frustrating errors in the actual print run. When you've set up the label format and fields, align the labels on the printer. Now click on Test. Superbase prints two rows of labels, using the "X" character to show exactly where the fields will print (it doesn't separate multiple fields on a line). You can alter the format values and repeat the test as often as you wish. Using the Process Menu 5-26 Single This is a convenience feature. To save you effort, Superbase allows you to print a 'one-off' label or envelope from the current record. 1. Select the record you want as the current record. 2. Select Process Labels, and click on OK. 3. On the Label Definition dialog, click on Single. Superbase prints the open fields from the current record according to the settings on the Label definition dialog. You may need to reset the First Label Margin to get a correct result on an envelope. CHAPTER 6 TUTORIAL: THE PROCESS MENU OPTIONS This exercise takes thirty minutes to complete and takes you through all the single file processing options on the Process Menu except Mail Merge (it does not cover the two multi-file options, Update and Query). The objective is to make you familiar with the way these core processing functions work, so that you can start to see how you can apply them to your own database. First, you will create a new file, so that you can Import data into it. Then you will Export data from the Address file (which is supplied on your disk) into a temporary file. Next, you Import this data into the file you have created. Then you can Print some of the imported records and Labels for them. And finally, you will remove all the records from the new file. Creating a New File This file will be used to import records later on in the tutorial. The process of setting up a file is pretty easy, and you should have had some practice by now. So we'll skip the details - if you need to refresh your memory you can check the Thirty Minute Tutorial in Chapter 3. The name of the new file is New-Adds. Select New File from the Project menu and type in this name. The Password dialog will then appear. Enter a password if you want, but keep it simple as you'll have to use it the next time you open the File. If you don't want to enter a password, click on Cancel. When the File Definition dialog appears, add the following fields, all of text type: Create the Title field by typing its name in the Field Box, then clicking on the Text button to check that its length will be 20. After exiting from the Field Length dialog, click on the Add button to add Title to the File Definition Panel. Tutorial: The Process Menu Options 6-2 Create the other fields by simply typing in the field name and clicking on Add. Reselect Street and click on Text so you can increase its length to 30. When the fields are correct, click on OK to finish the definition process. Index the new file on Lastname and City. Save the File Definition. Later you will import data into this file. Opening the Address File Now you must open the Address file, which is to be the source for the data to be exported. Select Open File from the Project menu, and click on Address, then on OK. Export from the Address File You are going to create a disk file that contains a copy of some of the data in the Address file. You'll use a Filter to specify which records are to be exported. The other choice you can make in Export is which fields to export. Superbase will use an Open Fields List if there is one, so you must select the Open Fields option from the Project menu. Do this now. Select the following fields: Title Lastname Street City Code Click on OK. Notice that you have only opened some of the fields in the Address file, and that these do not correspond exactly to the fields in the New-Adds file. This is intentional, as we want to illustrate the ability to use an Open Fields Ust for Import as well as for Export. Exporting Data from Address Select Export from the Process Menu. Superbase displays the Export Filter dialog. Click on Lastname, then on UKE, and then click in the Value Box. Type in this: ''[A-G]*'' (omit quotation marks). Press Return. The Filter Command Une in the Main Box should read: Lastname LIKE n[A_G]*n Click on Clear if it's wrong, and repeat the actions described above. Tutorial: The Process Menu Options 6-3 This Filter means Superbase will only Export those records whose Lastname begins with the letters A. B, C, D, E, F or G, irrespective of how many characters are in the field. Naming the Export File Once you've created this Filter, click on the OK button. Superbase requests a name for the Export rue. Type in "Add.exp". Click on the OK button. Superbase will now select the records from the Address file, and Export them into the Add.exp rue . .~ If Superbase displays a dialog telling you that the "Add.exp" already exists, perhaps from a previous run through this exercise, you can either click on OK to overwrite this file with the new one, or click on Cancel, to abandon the Export. Viewing the Contents of Add.exp The next step is to look at the contents of the Add.exp rue to see what an Export File looks like. Select Ust from the System Menu. Superbase shows a dialog with a list of rue names. The name of the temporary rue will be towards the beginning of this list, so click on the downward facing arrow - if you have to - until the name Add.exp appears. Once it appears move the pointer into the box and click on the name to select this file. Click on OK. Superbase now displays the contents of the file, and you will see that the data is ordered into Title, Lastname, Street, City and Code. The fields are separated with commas. The Lastnames are in the range A-G. This confirms that the Export has worked as planned. If it hasn't, go back and repeat the procedure. You should also check the Set Options dialog and ensure that the Import/Export separators have been set correctly. For Gem versions of Superbase, the Field separator value is 44, and the Record separator values are 13 and 10; on the Amiga, the Field separator value is 44, and the Record separator value is 10. Tutorial: The Process Menu Options Importing Add.exp into the New-Adds File Before you can Import you must open the file that is to receive the new records. Open the New-Adds file from Project Open File. Now you must ensure that only the correct fields have been opened. Select Project Open Fields, and open these fields: Title, Lastname, Street, City and Code. Make sure you've opened them in the right order. Click on OK. Next, select Import from the Process Menu. Setting up an Import Filter Although you exported all the records where the Lastname began with a letter from A to G, you are only going to import a selection of them. When you see the Import Filter, if the Main Box already has a Filter Command Line in it, click on Clear to remove the line. Then click on Lastname, then on LIKE, then in the Value Box. Type in: [A-D] *fl. Press Return. Your Filter command Line should read: !I Lastname LIKE "[A_D]*" This means we want Superbase to accept only those records where the Lastname starts with A, B, C,or D. It will reject any record in Add.exp where the Lastname begins with E, For G. Once you've entered this Filter correctly, click on OK. Superbase displays the Import File Name dialog, into which you type "Add.exp". Then click on the OK button. Superbase now imports the records that match the Filter into your New-Adds file. Checking the Contents of New-Adds Now you can view the contents of New-Adds with the Control Panel buttons. Click on the First Record button. Then Click on Fast Forward, and the records will be displayed. All the data items from Add.exp should have been placed in their correct fields. In Table View, the records should look like this: '---'.. 6-5 Tutorial: The Process Menu Options ~ Project Record Process Set SysteM I Superbase: NEW-ADDS indexed on lastnaJlle arnaula Broonen Buchanan Cellers Dahlen Dale Duplex r r r s r s .du -"tune 83 Digue du Canal 306 Klrkbridge Street 16 Hi~h Street 2254 olorado Blvd 1105 ColeJllan Avenue 6 Rue des Uosages ~~ ~venue SBP • .). f arlS Brussels ~~ Auckland FreJllantle los Angeles San Jose MarckolshieM lolA CA CA 67 , :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::1. I" Printing Records from New-Adds Now you're going to use the Process Print option to obtain a printout of the some of the records in New-Adds. Before you do this, you should drag the open fields of New-Adds closer together to fit them all onto the page, if you've not already done so. Move Lastname right up to Title, and then move Code closer to City. The screen should look like this: ~I Project Record Process Set SysteM Superbase: NEW-ADDS indexed on LastnaM"e " r r r s r s Drnaula Broonen Buchanan Cellers Dahlen Dale Duplex " H avenue.au.Mune 83 Digue du Canal 306 Klrkbridge Street 16 Hi~h Street 2254 olorado Blvd 1105 ColeMan Avenue 6 Rue des Uosages ~arls Brussels Auckland FreMantle los Angeles San Jose MarckolshieM SBP .. " &~m9 • ). lolA 6169 CA 90941 CA m9S 67390 , ~ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::1 • I" Tutorial: The Process Menu Options Setting Up a Print Filter Select Process Print. The previous Filter Command Line should be in the Main Box. If it isn't, repeat your previous selections to obtain it. Now you can do some direct editing. Click in the Main Box. and then carefully edit the last part of the Line, using the Backspace key to delete the "0", and typing a "C" in its place. The Line should look like this: Lastname LIKE n[A-C)*" Don't forget the final quotation mark. You have narrowed the Filter down, so the only records to be printed will be those where the Lastname begins with A, B, or C. Once you've entered this Filter correctly, click on OK. If you made a mistake in editing the Filter Command Line, Superbase will give you a chance to correct it. If you want, click on Clear, then build up the line from the beginning as you did for the other dialogs. Superbase now prints the records that match the Filter in a Table format that corresponds to the column positions you set up earlier. Labels The next part of this tutorial involves printing some labels from New-Adds using the Label Filter and the Label Definition dialog. Ordinary paper is fine for allowing you to see the way the label output is formatted. If you have some mailing label stationery, you can set it up in the printer, but the instructions below may not be quite right for your size of label. Selecting Labels from the Process Menu Move the pointer to the menu bar and highlight the Process menu, select Labels. You can use the same Filter Command Line as you did for Print, so when the Labels Filter appears, just click on OK. Tutorial: The Process Menu Options 6-7 Label Definition Dialog Once you've done that, Superbase shows the Label Definition dialog. Set up the Fields Per Line panel to show these values in the first four lines: 2 1 1 1 The rest can be set to zero. You set a value by clicking on the box you want to change, and then on the up or down arrow to increase or decrease the value in the box. Now click on the Labels Per Line box, and set it to "2". Leave the other settings as they are. Your dialog should look like this: Label de~inition Fields per line line 1 HI line 2 U Line 3 U Line 4 U Line 5 I!I line 6 I!I line 7 I!I line 8 I!I line 9 I!I Line 10 I!I Test Single '-~. I II Label diMensions First label ~argin label text width U Second label Margin U First line next label U Copies per label HI . labels per line ~ Increase ~ Decrease U U I OK II Cancel I Before printing the labels, do a label alignment test. Click on the Test button. You'll see two rows of labels, two columns each, appear on the printer. When you're all set, click on the OK button. Superbase prints labels for the records that match the Labels Filter, then returns to the Main Display. If the output is not as expected, check that the right fields have been opened in the right order and that the margins are set correctly. Remember that the Test option is there so you can experiment freely. Tutorial: The Process Menu Options Removing records from the New-Adds File The final exercise in the tutorial is removing records from the New-Adds file. Select Remove from the Process menu. You are going to remove all the records from the file, so when you see the Remove Records filter, click on Clear to clear out the Main Box, and then click on OK Superbase displays a dialog to ask for confirmation that you do indeed want to remove records from the file. This action reMoves data frOM the file. Do you want to proceed? Ieancd rn I If you're sure you want to delete the records from New-Adds, click on OK Superbase now removes all the records from the file. If you use the Control Panel buttons after the processing has ended, you will see that Superbase cannot find any data to display, as the End ofFile message implies. The tutorial is now complete, and you should open another file if you want to continue the session. CHAPTER 7 USING THE SET MENU The options on this menu affect the way Superbase works. Most are very simple to understand and use. Check Marks Where one of a group of menu items, such as Screen and Printer, has a check mark against it to indicate that it's currently selected, you can switch the check mark to another item quite easily. From the Set Menu, select the menu item that does not have the check mark against it. This action removes the check mark from the other menu item and places it against the selected item. You can now check that this is so by re-selecting the Set Menu. Note: Depending on the computer you are using, the check mark will either be a tick or a triangle. Output Device Screen This is the default output device for Superbase. All output appears on the screen unless you switch to the printer. On Gem versions of Superbase, you can do a screen dump of a Superbase screen using the Desktop accessories Snapshot and Output. Snapshot makes a copy of the screen on disk, Output dumps it to the printer. Arniga owners can use the Screen Dump option on the System menu. Printer ,-" This option permits you to make a printed copy of output which would normally appear on the screen (see Hard Copy Documentation, Chapter 8). Make sure that your printer is connected and is on-line before you commence printing. To print the current record, select Printer, then click on the current record button. Superbase will print the field names and field data as they are positioned on screen. When you have finished printing, select the Screen option in order to turn Printer off. 7-2 Using the Set Menu Views There are three different ways of displaying records: Table View, Form View, and Record View. Only one view mode can be selected at a time and the current View is automatically switched off when you select one of the other two options. Table View Table View is used to display or print records in columns. While you are using Table View to browse through your records the field names appear at the top of the screen, with the data for each field below the name. If the Printer is in use, you will receive a printout of the screen, with the field names printed as if at the top of each screen. While Table View is selected, you can move the columns of data right or left by clicking and holding down the mouse button in the column you want to move, then dragging the column to its new position. There are some rules governing what you can and cannot do: • You cannot move the left-hand column. • All columns to the right of the selected colunm move with it. • After moving a column to the right, you may have to redisplay the data if a column has been truncated. • The current settings remain even if you open a different set of fields for the file. • If you have dragged columns to compress the display, you can restore the true length of a column by double clicking in it. Form View Form View allows you to design your own screens for entering and displaying record data. The first time you select Form View for a new file, the field names are displayed down the left hand side of the screen, with the data for the current record, if there is one, to the right, one field per line. You can rearrange the screen. You do this by clicking on a field name, and, while keeping the button depressed, dragging the field to its new position on the screen. There are a number of rules: Using the Set Menu 7-3 • The worksheet on which the fields can be positioned is 273 columns wide. • The number of lines available is determined by the number of fields in the file definition. • Fields which are not open are not shown. • Paging is automatically switched on. This allows you to scroll the win dow in both axes. • You cannot overlap field names or data areas. You must save the File Definition with Project Save File in order to store the current Form View. Record View Record View is also used to display records on the screen. However, this time the field names appear down the lefthand side of the screen, right-aligned to a fixed point. The data from the open fields for each record is shown in a block. If Paging is off, the record blocks will scroll up or down the screen when you use the Control Panel buttons. 7-4 Using the Set Menu Paging While you are viewing the records within a file you may only want to see just one 'page' at a time. The effects vary depending which of the three Views described above is switched on. You toggle Paging on and off by selecting it from the menu in the normal way. Paging in Table View When Paging is on, Superbase displays a screen of record data, one record per line, until the screen is full. It then selects the Pause button and waits. Click on Pause to see the next screen of data, or another record selection button to perform another action. When Paging is off, Superbase continues until it reaches the end of the file or you interrupt it by clicking on Pause or Stop. Paging in Record View When Paging is on, Superbase displays one record at a time on a screen by itself. When paging is off, Superbase displays the records one after the other on the same screen. Fast Forward or Rewind scroUs through the records until Superbase reaches the end of the file or you interrupt with pause or Stop. (If a record is longer than the screen then on single record selections such as Next Record Superbase scrolls to the last field and stops.) Paging in Form View is always switched on. The Paging function does not affect the printer. 7-5 Using the Set Menu Options Some functions that are carried out by Superbase can be changed to suit your individual preferences. The range of items you can change are shown in the two Options dialogs. The first dialog is presented when you select Options from the Set Menu: Systelll options I Display speed o Auto calculation o Selective calculation II Calculation count IlIIport I Export 9 Field separator ill 0 Record separator Use quotation lIIarks mil 0 I Bu Her count External file query More OK I I IICancel I When you click on the More button at the bottom left-hand comer of the first dialog, Superbase displays the second Options dialog: Start directory path \sbase\jbar ParaMeter file path Telllporary file path 1$9,999.001... IDecilllal point fO/"lllat 1..-1 £ 1...1Currency sylllbol "'-""'O"""K---. I Cancel I Amiga owners will notice that the second Options dialog looks slightly different on their machine: below the Currency symbol, there are three extra items, a box for entering a Printer Initialization Sequence, and two selection buttons for Print Raw and Custom Screen. These features are described in a later section in this chapter. Using the Set Menu 7-6 Whenever you click on OK in either of these dialogs, Superbase stores your preferences in a file called 'sb.par' (on the Amiga it is called 'Superbase.par'). This file contains a set of parameters which are used in various Superbase functions. The next time you run Superbase, it will set the preferences you have specified in the '.par' file. In effect, this allows you to personalize Superbase so that it is always set up in a way best suited to your requirements. The '.par' file can be viewed with System List, and contains the following parameters: Currency symbol Currency separators Decimal point format Default number format Default date format Superbase system Date Import/export field separators Import/export record separators Import/export quotation marks Printer defaults (Gem only) Printer initialization sequence Start directory Parameters directory Temporary file directory Labels format Buffer count Auto calculation/selective calculation Calculation count Some of the parameters in this list are not set in the Options dialog. Thus, the Labels format is defined with the Process Labels options, but it is stored with the parameters file. Similarly, the default number and date formats are set using their respective Set menu options. Direct editing of this file is possible and does allow you to specify your own currency symbol ofup to four characters. However, an invalid parameter file will cause Superbase to shut down on start up. Using the Set Menu 7-7 Display Speed The first item that you can change is the display speed. This controls the amount of time that a record or picture is displayed on the screen before the next one is displayed. The feature is used in two situations: • When scrolling records in Table View or Record View, in either Fast Forward or Rewind direction. • When External Files are being displayed in Fast Forward or Rewind direction, or in a Query. To alter the display speed simply move the pointer and click on the vertical bar. You can then drag the bar to the left to make the display speed slower, or to the right to make it quicker. The default speed setting is the fastest. Calculation Options These options are used to set the number of times a calculation is performed, and to specify when fields are calculated. The section on Linked Calculations, Chapter 2, explains why it is sometimes necessary to repeat calculations. If your files do not contain any linked calculations, you can ignore these options. Auto Calculation The Auto Calculation feature enables you to specify that calculations are performed after every data entry; that is, whenever you press Return after entering data in field. The number in the Calculation Count box specifies how many times the calculations are performed. Thus, if the Calculation Count is 3, the calculations are performed three times. To select this feature, click on the Auto Calculation button. Selective Calculation When this option is selected, Superbase only performs a calculation if the field ( or fields) which the calculation refers to has been modified. Calculation Count Use this option to set the number of times calculations are performed. Enter the number in the box and press Return. 7-8 Using the Set Menu Import/Export You can specify the characters that are to be used to separate fields and records from one another when you are Importing or Exporting. Up to two characters can be used for each kind of separator. Characters are specified by typing in the ASCII code that is equivalent to the character you want to use. To enter a two character separator, type in a comma after the first character, then type in the ASCII code for the second character. On the Amiga, the default values are 44 (the comma) for the field separator, and 10 (the line feed character) for the record separator. Gem has the same default value for the field separator, but uses two characters as the record separator, 13 (the carriage return character) and 10 (the line feed character). A list ofASCII codes is provided in the Appendices at the rear ofthis manual. If you want to change the default values move the pointer and click in the box. This will produce the cursor and you can then type in the new ASCII code. Remember to press Return to register the change. Warning: Do not use the same characters for both the field and the record separators. Quotation Marks Fields may contain punctuation marks such as commas. This can cause problems, as any character that is the same as the Field Separator character will be treated as such unless it is enclosed in double quotation marks. This option allows you to specify that every field Exported will be enclosed in double quotation marks. To switch this feature on, click on the button next to the option. To switch it off, click on the button in its selected mode. Superbase automatically discards double quotation marks around fields when it finds them during an Import. Buffer Count This option varies the amount of memory Superbase uses to store record data. Increasing the number of buffers cuts down the number of times Superbase accesses the disk drive, and so increases the speed of the program. However, a very large number of buffers gives Superbase more work to do checking their contents in certain operations, and so slows the system down. Each buffer requires 512 bytes, so the total memory allocated to buffers can ..~. Using the Set Menu 7-9 soon mount up. It's best to compromise: the recommended number to use is between 10 and 20. External File Query This feature applies to the Query option on the Process menu. If External File Query is OFF and you output an External File Field as part of a Query, you'l1 see only the textual content of the field: the name or pathname of the external file. However, ifyou set this feature ON and then output an External File Field in a Query, you'll see the contents of the external file, as if you were doing a Fast Forward. Start Directory This option allows you to specify which directory will be the current directory when you start a session with Superbase. If you do not specify a start directory, you will start in the same directory as you were in when you loaded Superbase. You will use this option if you store your data files in a different directory from the Superbase directory. If you specify the data directory as the start directory, the files it contains will be available as soon as Superbase has loaded. To specify the start directory, enter the path name for the directory. For example: \Sbase\sbdata /Sbase/sbdata This line instructs Superbase to start up in the sbdata directory, which is a subdirectory of the Sbase directory. B: DFO: This specifies that the start directory is on the disk in drive B (or drive 0 on the Amiga). 7-10 Using the Set Menu Parameter file path The parameter file path specifies the directory where the '.par' file is stored. There are three rules governing the way Superbase handles the parameter file: • When you load Superbase, it loads the '.par' file from the current di rectory (if it is there). • When you set one of the parameters in the two Options dialogs and click on OK, Superbase saves the '.par' file in the directory specified in the Parameter file path box. If a file path has not been specified, it saves the '.par' file in the current directory. • When you change the directory, Superbase searches the new current directory for a '.par' file. If it finds '.par' file, it loads it into memory, and resets the parameters accordingly. This option gives you the ability to create multiple parameter files, one for each set of requirements. Temporary File Path There is only one situation in which you need to be concerned about the temporary file path: when you are using the Query Order command to produce sorted output. Normally, Superbase sorts data using an area of the computer's memory. But if there is not enough available memory space, it sorts the data on disk. For this purpose, it creates a temporary file, which it uses as a work area. Typically, a temporary file would be needed when a large number of records are being read in order to produce sorted output. You can use this option to specify the directory in which Superbase will create the temporary file. This would be necessary if there is only a small amount of disk space left on the current disk. You would then enter the path name (or drive specifier) for the disk in another drive. Decimal Point Format This option enables you to change the format of decimal numbers as they appear on the screen. It is also used to set the position ofthe currency symbol. You can specify either that the currency symbol appears at the front of a number (leading) or that it appears after a number (trailing). There are three decimal number formats. Combining these with the two currency formats, gives you six choices: Using the Set Menu • • • • • • 7-11 $9,999.00 (default value) $9.999,00 $9999,00 9,999.00$ 9.999,00$ 9999,00$ To change the format simply click on the arrow to the right of the box. The display changes to show a different format. Repeated clicking on the arrow cycles through the six options. When you click on the OK button, Superbase will use your chosen format to display decimal numbers. Currency Symbol This allows you to change the currency symbol for numeric fields whose format includes a currency symbol. The selection is global you cannot have different currency symbols for different fields, although you can choose to print individual characters as such, e.g. "$". The choices are as follows: £ $ DM F Fr. Pt ¥ DKr Kr SEK os mk Drs L G R TL Pound Dollar Deutschmark Franc French Franc Peseta Yen Danish Krone Krona/Krone Swedish Krona Austrian Schilling Finnish markka Greek Drachma Italian Lira Guilder Rand Turkish Lira In order to change from one symbol to another, simply click on either the left-hand arrow or the right-hand arrow which are at either end of the currency box. You can cycle through the sequence 'downwards', but not 'upwards' past the dollar symbol. 7-12 Using the Set Menu Printer Initialization Sequence (Amiga only) With this option, you can define a sequence of commands which will be sent to the printer before printing starts. This would allow you to select a variety of print modes, e.g. Bold and Emphasized. To enter a printer intialization sequence, click in the box to activate the cursor; then type in the printer commands as a sequence of numbers separated by semi-colons. Print Raw (Amiga Only) Normally, any output to the printer has to pass through the Amiga 'printer device'. Depending on the printer driver you have selected (using the Amiga Preferences), this may have an affect on the output - it may be set up to translate certain character sequences into other character sequences. Print Raw allows you to bypass the printer device. When this option is selected, output is sent directly to the printer, without intervention from the Amiga. Custom Screen (Amiga Only) By default, Superbase opens its windows within the Workbench screen. If you select the Custom Screen option, Superbase will make use of a separate screen. Usually this has the advantage of speeding up the rate at which windows are displayed. The time taken to open a window depends on the number of windows that are already present, even though some of them may not be visible. The more windows there are, the longer it takes to display a single window. In the Workbench screen, several other windows may have already been opened as well the Superbase windows. By selecting Custom Screen, you reduce the number of windows that can be present at anyone time. However, if you close the Workbench windows after loading Superbase, you will achieve the same display rate as with the Custom Screen. There are two points to note in connection with Custom Screen: • Once it has been selected, this option will not take effect until the next time Superbase is loaded. • The Custom Screen requires extra memory, so it should not be se lected unless the computer has more than S12K Ram. Using the Set Menu 7-13 Number Format The range of different number formats is described in Chapter 2. The data in a numeric field is always displayed in the number format that was set in the file definition. The purpose of providing an additional Number Format dialog in this menu is to allow you to set the format for a derived number. A derived number is the result of a mathematical expression, involving numeric fields, functions, or values. An example would be: Quantity * Price. Derived fields can only be output as part of a Query. Date/Time Uke Number, the different date and time formats are described in the section on creating a new file. Similarly, the purpose of this dialog is to allow you to set the format for a derived date. A derived date is the result of a mathematical expression, involving date fields, numeric fields, functions, or values. An example would be Meeting Date + 15. A date can also be derived from an expression which includes the system variable TODAY, as in: TODAY - Date. Derived fields can only be output as part of a Query. The same considerations apply to derived times. If you want to include the current time in your Query output, you can enter the system variable NOW as a derived time. The time will then be displayed in the format specified in the Daterrime dialog. j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j CHAPTER 8 USING THE SYSTEM MENU The options on this menu are utilities for improving your understanding and control of your Superbase database. Printer Options (GEM only) This dialog enables you to define the paper types, paper sizes and printer initialization sequences that you will be using with your printer. Selections are made by clicking on the appropriate button. This causes the button to be highlighted. The dialog is divided into five areas. The first area "Paper Type" allows you to set your paper type. This can either be Fanfold or Single Sheet. The second area "Paper Size" enables you to set your paper size. This can either be Narrow Tractor, Wide Tractor, US Letter or US Legal. Narrow Tractor is 80 columns by 60 lines; Wide Tractor is 132 columns by 60 lines; US Letter is 80 columns by 60 lines; and US Legal is 80 columns by 78 lines. The third area "Custom" enables you to define your own paper size. You do this by defining the number of columns and lines that will fit onto your paper. Simply click in the value boxes and enter the number of columns and lines. The fourth area "Printer Initialization Sequences" allows you to define a sequence of commands which will be sent to the printer before printing starts. This would allow you to select a variety of print modes, e.g. Bold and Emphasized. These commands must be entered as a sequence of numbers separated by semi-colons. Using the System Menu 8-2 Hard Copy Documentation You can obtain a printout from certain system options by switching the Printer option on from the Set Menu. Printable options are: Directory List Status File Status System List Version (Amiga Only) This displays the Copyright Notice and Program Credits. It also includes the Version Number of your copy of Superbase. If you need to request software support, be sure you cite your version number. Directory List This produces a listing of the current directory, in sorted order. The name of the directory and the date are also given. Change This enables you to change from one directory to another, or from one disk to another. Superbase will display a dialog which lists the current directory's subdirectories, i.e. the directories on the next level down in the directory hierarchy. To change to another directory on a lower level, click on the directory name, then on OK, or double click on the name. On GEM versions of Superbase, if you want to go to the directory on the next level up (sometimes known as the 'parent' directory), select ' ..', which will be the first item on the directory list. On the Amiga. you select the directory on the next level up by typing '/'. To change to another disk - a disk in another drive - type in the drive name, then press Return or click on OK For example, if the current drive is C (DHO), you would enter A: DFO: to change to the disk in drive A (drive 0). Using the System Menu 8-3 Superbase accepts pathnames, so you can also switch to a directory on another branch of the directory 'tree'. Remember that you have to type in the full pathname, giving the path from the root directory to the target directory. Note: You should close all open files before changing to anotherdrive orbefore changing the disk in the same drive. Status File This option provides a snapshot of the status and statistics of the current file. Statistics include: current index, number of records, number of fields, number ofindexes, block size and file size. Also detailed are the field names, attributes, format, and Form View co-ordinates for each field, and any calculation or validation formulas. Finally, you can see whether a password has been set, the type of read/write privileges for the file, and the file's valid/invalid status. System This provides a summary of the data described above for all open files, but excluding statistics for the individual files. Additional data is shown for these items: Amount of free memory, amount of free disk space, current directory, number of files open and the number of files available. Free Memory and the External File System Ifyou have difficulty in displaying the pictures or text files from the External File System, or you are having difficulty performing multi-file sorts, please refer to Appendix H. 8-4 Using the System Menu List The purpose of Ust is to allow you to view Ascii text files, such as Export files, '.sbd' files, or Query files ('.sbq' files). You cannot use it to view program files, database files, or text files which contain control characters. This last category includes text files created in the Superbase Text Editor ('.sbt' files). When you select Ust, Superbase displays a dialog which lists the files for the current directory. You can then pick the file whose contents you want to view. As Superbase displays or prints the contents of the file it ignores tab characters. If the file contains non-printable characters (such as control characters), Superbase will display a "Can't do this" message and stop the display. Reorganize When you delete records from a file using the Record Remove option, Superbase does not actually remove them from the disk. Instead it simply marks them as deleted records and thereafter ignores them when it carries out file operations. (You can check this by noting the file size with the Status file option, before and after selecting Record Remove.) Superbase will store new records in the space which was occupied by the deleted records. But as far as other programs are concerned, the records are still there and the space is unavailable. If you have removed a large number of records - say, over a long period of time - you may be left with a significant amount of wasted disk space. Removing a large number of records from one file, may also mean that Superbase takes longer to read records from the file. Reorganize builds a new file using the same name, the same file definition, and the same data, but without the deleted records. It allows you to reclaim wasted disk space. Reorganize works with the current file. Once you select this option from the System menu, Superbase asks you to enter the name of the destination file. This is the name under which the reorganized file will be stored. You now have a choice of storing the file in the current directory under a new name or in another directory (under the same name or new name). If you choose another directory (or another drive), you should enter the path name and the file name. For example, to store a Using the System Menu 8-5 reorganized version of the Address file in a directory called DATA2, you would type in: \data2\addreSs /data2/address To store the file on another disk, you also need to enter the drive specifier, as in: a:address dfO:address or b:sbase\newadds df1 :sbase/newadds Note that in the last example, Address will be stored as Newadds. To store Address in a different directory under the same name, it is not necessary to enter the file name; the path name on its own is sufficient: b:sbase\ df1:sbase/ To store the file in the same directory, just enter the new name. Make sure that it is not the same as the current name. There are two points to bear in mind in connection with Reorganize: • This option should only be used periodically and not on a regular basis. Unless you have deleted a large number of records, there is only a small advantage to be gained by reorganizing a file. • Check that there is enough space on the destination disk to accomo date the reorganized file. As a rule of thumb, this should be at least as much as the space occupied by the current file. Using the System Menu 8-6 Using Reorganize for Data Recovery The Reorganize option also be used to recover records after their data has been corrupted; i.e., when an attempt to open a file produces a disk error message. Reorganize steps over any errors it finds in a file and retrieves as many valid records as it can. The records which have been damaged will be lost when the new file is created so Superbase informs the user with the message: New file has different record count There may also be circumstances in which Reorganize canbe used to recover data which could not be accessed before. For example, if you turned off the computer after storing new records in Batch mode, the details of these records would not be stored in the file header. Reorganize rewrites the file header so that the records are included in the new file. In this case, it issues another error message (as well as the one above): Source file size incorrect In header Housekeeping Options The last three options on the System menu are the same as the disk utilities or commands provided by your computer's disk operating system. They are often referred to as housekeeping commands, because they enable you to organize the files on your disks, to keep them tidy. The advantage in using these options, instead of the equivalent DOS commands, is that you do not have to exit from Superbase. All three options present you with a dialog showing a list of all the files in the current directory. Delete Deletes a file from disk. Note the difference between Delete and the Project menu option Remove. Remove deletes the current 'sbf (a database file) file together with its associated 'sbd' file and index files. Delete only deletes one file at a time. Rename Renames a file on disk. When you have selected a file from the list, it displays another dialog where you type in the new name. Using the System Menu 8-7 Copy Copies a file to another directory or another disk. After you have selected a file from the dialog list, it displays another dialog where you type in the name under which the file is to be copied. A file can be copied to the same directory under a new name, or it can be copied to a different directory under the same name or a new name. j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j CHAPTER 9 EXTERNAL FILE MANAGEMENT SYSTEM This unique feature allows you to store the names of external files in a Superbase database file, and display both the database records and the external files themselves using the database's indexing and searching facilities. There are two types of external files: text files and picture files. The way external text files are controlled is more or less the same in both the Gem and Amiga versions of Superbase. But the way picture files are controlled is sufficiently different to warrant a separate treatment for each version. This chapter, therefore, is divided into three main sections. The first section covers all the features of the external management system that are common to both versions of Superbase. The second and third sections explain the way picture files are handled on Gem and the Amiga. Amiga owners also have the ability to store and play back external sound files. These are described in the third section. Note: Memory Allocation In Gem versions of Superbase, some of the images and text documents in the demonstration files require more free memory than others. If you experience difficulty in displaying them you should refer to Appendix H at the rear of this manual. On the Amiga, you should ensure that you have sufficient contiguous memory before you view external picture files. This should be at least 40K for a low resolution image. Picture Files Picture files hold graphic images. Usually they will have been created in a painting or drawing program, but you may also use them for digitized images. The restriction here is that the digitized image must be stored in a format that Superbase accepts. Details of the formats required for images are given in the appendices for the Atari and Amiga. On the IBM and compatible machines, Superbase accepts' .img' files. External File Management System 9-2 The applications for the external picture files are numerous. Whether you are storing plans of houses for a real estate business, CAD drawings, digitized picture library images, or just your own paint program creations, a powerful cross-referencing and display manager is a valuable aid to efficiency. Text Files External text files provide a bulk text or memo facility. They are used to store the same kind ofinformation as database text fields but do not carry the same limitations on the amount of information. The maximum length for a text field is 255 characters. The maximum size of a text file depends on the amount of free memory available. If you try to load a document for which you have insufficient memory, Superbase will load as much of the document as it can and will then display an error message. External text files may be created with the Superbase Text Editor or with another wordprocessing program. Superbase displays an external text file by loading it into the Text Editor. You can then scroll through it or edit it, just as if you had selected the Text option from the Project menu. Any file, therefore, that can be loaded into the Text Editor, can be used as an external text file. External File Fields In the File Definition, there is an External File field type. External File fields are like Text fields, except that Superbase can use their contents as path names for external files. A path name is simply a path through the operating system directory structure to the file itself. The contents of an external File field can be: • • • • A file name. A path name that includes a file name. A:, B:, or C:, followed by the path name and a file name. DFO:, DF1:, or DHO:, followed by the path name and a file name. When you enter the name of an External File, you must supply the full file name, including any extension name. If you are using a text file which you have created in the Text Editor, you must supply the 'sbt' extension, e.g.: Comment.sbt '-__ External File Management System 9-3 File Name: Same Disk, Same Directory At its simplest, an External File field refers to a picture or a document in the same directory as the database file, for example: Roomplan.img Castle This is the name given to a picture created with a paint program. Same Disk, Different Directory If you want to access a file in another directory you must include the name of that directory in the External File field. Superbase can then go to that directory, open the file and read the data. Suppose you kept picture files in a directory called Images. The External File field contents would have to look like this: \lmages\Roomplan-img Images/Castle File Name: Different Disk If your external file was on another disk, you would have to start your path name with the disk drive specifier, either A:, B:, C: or D: (DFO:, DF1:, or DHO on the Amiga). Continuing with the text file example, suppose you kept a text files in a directory called Documents on the disk in drive A (drive 0 on the Amiga). The External File field would have to hold the following path name: A: Documents\Comment.sbt DFO:Documents/Comment.sbt The colon tells Superbase that the Documents directory is to be found on the disk in drive A Superbase will therefore expect to find a disk in drive A If it does not find a disk, or does not find the directory, Superbase will display an appropriate error message. 9-4 External File Management System Viewing Text Files External text files are displayed in the Text Editor window. When you click on the External File button, Superbase loads the fIle into the Text Editor and makes the Text window active. At this point, you can treat the fIle in the same way as any other text file. Clicking the External File button has the same effect as clicking on the Text option in the Project menu, and then loading the fIle with the Open option in the Text Editor menu. In most cases, you will only want to view the file; if it is longer than the text window, use the scroll bars to scroll it into view. But you can also take advantage of any of the Text Editor functions. Thus you could insert new text and save the file on disk, or you could replace the text with another document, and then save it. Controls for External Text Flies The External File controls are used in the same way with a text file as for a picture fIle: • The External File button displays a text file in the Text Editor win dow. • The Control Panel is used for selecting any particular text file, or for browsing through a series of text fIles. • The External > > and External < < buttons are used to move from one text file 'level' within a single record. Likewise, the controls for manipulating the Text Window are the same as for the Picture window. The techniques for closing, re-opening, sizing and scrolling the window are also explained in Chapter 10. Example The Help database file on the demonstration disk illustrates some of the ways of using external text files. It shows how you could use them to provide a Help screen facility. The files associated with the first record provide a Contents page for the text entries associated with all the other records. After opening the Help file, click on the External File button. This action will load the Contents page into memory and display it in the Text Editor window. External File Management System 9-5 Each entry in the Contents pages, represents a separate text file, which has been stored on disk under the same names as the entry. If you now want to view the Help screen for a particular topic, follow this procedure: 1. Make a note of the file name associated with the topic. 2. Click on the Key Lookup button. Now type in the file name and press Return. 3. Superbase will then display the text entry for the topic you have selected. If you want to read another Help entry, click on the First record button on the Control panel and repeat these steps. Alternatively you can browse through the entire document (remembering that it is stored as a number of separate text files) using the Next and Previous buttons. The next section describes another way of retrieving the Help file for a particular topic: using the external file search facility. Searching External Text Files ~/ Superbase provides a special operator for use with external text files the CONTAINS operator. CONTAINS works in the same way as the LIKE operator, but whereas LIKE is used to search for text strings in text fields, CONTAINS searches for text strings in external text files. CONTAINS can be entered in any Superbase filter command line, but it will be used most commonly with the Control panel filter or with the Query filter. It must be preceded by the name of an external text field, e.g.: Main_Entry CONTAINS "*tractor*" In this example, the name of the external text field is Main_Entry. In each record in the database file, the Main_Entry field stores the name of an external text file. When you enter this line in a filter, Superbase searches all the external text files associated with the Main_Entry field for an occurrence of the word 'tractor'. If it finds the word, Superbase displays the text file in the Text Editor window. Youwill notice that the example filter line makes use of the pattern matching character '*'. The reason for this is that CONTAINS searches for matching lines rather than matching words. This means that you need to define the search string as an entire line rather than a single word. The word 'tractor' may be located anywhere on a line, so you need to take this into account by placing the ,*, character before and after the word in the search string. If you External File Management System 9-6 were sure that the word only occurred at the beginning of a line, you could omit the first '*' character, as in: Main_Entry CONTAINS "tractor*" You may also use any of the other pattern matching characters that are available with the UKE operator. For example: Main_Entry CONTAINS "*[a_d]. Smith*" This will search for all the people whose last name is Smith and whose first name initial falls in the range A to D, such as 'A Smith' and 'D. Smith'. Note that because CONTAINS works on a line by line basis, it will not be able to locate a string that extends over two or more lines; for example, if the search string is "*John Smith*", CONTAINS will not find an occurrence of 'John Smith' where the first name is at the end of a line and the second name is at the start of the next line. Querying External Files You can use the facilities of the Query option on the Process Menu to produce text or picture output in conjunction with data output. Two steps are necessary to achieve this: 1. Select the External File Query button in the Options requester on the Set Menu. 2. Name the External File field or fields that you want to view in the Query Fields line. Gem: Viewing Picture Files Ensure that the Pictures demonstration file on your disk is open, and that you have enough free memory. See that Form View is set and select the first record. You will see that the file is indexed on Number, and there are two External File fields for this record. These are Picture 1 and Picture 2. These External File fields can be thought of as being on different 'levels', with Picture 1 being on the highest level, because it's the first External File field in the record. This concept of 'levels' becomes important later on when you move from one External File field to another within a single record. External File Management System 9-7 There are three 'tools' you can use to view the External File, these are: • • • The External File button The Control Panel External > > and External < < External File Button Now that you have opened the Pictures file and the first record is on the screen, you can look at the image associated with the first External File field in the current record. To do this you have to click on the External File button at the right-hand end of the Control Panel. Click on it now. Superbase will split the screen into two windows. The window on the left is the Superbase window, and the window on the right is the Picture· File window. We will discuss windows later in this section, so don't worry about them for the moment. Control Panel If you now wish to view the image from the next record in the Pictures file, click on the Next Record button on the Control PaneL Do this now. You will notice that Superbase displays the next record in the Superbase window and then displays the image in the Picture window. From time to time you may want to move within a record from one External File field to another. You do this using the Record Menu. External > > and External < < Both these options are to be found on the Record Menu. Using these options you can move from one 'level' to another within a single record. Try this now. Select External > > from the Record Menu, and watch the screen. Superbase does not have to get the record - it's already in the Superbase window. All it has to do is to display the image associated with the second External File field for the current record. 9-8 External File Management System Manipulating Windows Active Window By now you will have become familiar with the two windows you have on your screen. You should be aware that you can only work in one of these windows at anyone time. The way you let Superbase know which one you're working in, is to make one 'active' and the other 'inactive'. To make a window 'active' you move the pointer into a window and click the mouse button. Try this now. Move the pointer into the Superbase window and click the mouse button. You will notice that as soon as you do this the scroll gadgets appear around the window. If you now look at the External File window, you will see that there are no scroll gadgets. Scroll Gadgets You can use the scroll gadgets within the active window in order to see the remaining part of the Superbase record or Picture you can't see. Assuming that your active window is the External File window, click on the arrow gadget in the bottom right·hand corner. As you do this watch the screen. You will notice that the picture moves slightly to the left within the window. As an alternative to this, you can use the scroll bar at the bottom ofthe screen. This will enable you to scroll the picture in bigger steps. Also you can click in the shaded area to the left or right of the scroll bar (depending on where the scron bar is currently positioned). This will enable you to move to the far left or right of the image in one go. A similar effect can be achieved by clicking in the shaded area on the scroll bar at the side of the screen but this time you will move up or down. Full Box Gadget If you now wish to make either the Superbase window, or the Picture window its full size, you can use the Full Box Gadget. This is always located in the top right·hand corner of a window. Click on the Full Box Gadget within the Picture window, and watch the screen. External File Management System 9-9 If you want to view the Superbase window you can use one of three methods: 1. Click on the External File Button. This works like a toggle and swaps the windows from front to back. 2. Use the Full Box Gadget. This also works like a toggle. This toggles the window between its maximum size and its previous setting. 3. You can re-size the External File window. This is explained in the next section. Re-slzing windows In order to re-size a window you use the Sizing Gadget. This is situated in the bottom right-hand corner of a window. Move your pointer so that it is in the bottom right-hand corner of your Picture window. Make sure that this window is active by clicking in it. Now press and hold down the mouse button. As you do this you will see some dotted lines appear around this active window. Now move the pointertowards the top left-hand corner ofthe window. Then, whenever you feel like it, release the mouse button. The Picture window will now be drawn in this new position. Moving Windows Once you have re-sized a window, you may wish to change its position on the screen. You can do this by moving the pointer onto the grab bar at the top of the window. Then press and hold down the mouse button. Now move the pointer - and the window - to its new position. Using this method, you can if you want, place the Picture window on the left, and the Superbase window on the right. Closing Windows When you want to close a window, you click on the Close Gadget which is located in the top left-hand corner of a window. Try this now. Click on the Close Gadget in the External File window, and watch the screen. The Picture window is closed leaving the Superbase window open. Note: When you click on the Close Gadget in the Superbase window, Superbase will assume that you want to close the program, and will display the confirmation dialog you see when you select Quit from the Project menu. 9-10 External File Management System Amiga: Viewing Picture Files Ensure that the Pictures demonstration file on your disk is open. Set Form View is set and select the first record. You can see that the file is indexed on Picture Number, and there are three pictures for this record. These are Picture 1,2, and 3. Think of these pictures being on three different levels, with Picture 1 being on the highest level. These 'levels' become important when you start to move around from record to record using the External File System Menus. External File Button Now that you have opened the Pictures file and the first record is on the screen, you can look at the first picture. To do this you have to click on the External File button at the right-hand end of the Control Panel. Click on it now. Superbase displays the external file named in the first External File field for the current record. It's called Castle. The External File button always shows a picture if it can find one. You do not click on this button to close down the External File screen; for that you use the Close option from the Control Menu, described below. If you look at the top of the screen you will see the title of the picture. To the right are the depth gadgets, which will be explained later. The External File System uses its own screen and window, and has a separate set of menus for controlling the pictures. Problem: Menus Won't Display If you can't display the External File System menus when you press the right-hand mouse button, this is because the window is inactive. You must click in the window with the left-hand button once to activate the window. This is a feature of the Amiga's Intuition windowing system. External File Management System 9-11 Image Menu This menu provides three options for selecting pictures individually, within a single record. Next Castle is the external file named in the first External File field. If you want to see the picture for the next External File field, you must select Image Next. We refer to this as selecting the next 'level' in the External File system. Select Image Next in the usual way, by holding down the right- hand mouse button while moving the pointer to highlight the item you want, then releasing the mouse button. Try this now. Superbase displays the picture named in the second External File field in the first record in the Pictures file. Whenever Superbase displays the message "No External Data", this indicates that the selected record has no file name in the External File field. Previous This option is the opposite of Next. If you want to go up a 'level' and view the picture named in the first External File field in the current record, you must select Previous from the Image Menu. Advance Some IFF files may have more than one 'frame' in them. In such cases, you can display the next frame by selecting Advance from the Image menu. There is no option to display the previous frame. Record Menu The options on this menu are like those on the Main Display Control Panel. They allow you to select records within the database file. When Superbase selects a record, it uses the External File field at the current 'level' to find and display a picture. The message "No External Data" indicates that the selected record has no file name in the External File field at that level. If you have a Filter in use in the Main Display, Superbase will only select records that match the Filter. 9-12 External File Management System First, Last, Next, Previous Each of these options selects a single record in the database file, and uses the External File field at the current 'level' to find and display an external file. Forward This option finds and displays the external files - at the current 'level' - for all records from the current record to the end of the file. This gives you a 'slide show' capability. • If a Filter is active, Superbase will use it. • The duration of the display can be varied from the Set Options re quester. • You can interrupt the display by selecting Pause or Stop from the Control Menu, or clicking on the Pause or Stop buttons on the Con trol Panel, if you've made it visible. Rewind This option is the opposite of Forward. It causes Superbase to go backwards through the file and display one image after another until you reach the beginning of the file. Control Menu This menu provides some simple control options. Pause While Superbase is displaying in either Forward or Rewind mode, you may want to pause and look at one of the pictures. You can do this by selecting Pause from the Control Menu. Superbase completes the current display and stops. If you look at the Control menu you'll see that this option is highlighted to show it's active. Once you've selected this option from the Menu, Superbase will leave the current picture on the screen until you select Rewind or any other Menu option. Stop If you want to stop during Forward or Rewind, use Stop. Superbase completes the current display and stops. You can now use any other menu option. External File Management System 9-13 Hide and Show Title Bar The purpose of these options is to allow you to remove the title bar from the External File window, so that a Screen Dump doesn't reproduce it. The title bar normally shows the name of the picture being displayed - or "No External Data" if Superbase can't find an external file. Screen Dump The Screen Dump option allows you to reproduce the External File window, provided you have a printer capable of high resolution graphics. The parameters for graphics printing are set from the Preferences system utility. Close Use this option to close down the External File screen and return to the Superbase Main Display. When you're selecting records from the Main Display and the External File button is highlighted, Superbase automatically finds and reads external files. This slows the system down. Ifyou want to stop Superbase reading external files, enter the External File screen, and select this Close option. Combined Database Record and External File Display It's possible to resize windows and drag windows and screens so that both data and picture are visible on the same physical screen. This allows you to provide a caption or other relevant information for the picture, or to use the Control Panel buttons instead of the Record and Control Menus. Moving Screens In the External File screen, move the pointer to the title bar, press and hold down the left-hand button of the mouse, then drag the pointer down to the bottom of the screen. The picture moves down the screen and reveals the Superbase Main Display behind. You can release the mouse button at any point, so that any proportion of the picture remains visible. 9-14 External File Management System Sizing the Superbase Screen If you drop the External File screen right down, you can move the pointer into the Superbase screen and use its gadgets. • Use the resizing gadget to make the Main Display window smaller. • Drag it down the screen a bit. • Drag the Control Panel window up to the top of the screen, above the Main Display. • Re-enter the External File screen, click once to activate it, and drag the screen up to the bottom of the Main Display window. Control Panel You can now use the Control Panel in the same way as you normally would with Superbase files. But having the screen arranged as it is means you can see both the current record and the picture for the current 'level' ofExternal File field. Depth Gadget In the External File screen, you can flip the current image behind the Superbase screen by clicking on the depth gadget on the Title bar of the picture. To get the picture back again you simply click on the External File button on the Control Pane1. Don't try to redisplay the External File screen with the Superbase Main Display depth gadget. Use the External File button. External File Management System 9-15 External Sound Files If you store the name of a sound file in an external field, the Amiga will play back the file when you click on the External Fi.1e button. If the External File screen is displayed, you can use a sound file to accompany a picture. Superbase accepts two types of sound files: IFF sound samples, produced by sound sampler programs such as Perfect Sound; and 'data dumps' which are produced by a sound digitizer. Files in IFF format incorporate information about the speed at which they are played back. For other files, you can set the play back speed using an optional speed parameter. This must be entered in the external file field after the sound file name, and separated from the name by a semicolon. For example: /Sounds/Chord;150 This specifies that the Chord sound file (in the Sounds directory) should be played back at a speed of 150. The smaller the number, the faster the sound file is played back and the higher the pitch. For most sound files, this figure should be around 200. CHAPTER 10 THE TEXT EDITOR The Text Editor is suitable for entering and editing text of almost any kind, from short memos and letters to lengthy written reports. It is not, however, intended as a replacement for a word processing program, and it does not provide all the features you would expect to see in a word processor. But you may find it more convenient to use the Text Editor for many of your word processing requirements. More specifically, it is used for two purposes relating to Superbase itself: • to create form letters for Mail Merge applications • to create large text entries which can be linked to database records and are stored as external text files. The Text Window When you select Text from the Project menu, Superbase opens a window in the right-hand half of the screen (see next page). This is the text window where you enter text and edit it. At the top of the screen the normal menu headings are replaced by a set of Text Editor menu headings. The database window showing the current record remains open but is now inactive. If you move the mouse pointer anywhere in the database window and click in it, the window will become active again and the Text Editor menus will be replaced by the normal database menus. Superbase lets you switch between the Text Editor and the database at any time simply by clicking in their respective windows. If you are editing a large document, the text window will only show part of it. The scroll bars enable you to move the window over different parts of the document. You can also do this by moving the cursor to the edge of the text window. The maximum width for text is 240 characters. The Text EdHor 10-2 ::, The research and develoPMent lab that 1:rans'orMS the evel'l'day bal instruMent. The Main features 0' below: 1. Construction. '" New develo~liItnt5 in IIOldi extreMely aurable plastic ""',"".: :': ",' '::,: Selecting Full Screen GEM If you prefer to edit text using the full width of the screen, click on the full screen gadget, the diamond at the top right hand corner of the text window. Clicking on the diamond a second time makes the window half size again, and brings back the database window. AMIGA To edit text using the full screen on the Amiga, first move the text window to the left-hand side of the screen; then drag the bottom right-hand corner of the text window to the right of the screen using the size gadget. Closing the Text Window To close the text window either click on the close window gadget at the top left corner, or select Quit from the Project window (or press the keyboard equivalent Alt Q). Closing the window does not remove text from the computer's memory. If you open the text window later, any text you have entered will still be there. The Close option on the Project menu shuts down the Text Editor and also clears text from memory. Do not use this option if you only want to close the text window temporarily. The Text Editor 10-3 The Text Editor Menus The Text Editor menus are only available when the text window is active, and the options they provide can only be used with text inside this window. Unlike the rest of the manual, this chapter does not follow the menu structure closely, and it does not explain each of the menu options in turn. Instead it is organized under headings which relate to different tasks Entering Text, Editing Text, Loading and Saving Text, and so on. Each of the menu options is introduced at the point where you will need to use it. The Project menu, however, deserves a slightly fuller explanation. You will notice that some of the options on the Text Editor's Project menu are the same as those on the database Project menu. Not only do they have the same names, but they also work in the same way. The difference is that the Text Editor options only operate on text files. Most of the time, you will be working with text files you have created in the Text Editor. These are stored on disk as '.sbt' files; they have '.sbt' extension names. You may also use text files produced by other word processing programs. Here's a list of the Project menu options, together with a brief explanation of what their functions are: New Creates a new text file and clears any existing text from memory. Open Loads a text file into the Text Editor from disk. If a file is already present it will be replaced by the new file. Close Clears a text file from memory and closes the text window. Save Saves a text file on disk. Remove Removes a text file from disk. Print Prints the text file in memory, the file that is currently in the Text Editor. Quit Closes the text window and returns the user to the database window. Does not clear the current text file. 10-4 The Text Editor Creating a New File When you enter the Text Editor for the first time in a session, you will be presented with a blank page. So, you can start creating a new file straight away. Unlike the procedure for creating a new database file, it is not necessary to select Project New first. You only need to select the New option if you have already entered some text or you have previously loaded some text from disk. New clears the existing text from the Text Editor and lets you start afresh with a new text file. Entering Text Text can only be typed in when the Text Editor cursor is on the screen. The cursor is a vertical line (a rectangle on the Amiga) which shows where the next character you type will appear. If you have just started a new file, the cursor will be at the top left-hand corner of the text window. If it is not on screen, you can click in the text window to bring it back. Word Wrap The Text Editor allows you to specify where lines of text start and finish by setting the left and right margins. In a later section, we explain how you can alter the margins for the whole document or each individual paragraph. By default, the left margin is at column 5 and the right margin is at column 75. !fyou type a word that extends beyond the right margin, the Text Editor automatically moves the word to start of the next line. This is known as 'word wrap'. The cursor is also moved to the next line so you can carry on typing without interruption. Paragraphs On a typewriter, you usually need to press the Return key when you reach the end of a line. In the Text Editor, you use the Return key to end a paragraph. Pressing Return takes the cursor to the start of a new line and a new paragraph. The Text Editor uses a small black rectangle as a paragraph marker to indicate the line where a paragraph ends. Paragraph markers are placed on the right-hand edge of the text window. 10-5 The Text Editor Editing Text The Text Editor provides a large number of facilities for editing text. You can either edit text after you have entered it, or you can edit text that has previously been saved on disk (see Loading Text). Some ofthe editing facilities are available from the Text Editor menus. Most of them, however, are keyboard controls, involving the cursor keys or key combinations. All the key combinations use the Ctrl key plus a letter key. Note that the Ctrl key is represented by the' "', character. For example: "'B indicates that the Ctrl key and the letter B should be pressed in combination. ,~ We explain each of the key combinations later on in this chapter. But if you want a quick reminder of which keys to use, you can bring up the Text Editor's help window. This appears when you select Help from the Options menu. CONTROL KEYS FOR EDITING AB Beginning of text AW Delete tlord AE Delete to end of line AN New line AS Split line AF ReforMat paragraph AG End of text AD Delete line AX Clear line AU Insert onloFf AA Join line AU Undo OK '-.-/ To remove the help window, click on OK The Text Editor 10-6 Moving the Cursor With the Text Editor, you can move the cursor around the screen and edit text at any point on the screen. The cursor keys are used to move the cursor by one character at a time. Note that the term character includes the space character. Note: In GEM versions of Superbase, you may find that the cursor keys move the pointer intead of the cursor. In this case, press the Ctrl key once to switch back to the cursor. Left arrow Right arrow Uparrow Down arrow Moves the cursor to next character to the left. Moves the cursor to the next character to the right. Moves the cursor to the character in the same column on the line above. Moves the cursor to the character in the same column on the line below For larger cursor movements, use the following keys: AB AG Takes the cursor to the first line in the text Takes the cursor to the last line in the text Horne (GEM) Moves the cursor to the beginning of a line Shift left cursor (Amiga) Moves the cursor to the beginning of a line End (GEM) Moves the cursor to the end of line Shift right cursor (Amiga) Moves the cursor to the end of a line Tab Moves the cursor eight characters to the right Shift Tab Moves the cursor eight characters to the left There are two ways of bringing text into view if it extends beyond the text window. Moving the cursor in one direction to edge of the text window scrolls the window in the same direction. Alternatively, you can scroll the window using the mouse pointer and the scroll bars. You can also use the mouse to move the cursor within the text window. To do this, move the pointer to the point where you want to the cursor to be, and click once. Note that you cannot move the cursor beyond the last line of text. 1~7 The Text Editor Deleting Text The controls for deleting text operate on the text at the current position of the cursor. Before using these controls, you should check that the cursor is in fact located at the point where the text is to be deleted. The keys to use for deleting text are: Backspace Del AX Deletes the character to the left of the cursor Deletes the character to the right of the cursor Deletes the word to the right of the cursor Deletes the current line Deletes text from the current position of the cursor to the end of the line Deletes all the text on a line, leaving a blank line Selecting Delete line from the Edit menu has the same effect as AD. Undo If you delete a line, a word, or just a few characters by mistake, A U lets you restore the text you have deleted. This option reverses the effect of the last deletion. ',-_ Larger blocks of text can also be restored, provided they have been deleted with the A D key combination. For example, if you delete a five line paragraph by pressing A D five times in succession, pressing A U five times in succession will restore the paragraph. Because A U restores text at the point where the cursor is currently located, you can use it to move a line of text or a paragraph to a new position in your document. To do this, delete the line using A D, move the cursor to the new position, then press AU. The Undo option restores the line to the state it was in before the cursor moved onto it. This means that you can also use U to reverse the effect of an insertion. If you press A U after typing in a line of text, the text will then be removed from the document. A The Text Editor 10-8 Copying Lines The key combinations A Land A R allow you to copy a line of text to another position in the document. A L is used to select the line you wish to copy: move the cursor to any point on the line and press A L. You can then use A R to insert a copy of the line that has been previously selected with A L: move the cursor to the point in the document where the line is to be inserted and press A R. A copy of the line will be inserted below the cursor. Inserting Text The way text is inserted in a document depends on which typing mode has been selected. There are two typing modes, Insert and Overwrite. To switch between them, click on Insert in the Options menu or press the key combination A V. Insert is the default mode. When this mode is selected Superbase places a check mark next to the menu item. On Gem versions of Superbase, each mode has its own type of cursor (on the Amiga, the cursor stays the same). Insert uses a thin vertical line, Overwrite uses a thicker vertical line. Both modes let you type in text at the end of a document, and they create new lines as you do so. The difference comes when you enter text within a document. Insert Mode With insert mode, you can insert text in a document without overwriting the existing text. Any text in front of the cursor is pushed to the right to make room for the new text. At the same time the Text Editor reformats the rest of the paragraph so that it does not extend beyond the right margin. Pressing the Return key in Insert mode splits a line at the point where the cursor is. The part of the line after the cursor is then placed on a new line following the current line. Another way of doing this is to use the key combination A S. Likewise, there are two ways of closing up (or joining) lines in Insert mode: either, position the cursor anywhere on the first line and use the key combination A A; or, position the cursor at the start of the second line and press the Backspace key. Note that when you press Return or of a paragraph. A S, the current line becomes the end The Text Editor 10-9 Overwrite Mode In overwrite mode, the characters you type in replace the existing characters to the right of the cursor. Use this mode when you want to rewrite a line or a paragraph. It saves you the trouble of having to delete old text after typing new text. Pressing Return in overwrite mode moves the cursor down to the start of the next line. If you want to insert text in overwrite mode, first press text. Then close up the rest of the text using A A A S. Type in the new Inserting New Lines '-../ To insert a new line in the text you are editing, position the cursor at the left margin and press Return (only in Insert mode) or A S. In effect, this creates a single line paragraph, even though the line is blank and has no characters on it. The New Line option on the Edit Menu (also N) lets you create a blank new line without at the same time inserting a new paragraph. This option inserts a new line between the current line and the next line down. A Formatting Text The format of a document refers to the way it is arranged on a page; i.e. it is specified in terms of the left margin, the right margin and the line length. When you create a new document, the Text Editor has a default format which ensures that lines start and finish at columns 5 and 75, and that the maximum line length is 70 characters. To control the document format, the Text Editor uses a ruler line. Initially, the ruler line is not visible. You can display it on screen by selecting the Ruler option from the Options menu. Click on Ruler and the line will appear at the top of the text window. ~< The angled bracket at the left of the ruler indicates the current position of the left margin, the angled bracket at the right of the ruler shows where the right margin is. 10-10 The Text Editor Altering the Ruler Settings You can move the left and right margin settings to any position on the ruler line. Place the mouse pointer on the ruler line at the point where you want to set a new margin and click the mouse button. If the pointer is nearer the left angled bracket, this action will reset the left margin; if it is nearer the right bracket it will reset the right margin. As soon as you alter the ruler settings, the Text Editor reformats the text so that it fits into the new margins. However, the ruler settings only apply to the current paragraph and the paragraphs after it. (The current paragraph is the one where the cursor is.) If the cursor is in the first paragraph of the document, the effect of resetting the margins will be to reformat the entire document. If the cursor is located in another paragraph, the text above the current paragraph will not be affected. Note that in setting the margins you are also setting the line length. In other words, you can approach this operation from two different angles. Suppose your main consideration was that the line length should be 70 characters. First, you would set the left margin, then you would move the pointer 70 characters to the right and set the right margin. A quick way of working out the column position on the ruler line, is to use the Tab key. Pressing the Tab key moves the cursor eight characters at a time. Use Tab to position the cursor below the ruler line in the column you require. Then align the pointer with the cursor. Multiple Rulers Ifyou wish, you can assign a separate ruler line to each paragraph. The ruler line at the top of the screen will then reflect the margin settings for the current paragraph - the paragraph where the cursor is currently positioned. You can change the margins for a single paragraph by moving the cursor to that paragraph and then resetting the ruler. But when you do this the paragraphs following the current paragraph may also be reformatted. The point to bear in mind here is that a reformatting operation applies to the current paragraph and any paragraphs following it which have not already had a ruler line set for them. The Text Editor 10-11 Example To illustrate the way multiple rulers work, let's consider an example involving a document with just four paragraphs. Initially, they all use the same ruler, the default ruler. Altering the margins for the first paragraph will have the effect of reformatting the entire document. If you reset the left margin for the second paragraph to column 30, paragraphs 3 and 4 will also be shifted to column 30. The first paragraph, however, will stay at column 5, the default setting. Next, move the cursor to paragraph 3 and reset the ruler so that the left margin is at column 15. You will notice that this action reformats paragraphs 3 and 4 but leaves the other two paragraphs unchanged. Finally, return the cursor to the second paragraph and position the left margin at column 40. Because paragraphs 3 and 4 no longer use the same ruler, this operation will only affect the second paragraph. Formatting a Paragraph After editing a paragraph you may find that it no longer fits into the current margin settings. If this is the case, pressing A F will readjust the lines in the paragraph so that it is correctly formatted. With many editing operations, it will not be necessary to use "F. A paragraph is automatically formatted when you insert text or when you move the cursor to another paragraph. The Text Editor 10-12 Setting the Type Style Four different type styles are available: Plain Bold Italic Underlined Text is shown on screen in the type style you select. Provided you have installed the appropriate printer driver, the text will also be printed in the selected type style. You cannot select 'Plain' and one of the other type styles at the same time. Otherwise, any combination of type styles can be used: Bold and italic Bold and underlined Bold, italic and underlined Italic and underlined There are two ways of setting a type style: either by selecting one of the style options from the Style menu, or by pressing the keyboard equivalents for the options. The key combinations for the Text Editor's type styles use the Alt key (on the Atari, this is labelled Alternate) plus a letter key: AIt P AIt B AIt U AIt I Plain Bold Underline Italic Once you have selected a particular style, the Text Editor will place a check mark next to the menu option, and any text you type in will now be displayed in that style. To tum a style setting off, click on the style option a second time, or press the key combination again. If you want to alter the type style for a word or a line of text, you will have to delete the text, select a new style, then type it again. The Text Editor 10-13 Loading Text Use the Open option on the Project menu to load a text file from disk. (Make sure that the Text Editor menus are active, not the database menus.) Selecting Open presents you with the standard Superbase file dialog, listing all the 'sbt' text files in the current directory. 'sbt' files are files which have been created with the Text Editor. You select a file in the usual way, by double clicking on it or by clicking once and then clicking on OK. If you want to load a file from another directory, type the path name and file name into the Selection Box. When you load a file in this way, it replaces any file that may already be present in the Text Editor. Loading Files Produced by Other Programs To load a file which has been created with another program, type the file name in the Selection Box. The file must have an extension name and the extension name must not be 'sbt'. If there is no extension name, the Text Editor will assume the file is an 'sbt' file and will be unable to load it. Although you can load files from other programs into the Text Editor, you will not be able to format them; nor will you be able to set text in different type styles. The ruler line and the style options will be unavailable. Text files from other programs can be divided into two types: files with control characters in them, and files without control characters (sometimes referred to as ASCII files or non-document files). You can attempt to load the first type of file, but the results will be unpredictable. The Text Editor may not be able to read the control characters, or if it does succeed in loading the file, the control characters will appear on screen as quite different characters, for example as graphic symbols. Word processor text files usually contain control characters; they are used to store the details of a document's format and type styles. However, most word processors also provide an option for saving a document without any control characters - they may allow you to do this by printing a file to disk, or they may offer a non-document mode. If you load this type of file into the Text Editor, you will be able to edit it to delete and insert text but it will not be possible to reformat the text. If you wish to reformat the text, you must first save the file as an '.sbt' file (see the next section) and then load it back into the Text Editor. 10--14 The Text Editor Saving Text Files To store the current text on disk, select the Save option on the Project menu. Superbase will display a Save File dialog. Type in the file name and click on OK. Note that files from other programs can be loaded into the Text Editor and then saved as '.sbt' files: when the Save File dialog appears, you should delete the previous extension name; the Text Editor will then add a '.sbt' extension to the first part of the file name. Converting to ASCII You may want to convert Superbase text files to ASCII files. The technique for doing this is as follows: 1. Rename the '.sbt' file, giving it a different extension; e.g., rename 'Merge.sbt' as 'Merge.asc'. 2. Load the file into the Text Editor. Its name will not appear in the list of files presented by the Project Open dialog and you will have to type it into the dialog box (remember to include the extension name). 3. Delete the lines containing information about ruler lengths. These will be blank lines except for two figures which give the start and end points for the ruler that is attached to the following paragraphs. 4. Save the file using the same name with which it was loaded. Printing Text Select Print from the Project menu to print a document. This option prints the current Text Editor document. If you want to print a file that is stored on disk, you need to load it into memory first. Text is printed out exactly as it appears on screen. To this extent. the Text Editor acts like a WYSIWYG word processor: your hard copy version of a document will have the same margins as the document on screen, and text will be printed in the same type style. Where the Text Editor differs from a word processor is that it does not offer as many print formatting features. For example, it does not allow you to set line spacing, or to specify how lines are justified. The Text Editor 10-15 However, you may be able to set some of these features using a printer initialization sequence. To do this, make the database window active and select Printer Options from the Options menu (on the Amiga, the printer initialization sequence is set using the second part of the Option dialog). When you have entered a sequence ofcommands in the Printer Initialization box, return to the Text Editor. Then select Print from the Project menu. You can also set a printer intialization sequence in the printer definition file see Appendix I for more details. ~- j j j j j j ~ j j -- j j j j '-_/ j j .~-- j j j j j CHAPTER 11 USING QUERY The Query option provides you with a powerful and versatile tool for selecting data. In some respects, it is similar to the Filter facility available from the Control paneL But unlike the Filter, Query allows you to define not just one, but four command lines: Fields, Report, Filter and Order lines. Each line is used to specify a different aspect of the Query output. • Fields determines which fields are output. • Report allows you to include other features such as totals and record counts. It also controls the way data output is formatted. • Filter controls the selection of records from a file. As a multi-file fil ter, it allows you to set up relational links between files. By doing this, you can make the selection of records in one file dependent on records in another file. • Order specifies the order in which records are sorted. You can sort a file on one field - this sorts records in the same way as an index - or you can use several fields to sort a file at different levels. Query Definition Dialog The dialog has three parts ( see below). At the top is the Title Box, below this is the Query Command Panel, and at the bottom left you will see three buttons for selecting the destination for the output from the query. Query Definition works by accepting your selections and typed input through four dialogs linked to the Fields, Report, Filter and Order buttons next to the Query Command Panel. Superbase then searches the file or files and outputs any records that match your Filter values . ........................Ip~el 11-2 Using Query Title Box The Title Box has three parts: Date Selector, Text Entry Box, and Page Number Selector. If you make any selections or enter any text, Superbase will print the results as a Title at the head of each page or screen of the query output, followed by a blank line. If you don't use the Title Box at all, Superbase starts the query output at the top of the page. If you click on the Date Selector, the Title will include the system date, as shown in the Date Format dialog on the Set menu. The date is always aligned with the left margin. Superbase highlights the Date Selector when it's active. To enter the text you want for the query output title, click in the box between the Date and Page Number Selectors, and start typing. The maximum length is 80 characters. If you click on the Page Number Selector, the Title will include a page number. The page number starts at one and increases by one every time it's printed. The page number is always aligned with the right margin. Superbase highlights the Page Number Selector when it's active. Query Command Panel The four lines of the Query Command Panel do most of the work of the Query option. Each line defines one of the elements ofa query: output fields, report features, filter conditions and sorting order; each of the first three can be up to 512 characters long. When you open a previously saved query from the Project Menu, Superbase copies its details into these four lines. You can then click on OK to use it, or edit any of the lines directly. You do not have to use all four lines. For example, to produce a sorted report that prints just the open fields for all the records in the current file, you would only use the Order line to specify the fields to sort on. Query Fields If you want to output just the open fields for the current file, leave this line blank. Don't click on the Fields button; go on to the next section. If you do want to select a set of fields for the query output from the open files, click on the Fields button. Superbase displays the Query Fields dialog. .~ 11-3 Using Query Query fields File: ADDRESS []!!]File ~ Position Length Heading OK ~ I I Clear I ICancel I Also, if you want to output the Open Fields List instead of or as well as fields you select using the Fields button, type ALL at the beginning of the Filter Command Line. The Query Fields dialog resembles the Filter dialog, but has several important differences. Its purpose is to allow you to select fields from any of the files being used in the query, and apply certain operators and parameters to them. Before looking at these you should understand how to select a file. '-....d Selecting File and Fields At the top of the dialog is the File Name Box, containing the name of the first open file. The fields in the Field Name Panel below belong to this file. You can select any field by clicking on it in the usual way. If you want to select a field belonging to another open file, you must first click on the upward pointing arrow to the right of the File Name Box. This action selects the next open file, and displays its name and the field names that belong to it. You can cycle through all the open files by repeated clicking on the arrow. Superbase checks to see whether a field name is unique across all the open files. If it is not, Superbase appends the file name automatically: Lastname.Address For simple queries, you just click on the field names you want, and then on OK. But if you want to add features to your query output you must use the special operators and options to the right of the Field Name Panel. If you click on one field name after another, Superbase will use a comma to separate the names in the Fields Command line. When the field data is Using Query 11-4 output, the comma has the effect of placing a space between each item. If you replace the commas with semi-colons, the items will be output without any spaces in between. Derived Columns A derived column in the query output is one in which the data is generated from a calculation, usually involving an existing field or fields, one or more arithmetic operators, and numeric variables. Examples are: Multiplication of fields: Fixed decimal places: Percentage increase of 15%: Percentage decrease of 8%: Future date: Margin: Quantity * Price FIX( amount/3,2) Price * 1.15 Price * .0.92 Date + 30 Sales - (Cost + Commission) The usual set of arithmetic operators is available. To set up a derived column, click on each of the elements of the calculation in turn, except for actual values, which you should type into the Value Box, pressing Return to enter them. A derived column that produces a numeric result is output in the default numeric format, which is specified with the Number Format option on the Set menu. likewise, a derived date column is output according to the format specified with Date Format on the Set menu. The data in a derived text column is output at its actual length, which means that following fields will not be regularly positioned unless you specify a fixed length for the derived text or a fixed column position for the next column. AS Heading When you specify a field as part of the query output, Superbase normally prints its name at the head of its column on each page. But this is not possible for a derived column, which has no name of its own. Consequently, Superbase allows you to enter a piece of text as a special heading. This can be done for both derived and normal columns. After specifying the field or calculation, click on the button for AS Heading then type the heading you require into the Value Box and press Return. AS will stay highlighted until you press Return. Examples: Sales - ( Cost + Commission) AS "Margin" Lastname AS "Name" Using Query 11-5 You may enter any piece of text. Positioning is done with the @ Position option. If you're using Query to create a new database, you must make sure that the headings for any derived columns are valid field names - legal characters only and not more than 15 characters in length. @ Position If you don't specify column positions for the fields, Superbase will output the field data for each record in a line, with each field appearing right after the previous one. Control over the exact positioning of data is obtained by clicking on the button for @ Position, and entering the desired column in the Value Box. You do this before clicking on the field name. For example, to print Lastname at column 12, you click on @ Position, then in the Value Box, where you type in "12" (no quotation marks), and press Return. Then you click on Lastname. Superbase shows this in the Main Box as: @12 Lastname We suggest that you try out column positions on screen and then adjust them before starting a lengthy report. Overlapping fields can cause problems. Typically, this occurs when you tell Superbase to print a field at a column position which has already been used by the preceding field's trailing spaces. Superbase's response in this situation is to print the field at the correct column position on the next line (see & Length, below). The maximum column position is 255. On a printer this will be wrapped round according to the margins you have set. & Length The solution to the problem of overlapping fields on a line is to limit the number of characters output for each field. You do this by clicking on the button for & Length, and then entering the desired number of characters in the Value Box. You do this before clicking on the field name. For example, to set a length of 12 for Lastname, click on & Length, then click in the Value Box, where you type 12 and press Return. Then click on Lastname. Superbase shows this in the Main box as: &12 Lastname Using Query 11-6 New Lines You can start a new line in the output at any point by clicking on the LINE button. Superbase places the NEWLINE symbol in the Main Box. If you want a blank line in the output you may need to click on LINE twice, depending on the actual print position. Other Format Parameters There are a number of other parameters that can be used to specify the format for Query output. These are not shown in the Query Fields dialog and must be typed directly into the Fields Command line with spaces or semi-colons separating them from other words in the Command line. The following table lists all the output format parameters that are not shown in the Query Fields dialog: Parameter Purpose FIELD DOWN BF [ON] UL[ON] IT [ON] BF!UI)IT OFF ATIROFF FG (Amigaonly) BG (Amiga only) EJECTnn Suppresses the field name headings Outputs each item in an expression list on new line Sets text to bold face Underlines text Sets text to italic Turns selected text style attribute off Turns all text style attributes off Sets foreground colour Sets background colour Outputs data on a new page if there are less than nn lines left at the bottom of the current page FlEW When this option is not used, Superbase prints the name of each field at the top of the 'page' as a heading for the data in the column below it. If you want to suppress the headings for all the fields in the command line, place the FIELD parameter at the front of the line. If you place FIELD anywhere else in the command line, it will only suppress the headings for the fields that follow it. Examples are: FIELD Firstname, Lastname, Country Firstname, Lastname, FIELD Country Using Query '-.. / 11-7 DOWN DOWN must be placed at the front of the Command line, before the field names. It ensures that the data for each field is output on a new line. For example: DOWN Firstname, Lastname, City would output data like this: Pierre Arnauld Paris Note that DOWN presents data in the same way as Record View and displays field names in reverse video; that is, the foreground colour becomes the background colour and vice versa. If you wish, you can combine DOWN and FIELD, so that the data for each field is output on a separate line but without the field name, e.g.: FIELD DOWN Firstname, Lastname, City STYLE PARAMETERS BF, UL, and IT set the text style for output. BF sets boldface UL sets underline IT sets italic Each of these can be set by ON (which is optional) and unset by OFF. ATIR OFF unsets all the text style attributes. ~j For example: UL BF FIRSTNAME, LASTNAME, UL OFF CITY, COUNTRY Using Query 11-8 COLOURS (Amiga only) On the Amiga you can also set the foreground and background colours, using FG and BG. Each takes a parameter in the range 1 to 4 for the four colours set by the Amiga Preferences utility. For example: FG 2;BG 1 Firstname,Lastname EJECT You can use EJECT to ensure that all the data for a single record is output on the same page. The number following EJECT should be the number of lines occupied by the record data. Thus, if you were using two lines to output the data from each record, the Fields command line would look like this Firstname, Lastname, NEWLINE City, Country EJECT 2 Superbase will then display or print a new page whenever less than two lines are left on the current page. Entering EJECT on its own or EJECT 0 causes Superbase to output a new page for each record. 11-9 Using Query ON File Outputting data from more than one file raises a special problem of formatting. The ON File option is designed to solve it. The best way to explain how ON File works is with an example. For this purpose, we will use one of the demonstration Query files, DClients. Load DClients using the Query Load option. DClients automatically opens the two database files, Clients and Deposits. Both files hold data relating to the same set of individuals. The Deposits file contains details of the bank deposits made by the individuals in the Clients file, using one record for each deposit. Note that the relationship between the two files is 'one to many': for each record in the Clients file, there may be several records in the Deposits file. DClients outputs data from both files, using the Lastname field as a link. This link is set up in the Query filter, which is explained later. The Fields line in the DClients Query file specifies which fields are to be shown in the report: Firstname.Clients,Lastname.Clients,Street.Clients, @27 Bank,Amount,Date When you click on OK in the Query dialog, the screen output should look like this: Deposits By Client ,--/' Firstnal'le Lastnaflle Bank AMOunt Donna Donna AdaMS AdaMS Oppens &Benworthy Hindhead Permanent £3000 £16001l - . - - .. £191lOO .. .. .. .. .... ... £5000 £2500 £5900 ................ .. £12500 ~ Bruce Bruce Bruce Clarke Clarke Clarke Ludlow rtational rtorthern Baker Bank ~ ~ Date __ .............. -.... _:E:;;:~. £31500 ~ 25 Jul 1986 25 Jul 1986 ~ =========== 8 Aug 1987 23 Feb 1986 21 Feb 1986 Using Query 11-10 Too much data is repeated. What is needed is a way of telling Superbase which details to print for each file. ON File does exactly that. The demonstration Query file Deptran works with the same database files as DClients, but uses ON File to format its output. The only difference between these two Queries is in the Fields line: ON "Clients" Flrstname.Clients, Lastname.Cllents, Street. Clients, ON "Deposits" @27 Bank,Amount,Date If you now load Deptran and click on OK, the screen output will be like this: Deposits By Client Firstna/1le lastnallle Bank Donna Adairls Oppens &Benworthy Hindhead Pernanent Anount Date £3000 £16800 .................... 25 Jul 1986 25 Jul 1986 £19800 ~ Bruce Clarke ludlow Hational Northern Baker Bank .... " ........ .. " £5800 £2580 £5800 .............. -.. £12500 -=--- .................. 8 Aug 1987 23 Feb 1986 21 Feb 1986 £31500 -=c_=~ As you see, ON File ensures that the names and addresses are not repeated. It instructs Superbase not to output fields from a file unless the current record has changed. You can think of ON as being short for 'on change of record'. In this example, Superbase reads a record from the Clients file and then reads the records in the Deposits file. Every time it finds a Deposits record whose Lastname field matches the Lastname field in the Clients file, it outputs the data specified by the Fields line. Without the ON "Clients" command, it repeats the first and last names from the Clients file for matching records in the Deposits file. The effect of ON "Clients" is to suppress duplicate names. Using Query 11-11 The second instance of ON File - ON "Deposits" - has a different effect. It cancels the first ON command and instructs Superbase to output data for all the matching records in the Deposits file. Ifyou left out ON "Deposits" from the Fields line, only the first matching record for each client would be printed. Superbase assumes that the ON command applies to all the field names to the right of it, irrespective of which file they belong to. This is why we need to include ON "Deposits" in the Fields Line; it ensures that the first ON command only applies to the fields in the Clients file. Ifwe were not concerned about the order in which fields are output, we could dispense with the second ON command, as in the following Field line: Bank,Amount,Date ON "Clients" Flrstname.Clients, Lastname.Clients Entering ON File To include this in the Fields command line, click on ON File in the Fields dialog. Superbase will then copy ON into the Main Box together with the name of the file that's in the File Name Box. Note that ON File only works when the data for each "level" of the Query output is held in separate files. Using Query 11-12 Query Report Superbase allows you to specify features such as totalling for the output fields in a query. If you don't want any features of this kind you should leave this line blank, avoid clicking on the Report button, and skip to the next section. Ifyou do want some report features in your query output, click on the Report button. Superbase displays the Query Report dialog. Query report File: CLIENTS ~ SlIi1 I MEAN I The Query report dialog, like many others, has three main parts. To the left is a Field Name Panel, with a File Name Box above it. On the right is a set ofbuttons for making selections, and the Value Box. Below these is the Main Box into which Superbase copies the results of your selections. Field Groups This is a key concept. A report consists of a series of records, which may be divided into groups according to the sorting order you set. For example, in a file such as our demonstration Address file, all the address records for each country may be printed together, and all the records for each city may be printed together, using a Country group and a City group. Using Query 11-13 In this example, the City groups would appear within the Country groups: England London London London York West Germany Bonn Bonn Heidelberg A Field Group is defined by a change in the content of the field. The change from Bonn to Heidelberg defines a City group, and the change from England to West Germany defines a Country group. Note that the change in the Country group necessarily implies a change in the City group: West Germany terminates both York and England. In this example, we would say that the file was Ordered or Sorted by City within Country. Now, if the file also had numeric or financial data, it would be very useful to be able to generate a subtotal for each Country and City group. Averages and record counts for each group would also be interesting. And we would like to see figures for the overall totals, averages, and counts as well. The Report dialog allows you to specify these features for both the report as a whole and any group within it by clicking on the keyword buttons and entering field names. Summarize The Report will suppress all record data and only output information from the following functions. Report When this button is highlighted, the selections that you make will apply to the report as a whole, not just to a group within the report. Group When this button is highlighted, the selections that you make will apply to one Field Group within the report. Sum The fields that follow the keyword will be totalled or subtotalled depending on whether Report or Group is selected. 11-14 Using Query MEAN The fields that follow the keyword will be averaged or sub-averaged depending on whether Report or Group is selected. COUNT The records in either the whole report or a group will be counted or sub-counted depending on whether Report or Group is selected. Superbase prints the totals and means for each specified field in the column for that field, aligned with the field's numeric format (see also Overflow in Subtotals or Totals, below). Counts are printed once for each group in the leftmost column. Report Example This example illustrates all the Report features we have mentioned. It shows you how to create a report on the data in the demonstration file Customers. The Customers file holds data for the same individuals as the Address file, but it has been modified to include two fields for storing financial data: Year_to_Date and Balance. Year_to_Date shows the total value of the orders placed by a customer over the past year. Balance shows the outstanding balance on orders which have not yet been paid for. Let's set out our objectives in creating this report. First, we want to sort customers into groups according to geographical area. The sort order will be country then city; that is, the highest level of grouping will be by country, and within each country customers will be sorted according to their city. Second, the report will show the totals for the two numeric fields in each City and Country Field Group. It will also show record counts for each group. Third, the report will show totals and records for the file as a whole. How do you create a report which satisfies these requirements? The following sections take you through the procedure step by step. Using Query 11-15 Report Totals, Averages, and Record Counts The first step is to define the requirements for the report as a whole. 1. Click on Report. This tells Superbase that the selections you are going to make will apply to the report as a whole. 2. Click on Sum. This indicates that the fields you are going to select are to be totalled for the report as a whole. 3. Click on a numeric field in the Field Name Panel. Superbase copies the name into the Main Box after the keywords. Repeat this action for all the fields you wish to have overall totals for. If you selected Year_to_Date and Balance, the Report Command line so far would be: REPORT SUM Year_to_Date, Balance 4. Record counting. This feature is either on or off. If you want the records to be counted and the total printed at the end of the report, use this option. Click on Count. Superbase copies the keyword into the Main Box: REPORT SUM Year_to_Date, Balance COUNT It's important to realize that the order of your actions is important here. By clicking at random on operators and field names, you could produce a meaningless Report Command tine. This won't harm your data, and it's the price you pay for complete flexibility, but you should try to avoid it nevertheless. A line like this doesn't help anyone: SUM MEAN Year_to_Date, Lastname, COUNT REPORT MEAN City Superbase will either give you a "Can't do this" message if there's an error in the line (such as trying to sum a text field), or print meaningless data. So proceed carefully. Using Query 11-16 Group Totals, Averages, and Record Counts Now we come to the business of specifying report features for the different groups within the report. The procedure is very similar to that for the report as a whole. 1. Click on Group, and then on a single field name. Superbase applies the selections you make next to the named group only. If you selected Country, the Report Command Line would look like this: GROUP Country The field that defines the Group should also be part of the Query Order Command Line. Most often it's a text field, but if your report groups its records by date or number then you could obtain meaningful subtotals from a date or numeric field. The only fields you should not use as Group fields are those that change their values from record to record, such as most financial items. 2. Click on Sum. This indicates that the fields you are going to select are to be totalled for the group - in other words they will be subtotals. 3. Click on a numeric field in the Field Name Panel. Superbase copies the name into the Main Box. Repeat this action for all the fields you wish to have subtotalled for the group. If you selected Year_to_Date and Balance, the Line so far would be: GROUP Country SUM Year_to_Date, Balance 4. As for the report as a whole, the record counting function is either on or off. By definition it counts only the number of records in the group. Click on Count, and Superbase copies the keyword into the Main Box: GROUP Country SUM Year_to_Date, Balance COllNT The next step is define a City group. Do this in the same way as Country. The final Report command line should now be: REPORT SUM Year_to_Date, Balance COUNT GROUP Country SUM Year_to_Date, Balance COUNT GROUP City SUM Year_to_Date, Balance COUNT It looks lengthy, but when you read it through it's quite easy to understand what's going on. 11-17 Using Query Field Group Order Rule Remember that we said earlier that the City group can be described as being within the Country group? This makes the Country group the outer group, and as you can see above, it comes before City in the Command tine. The order from outer to inner must be reflected in the way you build up the Command Line, or Superbase will be unable to keep track of the subtotals. The Rule is: Specify field groups from the outer level inwards. ,_/ Example Output For this example, we also need to set the Order command line - see page 11-23. If the Order line was specified by the field Country, the first page of our example report would look like this: Country City Australia Free/llantle Group count 1 Freelliantle Australia Australia Australia Sydney Sydney Sydney Group count 3 Sydney GrQup count 4 Australia Year_to_date Balance ................... ., .... £400.00 --- .............. £400.00 £76.00 ........................ ...-- .. - .. -- £242.00 £239.00 £2000.00 £1'1.1'10 £40.01'1 £199.95 ......................... £76.00 .. ............ . . £249' .00 £239.95 ............................ £2991.00 .. .............. ........... "' ............ .. .............. -.. £315.95 Using Query 11-18 Summary Reports You can obtain a report that suppresses the main detail of the query output and prints just the summary information. Click on the Summarize button to activate this feature. Ifyou wanted a summary report based on the one above, but without the mean information, the Report Command Line would be: SUMMARIZE REPORT SUM Year_to_Date, Balance COUNT GROUP Country SUM Year_to_Date, Balance COUNT GROUP City SUM Year_to_Date, Balance COUNT The report output would look like this: Country Balance City £400.00 £76.BB £2481.09 £239.95 £2881.09 £315.95 £2881.011 £315.95 Group count 1 Freemantle Group count 3 Sydney Group count 4 Australia Report count: 4 Derived Columns If you want to apply report features to derived columns, you can. However, you must refer to the derived column expression by the name you gave it with the AS Heading feature in the Query Fields dialog. For example, the Query Report Command Line for subtotalling a derived column where the original expression was Year_to_Date * 0.15 and the AS Heading text was "15%" would be: GROUP Country SUM Year_to_Date,Balance,"15%" You would enter "15%" into the Value Box in the usual way. Obviously you must ensure that each item of AS Heading text is unique, or Superbase may confuse one expression with another. Using Query 11-19 Overflow in Subtotals or Totals Every time you request totals for a numeric field, you run the risk of creating a format overflow. Suppose you had a numeric field with a format "999.00", defined at this length because the field itself can never exceed 999 in value. If the total were to run into four figures, as it would if even just 10 records had the value of 100 in this example, the format would not be able to handle it, and Superbase would print or display number signs: ###.## To prevent this happening, you must adjust the field format in the File Definition. Select Project Edit, select the field to be adjusted, and click on the Numeric button. Then increase the length of the format by clicking on the upper left arrow on the Number Format Panel. Exit from the Number format dialog, then from the File Definition dialog, both times by clicking on OK. Then select Cancel on the Save File Definition dialog. Now Superbase will use the expanded numeric format for all the numbers in the column, as well as subtotals and totals. You may prefer to make such changes permanent, by saving the File Definition with the expanded format. Totals for Non-Printing Fields You may request totals for fields that do not appear in the Query Fields Command Line. Superbase prints such totals without a column heading after any totals for fields that are being printed. Using Query 11-20 Query Filter The Filter button calls up a dialog very similar to the Filter dialogs used in the other functions on the Process menu. Ifyou don't want to restrict the records selected for the query output, leave this line blank. If you're leaving the Filter line blank, don't click on the Filter button, and go on to the next section. If you want to set up a Filter, click on the Filter button. Superbase displays the Query Filter dialog. Query filter File: ADDRESS ~ The Query Filter is very similar to the Filter that you're familiar with from the Control PaneL However, this Filter allows you to select fields from any of the open files being used in the Query. Above the Field Name Panel is the File Name Box containing the name ofone ofthese files. The field names in the Panel belong to the file whose name appears in the box. If you want to see the fields for the next open file, click on the upward pointing arrow to the right of the File Name Box. Apart from this difference, the Query Filter works exactly like other filters. You click on a field name, then on an operator, then in the Value Box or on another field name. (Remember to press Return after you've entered a value in the Value Box.) Superbase builds up the Filter Command Line in the Main Box as you make selections and enter values. Using Query 11-21 Relational Queries If you're new to databases, or you have no intention of finding out how Superbase handles multiple files, you may wish to skip this section. It's intended for those users who want to explore the possibilities of linking files together to form a sophisticated database system. File Design Although the design of the individual files that comprise a database is important to the successful implementation of a complex or multi file system, it is too large a topic to be covered in this Guide. Advanced users should consult appropriate publications. 4 In your case, as in every case, a database meets the needs of a particular application. This makes it difficult to give much general advice beyond a few basic points: • Keep record and index key sizes small. • In each file that is to form part of a multi file query, set up a field to be used for linking across files. The field names do not have to be the same. • Place an identifier such as a record or customer number in this field. For every pair of files to be linked, there must be identifiers that are the same in both files, yet unique within each. • Index files on all identifier fields used for linking. • Base transactional records such as invoice line data on a single trans action with no repeating fields. 4 Query Filter Command Line Rules Creating an efficient Query Filter is something you have to learn. Even sophisticated users of mainframe databases often find that the results oftheir first attempts at a query are not exactly what they want. It's important to have a realistic level of expectation, to avoid frustration. Realize that the process of experimentation and feedback is normal. A query is multi-file when fields from more than one file are named in the Query Fields Command Line. For a multi-file query to work, you must specify links between the files. A link is known as a 'join' in the jargon. A join takes the form of two fields joined by an EQUALS operator: Custref.lnvoices = Custnumber.Address. You can have joins between more than one pair of files, and a file or field may appear more than once in the series of joins. Using Query 11-22 Although Superbase, true to its philosophy, allows you to create a Query Filter in almost any form, only certain techniques will work properly. To make this clear, we have come up with eight important rules for building up Query Filter Command Lines. Rule One When linking any two files, there must be a link between them in the form of record identifiers that are the same in both: Custref.lnvoices = Custnumber .Address Rule Two Do not use OR expressions when linking across files: Custref.lnvoices = Custnumber.Address OR CustreUnvoices Custname.Address. = Rule Three Use only the EQUALS operator when linking between files. Rule Four Place all expressions that link across files at the start of the Filter Command Line. Rule Five. Later in the Command Line, if you want to use an OR expression, enclose it within parentheses: ( City = "London" OR City = "New York" ) Rule Six Sequence all filter expressions in an order from most precise to least precise. For example: = CustNumber CustRef AND Country LIKE "England" AND Balance > 1000 AND ( Name LIKE "smith" OR Name LIKE "jones") The join comes first, followed by a string match on "England", which is a single value - quite precise. Then comes a GREATER mAN expression less precise, as many values can be greater than 1000. OR expressions, whatever the degree of precision involved, always come last, inside parentheses. Rule Seven Files are processed in the order in which they are mentioned in the WHERE statement (Query Filter Line). In some cases you will want to process the smallest file first, in some cases you won't. You may have to experiment to find the optimum query for a particular application. Using Query 11-23 Rule Eight Every file reference in the WHERE statement or Query Filter line must be part of a chain. WHERE A = B AND B = C is acceptable, but WHERE A =B AND C =D is not. A simple rule of thumb is that there should always be one less join than the number of files in the query. Caution: These Rules must be followed. Ifthey are notfollowed, you could end up with queries that produce enormously repetitive and meaningless results, and take a very long time to do so. If you want to interrupt a Query, click on the Stop button. The process will only halt on retrieval of data that matches the selection criteria. Alternatively, you can use the key combination Control-C to stop a process. Query Order The Order button allows you to specify a sorted order for the query output. Ifyou don't specify any order, Superbase will present the records in the order in which it finds them on the disk. Most probably, they will not be in any alphabetic or indexed order. As this is the fastest way of retrieving information from the disk, you may want to use it in certain situations where the order of presentation does not matter. And if you're creating a new database you should definitely avoid specifying an order, to speed up the processing. However, in the majority of cases, you'll want to see the records ordered, especially when: • • ~. Indexed order, such as date order, is an important part of the file. You have set up subtotals on the Report line. If you don't want to specify any order, don't click on the Order button. Skip to the next section to complete the Query Definition. Ifyou do want to add order features to the query, click on the Order button; Superbase displays the Query Order dialog. The Query Order Dialog This dialog allows you to select fields for sorting from any file, specifying whether each one is to be sorted in ascending or descending order. You can select fields from any of the open files being used in the Query. Above the Field Name Panel is the File Name Box containing the name of one of these files. The field names in the Panel belong to the file whose name appears in the box. If you want to see the fields for the next open file, click on the upward pointing arrow to the right of the File Name Box. 11-24 Using Query To the right of the Field Name Panel are the buttons for the Ascending and Descending options. The procedure is quite simple: 1. 2. 3. Click on a field name. Click on either Ascending or Descending. Repeat with other fields if necessary. The default length for sorting is 15 characters per field. Superbase gives equal weighting to upper case, lower case and accented instances of a character. Caution. You will need to have an area offree memory before you use Query Order. When you're finished, click on OK to return to the main Query Definition dialog. Superbase copies your selections into the Order line. Single and Multiple File Sorting Outputting records from a single file is comparatively easy, and Superbase performs the operation without affecting the file itself. If you specified an order using just a single index, Superbase outputs the data as it finds it. But if your Order request includes several fields. you may have to wait a while for Superbase to create a temporary file prior to producing the query output. The temporary files are identified by the names "sb.tmp" and "sb.srt". However, if you are using more than one file, Superbase has to do quite a lot more work. Although the amount ofwork varies depending on the precise Order request you set up, essentially it means that Superbase can't tell what the final order is to be until it's finished reading all the files. Consequently, you may have to wait for the results of the query while Superbase places all the data that is to be output into a new file, which is indexed according to the order you specified. When this is done, Superbase switches to an output phase, and produces the results you want. 11-25 Using Query Query Output Destination You select the destination for the query output by clicking on the appropriate button; then click on OK to run the query. OK Always directs output to the Screen. Print Always directs output to the Printer. Disk This selection creates an ASCII disk file containing the query output. The output is formatted as if it were being printed, so provided the file is not too large for your word processor, you may be able to load and edit it like an ordinary text file. Say Amiga only. If you select Say, the Amiga will output the Query data as speech, using the built-in speech facility. File Creates a new Superbase file. See below. After selecting a device other than the screen you need to click on OK to start the output process. Output to File This selection creates a new Superbase '.sbf file with a file definition consisting of the fields and/or formulas specified in your Query Fields line. The new file is indexed on the first field that was indexed in the original files, or, if you did not select any indexed fields for output, on the first field in the output. Superbase ignores any formatting or reporting elements in the query. Derived items are treated as new fields, but you must ensure that the text set with Heading is valid as a field name. Once you've selected your output destination you must click on OK to initiate the Query output. The Disk and File options require you to enter a name for the file you're about to create. CHAPTER 12 QUICK REFERENCE GUIDE This section of the User Guide allows you to find out quickly what each Superbase menu option is for. If there is a keyboard equivalent for a menu option, it is given as Alt/Amiga followed by the key. In Gem versions of Superbase you press Alt in combination with the key; on the Amiga, press the right Amiga key. Project Menu The Project menu contains the main options for managing the database: selecting the files, fields, and indexes for other menu options to use. Project New File Create a new file. You enter the field names, formats, and attributes, plus any required formulas and input validation checks. The system then creates a file with a '~sbd' extension to hold the file definition and a file with a '.sbf extension to hold the record data. Project New Index Create a new index. Indexes can be used to display the records within a file in different orders, and for quick retrieval of records. Once you have created a new index, an index file will be created in the directory. This will have the same name as the file with an extension consisting ofa full stop and a number. Project Open File Open an existing file. You can open more than one file at anyone time, but only one can be the current file. The Query and Update functions can use multiple files. The number of files you can open depends on the amount of available memory. Keys: Alt/Amiga O. Project Open Fields Open a list of fields. Once you have opened a file you can choose which fields to view, and so limit the amount of space each record takes up on the screen. This option enables you to choose those fields you want to see, for each record within the current file. If you have not opened a list of fields, then all the fields for the current file will be displayed. Project Open Index Choose and open an existing index. The records in the current file are presented in the order of the open index. Keys: Alt/Amiga I. 12- 2 Quick Reference Guide Project Close File Close an open file. This option lets you choose which of the open files you want to close, reducing the amount of memory needed by Superbase. Project Close Fields Close a list of fields. Once you have closed the list you can view all the fields within the current file, instead of only those you have opened. The list of fields is still available and you can re-open it with Open Fields. Project Edit File Change the definition of the current file. You can add or delete fields, change field names, field lengths and field types, as well as any formulas or validation checks. Project Save File Save the current definition of the current file. H you have made any changes to the file definition using Edit File and you wish to make them permanent, you should do so using this option. Project Remove File Remove an open file from the disk. The '.sbd', ',sbf' and all index files associated with the selected file are deleted. Project Remove Index Remove an index from an open file. The relevant index file is deleted. Project Text Select the Text Editor. This option opens the Text Editor window and activates the Text Editor menus. Project Quit Exit from Superbase and return to Desktop (or Workbench). Record Menu The Record menu contains all the options for entering and editing data into a file. Record New Enter a new record into the current file. Superbase presents a blank record and you type the data into the fields. H you have opened a list of fields, then you can only enter information into those fields. Keys: AltJAmiga N. '-.-. Quick Reference Guide 12-3 Record Edit Change the details of the current record within the current file. The record you wish to edit must be the current record. You can only edit those fields you have opened. If you are viewing the current record in Table format and you select this option, Superbase automatically switches you to View format or Form format and sets the Paging option on. Keys: Alt/Amiga E. Record Batch Turn Batch mode on or off. Batch mode reduces the time taken to save records on disk. Thrn Batch on when you are saving, removing, or editing a number of records, one after the other. Record Duplicate Make a copy in memory of the current record. This can then be edited and saved as a new record. The function saves time when you are entering the same or very similar information into more than one record. Record Remove Remove the current record from the file. Superbase waits for your confirmation before finally removing the record. Record Save Save the current record in the current file. This is used after you have entered record details with New, Edit or Duplicate. You can call up the Record Save dialog at any time by double clicking the mouse. Keys: Alt/Amiga S. External> > This option is used to manipulate the external files associated with a single record. This option enables you to display the next image within the current record, which could either be a picture or a text file. External < < This option is used to manipulate the external files associated with a single record. This option enables you to display the previous image within the current record, which could either be a picture or a text file. Process Menu The Process menu options cover all the main database processing requirements: searching, sorting, reporting, updating, deleting, importing, exporting and label printing. All options allow the use of a Filter to determine which records are to be processed. 12-4 Quick Reference Guide Process Update Edit Run an Update, edit an existing Update which has been loaded from disk, or create a new one. Use this option for automatic update of one or more fields within a set of records from one or more files. The Filter can refer to more than one file. Process Update Load Load an Update from disk. Superbase also opens the database files associated with the update. Process Update Save Save the current Update on disk. Superbase stores the update filter and fields setting on disk in a '.sbu' extension file. Process Query Edit Run a Query, edit an existing Query which you have loaded from disk, or create a new one. Query allows you to interrogate the database and retrieve information from one or more files. You can include report formatting and analysis functions in the query. The results may be sorted in any order, and then output to the screen, the printer, a disk file, or a new database. Process Query Load Choose and open a Query previously stored on the disk with Query Save. Superbase also opens the database files associated with the query. Process Query Save Save the settings for the current query. Superbase stores the title, settings for totalling, etc., and the Filter and Sorting instructions as they were last set up with Process Query Edit, in a '.sbq' extension file. Process Remove Remove a group of records from a file, according to the values and conditions set in the Remove Records Filter. Process Import Import data into a Superbase file. You must first set up the necessary file definition. You can select the field and record separators to match the format of the import file. A Filter determines which records are accepted into the file. Process Export Export data from a Superbase file. The function uses the current set of fields and a Filter. You can define your own field and record separators. Quick Reference Guide 12- 5 Process Print Produce a listing of the current file. The function outputs the current fields to the printer using Table format. A Filter determines which records are selected for printing. Process Mail Merge Merge data from records in database file, with a form letter created in the Text Editor. The database must already be open; but if you haven't opened the text file which holds the form letter, Superbase will present a file dialog where you can select a text file for your mail merge. Process Labels Print a selection of labels. You can print labels up to four across. Up to four fields may be placed on each line of a label. A Filter determines which records are selected for printing. Label settings are saved with the 'sb.par' file when you click on OK in the Options dialog. Set Menu The Set menu contains a number of options which directly affect the way data is processed and presented. Set Screen Send all output to the screen. Set Printer Copy all output to the printer. Set Table View Set the screen display to Table View. When you set this option the field names appear across the top of the screen, with the data for each field in the same column as the field name. Keys: AltlAmiga T. Set Form View Set the screen display to Form View. You can rearrange the line and column positions of the fields in Form View by dragging them around the screen. The arrangement of fields last saved with Project Save File is recalled when you set this option. Keys: AltlAmiga F. Set Record View Set the screen display to Record View. When you set this option the field names will appear down the left hand side of the screen, with the data for each field on the same line as the field name. Keys: Alt/Amiga R. 12-6 Quick Reference Guide Set Paging Switch Paging on or off. This allows you to choose whether you want to see the data in a continuous list (Paging off), or a page at a time (Paging on). The Record menu data entry options all switch Paging on automatically, as does Set Form View. Set Options Lets you alter the system settings. These include: the speed at which records are scrolled onto the screen; the currency symbol; the format for thousands and decimal point separators; import and export field separators and external file handling controls; the start directory and the directory for the parameters file; printer initialization sequence for the Amiga;and a number of other features. Set Number Format Choose the format for temporary numeric data such as the product of a multiplication of two fields. Set Daterrime Format Choose the format you want temporary dates or times to appear in, and set the Superbase system date and time. System Menu The System menu includes a number ofutilities to increase your control over the database. Version (Amiga only) Display the Copyright Notice and the program version number. Printer Options (Gem versions only) Allows you to select your paper size and paper types for use with the printer you have connected to your computer. On Gem versions, you can also set the printing mode to either Draft or Graphics. System Directory List Produces a sorted list of the contents of your current directory. This can be sent to either the screen or the printer. Keys: Alt/Amiga D. System Directory Change Switch to a new directory or subdirectory. Keys: Alt/Amiga X. System Status File Gives you a report of the status of the current file, including selected statistics. The output of this and the next function can be printed by setting the Printer option on. Keys: Alt/Amiga Y. Quick Reference Guide 12-7 System Status System Gives you a short form report of the status of all the open files. Keys: Alt/Amiga Z. System Reorganize Reorganizes your database. This will be needed once you have been using your database for a while, and is used to tidy up the file space and make access time quicker. System List Produces a listing of any text file in the directory. The listing will appear On the printer if the Printer option is selected on the Set Menu. Note: This option can only be used with ASCII (non-document) text files. Keys: AltlAmiga L. System Delete Delete any file on disk. Use this option as an alternative to the file deletion facility provided by your computer's operating system. System Rename Rename any file On disk. Use this option as an alternative to the file rename facility provided by the computer's operating system. System Copy Copy any file on disk. Use this option as an alternative to the file copying facility provided by the computer's operating system. APPENDIXA ERROR MESSAGES A file must have at least one index If you need to remove and rebuild the only index to a file you must first build a temporary one on another field. To change from a unique to a duplicate index, you must remove and rebuild it. Access to file not allowed The file requires a password. Password protection cannot be removed and passwords cannot be changed. If you want to dispense with password protection for a file, you must export all the data and then import it into a new file. Can't access directory System error or the directory doesn't exist. Check that the correct disk is inserted. Can't access disk information System error. DOS cannot return directory information. Can't AND illegal values The AND operator cannot handle values greater than 2,147,483,647 or less than -2,147,483,647. Can't divide by zero Divisor in an expression or equation is equal to zero. Can't find this field Usually caused by mis-spelling a field name. Superbase treats any text item that is not a string variable or a reserved word as a field name. This message will be generated if the field referred to does not exist. Can't find this file Usually caused by mis-spelling a file name in a command line. Superbase treats a text item following a field name and a period (full stop) as file name. This message will be generated if the file does not exist. Can't open the printer Physical system error. Check that the printer is correctly connected and switched on. Can't OR illegal values The OR operator cannot handle values greater than 2,147,483,647 or less than -2,147,483,647. A-2 Error Messages Closing parenthesis missing Error in formula or query command line. There must be an equal number of opening and closing parentheses. Data too long for field Occurs when the data you are trying to store in a field is longer than the length of the field as set in the file definition. Edit field length if necessary. DOS can't open file System error while trying to open a Superbase '.sb£' or index file. DOS can't open input file System error while trying to open a Superbase •.sbd' or other sequential file for input. DOS can't open output file System error while trying to open a Superbase '.sbd' or other sequential file for output. DOS error deleting file Disk error while attempting to delete a file. DOS error reading data Disk read error while reading a Superbase '.sb£', an index file, or other sequential files. DOS error reading file Disk read error while reading a Superbase '.sbd' or index file. DOS error writing data Disk error while writing a Superbase '.sb£' or index file. DOS error writing file Disk error while writing a Superbase '.sbd' or other sequential file. Duplicate entry for this index Index in use allows unique entries only. Can occur when saving a record or importing records leaving blank index fields. End of external file Image Advance produces this message when the external file is only one screen or 'frame' long. End of file Information message. Error Messages A-3 Error while renaming file Disk error. The most likely explanation is that the disk you are using has been corrupted. Try renaming the file to another disk:, or saving it first in another directory. External file not compatible External picture files must be '.img' compatible (or IFF on the Amiga) for Superbase to be able to display them. External file not found Occurs when the file named in an External File field is not found where it should be. Check directory and/or path name and/or disk volume name. Field already exists Each field name in a File Definition must be unique. Field already has an index Occurs when you attempt to create an index on a field which already has an index; for example, with the New Index option or with the CREATE INDEX command. Field does not match validation If a field has a validation formula you must enter data within the formula's limits. Errors can occur during Import or when editing records. Use System Status File to read Validation formulas. Field not defined Program error. You have referred to field which does not exist if you type a variable name incorrectly, Superbase will assume you are trying to access a field and will issue this error message. Field requires numeric data You cannot assign text data to a numeric field. Field requires text data You cannot assign numeric data to a text field. File already exists Superbase will not allow you to overwrite an existing database file. File contains non-text characters megal control character detected in Superbase '.sbd' or other sequential file. File data in wrong format Illegal field and/or record separator detected during Import. Also occurs with other sequential files when the format is incompatible with the function you are trying to execute. A-4 Error Messages Formula too complex Evaluation capabilities have been exceeded. Function not allowed with text Mismatch of function and arguments. See Appendix C. Function not allowed with number Mismatch of function and arguments. See Appendix C. Function syntax - comma missing See Appendix C. Function syntax - invalid parameter See Appendix C. Incomplete field or value missing Superbase has detected an error in a formula or a command line. Check that expressions are complete and do not end with an operator. Insufficient memory You will see this message when you try to view an External File or do a sort using Query Order, and Superbase cannot find sufficient memory to do the operation. See Appendix H for instructions on how to gain extra memory. Invalid date The full date range is January 1,0001 to December 31, 9999. You have probably entered a date in the wrong day, month, year sequence giving a month number greater than 12, or tried to enter illegal text or date separators. Invalid date format Program error, or '.sbd' file invalid. Invalid field name Reserved words are not allowed: see Appendix D. Field names may not begin with numbers, and should include only alphanumeric, space and underscore characters. Invalid field type Program error, or '.sbd' file invalid. Invalid numeric format Program error, or '.sbd' file invalid. Invalid numeric parameter Illegal value for a function. Error Messages A-5 Invalid parameter Program error. Check the syntax for the command or commands in the line which caused the error. Invalid text parameter megal value for a function. '--/ Invalid time The time range is from 0:00 to 23:59 (or 11:59 pm). You have entered a time which falls outside this range, e.g. 25:06. Name too long Field name exceeds limit of 15 characters. No external file field defined You have clicked on the External File (camera) button when the current file has no External File fields in its definition. No more images for this record External Next or External Previous cannot work when you are already looking at the last or first image respectively for the current record. No record selected Program error. You have referred to a record without having opened the file it belongs to. No record with this key Appears for your information whenever a key lookup doesn't find an exact key match, even if you used a partial key entry to retrieve the record. Not an index Your attempt to open or remove an index failed because the index file does not exist. Number too large Superbase handles numbers up to 1.797693134862e308. Number too long Exceeds permitted format maximum of 13 digits. Opening parenthesis missing Error in formula or query command line. There must be equal number of opening and closing parentheses. Operator not allowed with text Only certain operators may be used with text items; e.g. you cannot multiply text items. A-6 Error Messages Print command failed Failure occurred during a printing operation. Problem positioning in data file Superbase system error. Restart. Occurs when Superbase tries to read a record which does not exist. The cause may be that you have swapped disks without first closing files or changing the directory. You should always close any open files before changing disks. Problem reading external file Error within external file. Problem with console device Amiga only. It may mean that there is not enough memory, in which case you should try closing any files that are not needed; or it may indicate an operating system error. Problem with narrator device Amiga only. It may mean that there is not enough memory, in which case you should try closing any files that are not needed; or it may indicate an operating system error. Remove index before deleting field You cannot remove an indexed field from the File Definition until you have made it a non-indexed field by removing the index. SUPERBASE error deleting key: 100/101/102/103 Superbase system error in index. Remove and rebuild index. SUPERBASE error reading block: 200/201 Superbase system error in data file. Export data and import into a new file. This field must have some data This field is a required field. If a file contains required fields, you must enter data in these fields when you are creating a new record. Undefined error Internal Superbase system error. Please notify software supplier. APPENDIX B THE LIKE OPERATOR LIKE is the operator you should use when searching for text strings in fields. This means that you will use it very frequently in Superbase's Filter Command Lines to define and select the records you want to view or process. LIKE allows you to use pattern matching characters so you can define text strings with fixed patterns of characters whose content may vary, or text strings of indefinite length as well as content. You can also use square brackets to define specific ranges of characters to be accepted by the Filter. LIKE Syntax LIKE "*" LIKE "?*" LIKE ''text'' Searches for empty fields with '*' on its own Searches for fields that are not empty Field with content "text" The asterisk represents a text string of any length: LI KE ''text*'' LI KE H*text" LIKE u*text*" "Text" string at start of field ''Text'' string at end of field ''Text'' string anywhere in field The question mark represents a single character: LIKE H???" LIKE "?text'?" LIKE "'?text*" Fixed length, any content Fixed length, fixed content "text" Fixed leading length/content, any length A range inside square brackets may be used in place of a question mark character: LIKE "[a-m]" LIKE H[adg_j]*" Single character range 'a' through 'm' Character 'a', 'd', or 'g' through 'j' The caret or up arrow at the start ofa bracketed sequence signifies exclusion: LIKE "[ A n_w]H Excludes characters 'n' through 'w' You can combine different elements of the pattern matching syntax: LIKE "a??[c-h]?x*" This matches 'a' in the first position. any character in the second and third positions, the range from 'c' to 'h' in the fourth position. any character in the B-2 The LIKE Operator fifth position, 'x' in the sixth position, and any number ofcharacters following the 'x'. Examples Each of the examples uses the demonstration Address file. Example 1 Suppose you want to find the records for the customers whose forename is 'Robert'. You would have to enter the following in the Filter Command Line box: Forename LIKE "robert" Notice that we don't trouble to enter an upper case 'R', as the LIKE operator is case insensitive. You can try this out now if you wish. Once you have entered this Filter Command Line, click on OK. Superbase will then display all the records where the Forename field is LIKE "Robert"; in fact there is only one, which is record number DALO001. Example 2 Supposing that you don't know the full forename you're looking for, but you know that it starts with an's'. Again you can use the LIKE operator to help you. You would need to create the following Filter Command Line: Forename LIKE "s*" The '*' is important, because you are telling Superbase to find any record that starts with an's' and can be followed by any number of characters. If you create this Filter Command Line and click on OK you'll find that Superbase will list four records, starting with Steve Buchanan's record. Example 3 What if you don't know which letter the forename starts with, but you know that it contains an 'r' somewhere in the spelling? To find the record this time you would have to use the following filter: Forename LIKE "*r*" Once you've entered this filter you should get 12 records, which each contain an 'r' somewhere in the forename. The LIKE Operator B-3 Example 4 Although this is a slight digression, it's useful to be able to NEGATE a LIKE expression. I£you want to get all those forenames which don't contain an 'r', you can change the previous Filter Command line to read: NOT (Forename LIKE "*r*") This will list the forenames which you didn't get in Example 3 Example 5 Taking our example a step further, supposing you want those records where the fourth character of Forename is an 'r'. In order to do this you would use the following Filter Command line: Forename LIKE "???r*" Superbase will list three records from the Address file. Example 6 Suppose you don't know any of the letters in the Forename, but you know it contains five characters. You could find the record with the following Filter Command line: Forename LIKE "?????" This time Superbase will list those records whose Forename is five characters long. If you want to find those records where the Forename is at least five characters long, you can type an '*' after the five question marks. Example 7 LIKE also allows you to search for ranges of characters. Suppose you want to list just those records where the Forename begins with 'a', 'b', or any letter between 'j' and 'm'. The Filter Command line should read: Forename LIKE "[abj-m]*" Notice that whatever is inside the square brackets represents a single character. If you want to specify ranges for more than one character in a string, you must use a set of square brackets for each one. APPENDIX C FUNCTIONS The terms in italics indicate the type of argument each function takes: X and N must be numeric values. The value can be supplied by a numeric field, a numeric constant (i.e. a number), or the result of a calculation or another function. Examples are: I NT(Total 1(TotaI2) INT(235/52) INT(SQR(numfield» X$ must be a text string. You can enter the name of a text field, a text constant (i.e. a string of characters enclosed in quotation marks), a concatenated string, or the result of another function. Examples are: RIGHT$("Mr Smlth",4) RIG HT$(Name.Address,4) LTRIM$(Code + "I" + LEFT$(Lastname,3» The other terms -file name, date, time, etc. - should be self explanatory. File names must be enclosed in quotation marks. The values for date and time can be supplied by date and time fields, the results of calculations involving date and time fields, or system variables (TODAY and NOW). ABS(X) Returns the positive value of X ASC(X$) Returns the ASCII value of a single character. ATN(X) Returns the angle measured in radians, whose tangent is X CHR$(X) Returns the text character associated with the ASCII code value inX COL(O) Returns the current screen column. COS(X) Returns the cosine value of X, where X is an angle in radians. C-2 Functions DATE$(date (,datefonnat]) Returns a text string from a Superbase date field or a julian date number, using optional format. DAY$(date) Returns the day of the week as a text string. DAY (date) Returns the day of the month as a numeric value from a date field or a date string. DAYS(date) Returns the julian date number of a date field or date string. DISKSPACE(disk name) Returns the amount of free disk space. EOF(filename) Returns the value of -1 when the end of a file is reached. ERR$(N) Returns the error message for error number N. EXP(X) Returns the mathematical constant 'e' (2.71827183) raised to the power of X. FCASE$(X$) Capitalizes the first letter of X$. FIX(.X,N) Sets the number of decimal places to which the numeric expression X (which may be a field) is stored. FOUND (file name) Returns a numeric value which depends on the result of the last key lookup search. If the search was successful, it returns -1, otherwise it returns O. FREE(N) Returns the amount of free memory. On the Amiga, the value of N determines whether FREE refers to chip memory, fast memory, or the total amount of free memory. Use 2 for chip memory and 4 for fast memory. If you enter the value of 0, FREE returns the total amount of free memory, both on the Amiga and other versions of Superbase. HRS(time) Returns the number of hours from a time field. Functions C-3 INS1R(N,x$, Y$) Returns N as the starting character position of substring Y$ within the string X$, or 0 if the string is not found. INT(X) Returns the integer value of a number. LCASE$(X$) Returns the lower case equivalent of a text string or field. LEFf$(X$,N) Returns the leftmost N characters of a text string or field. LEN(X$) Length of string. LEN(X$) Returns the length of a text string or field . .~ LOG(X) Returns the natural log of a numeric field or number. LOOKUP(jieldl,/ield2) Validates the data in fieldl by checking to see if it exists in field2. Field2 must be a field in another file. L1RIM$(X$) Trims leading spaces from X$. MID$(X$,M,N) Returns a substring of length N beginning at character position M from within a text string or field. MINS(time) Returns the number of minutes from a time field. MONTH$(date) Returns the month of the year as a text string. MONTH(date) Returns a numeric value for the month of the year. PCOL(O) Returns the current printer colunm. PROW(O) Returns the current printer row. C-4 Functions RECCOUNT(file name) Returns the number of records in file. REPLICATE(X$,N) Replicates X$ N times. RIGHT$(X$,N) Returns the rightmost N character of a text string or field. RND(X) Returns a randomly generated number between 0 and 1. If Xis 0 the number is the same as the previous one. If X is less than zero, the function is reseeded. If X is greater than zero, a new number is generated. SECS(time) Returns the number of seconds left over after subtracting the number of hours and minutes. SER(file name) Returns the serial number of the specified file. SGN(X) Returns a value depending on the value of X: -1 for negative or equal to zero, 1 for positive. SIN(X) Returns the sine of X where X is a value in radians. SPACE$(N) Returns a text string with N spaces. SQR(X) Returns the square root of X S1R$(X) Returns the text string equivalent of a number or numeric field. TAN(X) Returns the tangent of X where X is a value in radians. THOUSECS(time) Returns the number of thousandths of a second left over after subtracting seconds, minutes and hours. TIME$(X;time format) Returns a time string from X using optional time format. Functions TIMEVAL(time) Return the value of a time string in thousandths of a second. 1RIM$(X$) Trims trailing spaces from X$. UCASE$(X$) Converts a text string to upper case. VAL(X$) Returns the numeric equivalent of a text string or field. YEAR(date) Returns a numeric value for the year. C-5 APPENDIX D RESERVED WORDS <~< ~< ADD AFTER ALL AND APPEND AS ASCENDING ASK ATTR BEFORE BELL BF BG BLANK BREAK BUFFERS CALL CHAIN CLEAN CLOSE CLS CONTAINS COPY COUNT CREATE CURRENT DATA DATEBASE DEBUG DELETE DESCENDING DIM DIRECTORY DISK DISKSPACE DISPLAY DOWN DUPLICATE EDIT EJECT ELSE END ENDREPORT ENTER ERASE ERRNO ERROR EXECUTE EXPORT FG FIELD FILE FIRST FIX FOOTING FOR FORM FROM GET GOSUB GOTO GROUP HEADING HOME IF IMPORT INDEX INPUT IT KEY LABELS LAST LET LIKE LINE LIST LOAD LOCATE MAKE MEAN MEMORY MENU MERGE MOD MODIFY NEW NEWLINE NEXT NOT NOW NUMBASE OFF ON OPEN OR ORDER OUTPUT PAGING PASSWORD PG PI POSITION PREVIOUS PRINT PRINTER PROTECT QUERY QUIT READ RECORD REM REMOVE RENAME REORGANIZE REPORT REQUEST RESTORE RESUME RETURN RUN SAVE SAY SCRDUMP SELECT SET SHOW STATUS STEP STORE SUBTOTAL SUM SUMMARIZE TABLE TEXT THEN TO TODAY UL UNIQUE UPDATE USING VIEW WAIT WEND WHERE WHILE APPENDIX E ",-,-"' ASCII Values ASCII Decimal ASCII Decimal NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF 0 1 2 3 4 5 6 7 8 9 Space 10 11 * FF CR SO SI DLE DC1 DC2 DC3 DC4 NAK SYM ETB CAN EM SUB ESC PS OS RS US 12 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 vr c~/ ~~ ,~ ! # $ % & ( ) + 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 I 0 1 2 3 4 5 6 7 8 9 59 = ? 60 61 62 63 APPENDIX F CHANGES IN SUPERBASE This appendix lists the major new features that have been incorporated in this version of Superbase. Query and Update • Update files can be saved and loaded from disk. • Loading a Query or an Update opens the associated database files. EFMS facilities • Improved facilities for handling external text files. • Search facility with external text files. • Amiga only: EFMS supports IFF sound files or digitized sound data. Support for text files now available on the Amiga. New field types '--./ ..~ -"---' • Time type field HH:MM:SS. Time field values are stored as thou sandths of a second. Time arithmetic automatically manipulates time values from hours to thousandths of a second. Both 12 and 24 hour 5 clock formats are supported. • Serial fields supported through SERO function. Provides ability to generate an automatically incrementing value for new records. • Addition of text field attributes. Text fields may be specified as upper or lower case, or capitalized. • Bulk text or memo type fields can be created as EFMS text files. They can be edited via the text editor. • Multiple response fields. You can specify up to nine entries for a text field. Individual response elements can be referred to by subscript in queries. • Constant field types. Editable initial values. • Read only field types F-2 Changes In Superbase Data entry support • Batch menu option to speed up data entry and record removal. • Storing a record presents a blank record for the next entry. • Cross-file validation for relational lookup using the LOOKUP function. • Cross-file calculation for relational data checking. • Ternary calculations for conditional validation/calculation. • Ability to have a validated calculation. • Help/Error messages for fields not matching validation. New Options • Query temporary file destination - the user can specify a destination for temporary files created by query. • Start directory (requires path for .par). • Specify trailing currency symbol. • Calculation options. • Custom screen on the Amiga. Indexing • You may attempt to create a unique index on an existing field. If du plicates are found you may continue or canceL Continuing produces a non-unique index. Default settings Superbase now saves the fol1owing additional default settings: • • • • Labels format. Number of disk buffers. Open field list for each file. New options (see above). Printer support • Printer initialization sequence for Amiga. • Raw output to printer on Amiga. Text editor • Allows creation of external text files and mail merge letters. Also suit able for a wide range of wordprocessing type applications. Changes in Superbase F-3 Mail merge Available from the Process menu. Allows database file data to be merged with a document created in the Superbase Text Editor. New functions/commands • For functions, see Appendix C. • For commands, see Query Report, Chapter 11. Others • Two characters for import / export separators. • Speak button for query output (Amiga only). Using Superbase Personal Files in Superbase Personal 2 Superbase Personal is upwardly compatible with Superbase Personal 2; so if you have upgraded from one to the other, you can use any of the files that you created in Superbase Personal. (It doesn't work the other way round: Personal 2 files cannot be loaded into Superbase Personal.) However, there a number of differences in the way the two programs store file data. You should take these into account when you are loading Personal files into Personal 2. When you save the files, Superbase Personal 2 will automatically convert them to its own format. But in some cases you may need to edit your Personal files before you can use them. Here is a checklist of the points to bear in mind when converting files from Personal to Personal 2: • Personal 2 query files include the details of any database files associ ated with a query and these files are opened automatically when the query is loaded. If you use a Personal query in Personal 2, you will need to open the database files yourself before loading the query. Then save the query in order to convert it to the Superbase Personal 2 query format. • Although Superbase Personal does not offer a Constant field type, it allows you to create a special type of calculation formula which acts like a constant formula. For example, if you define a single word for mula such as "London" or TODAY it will have the same effect as the equivalent constant formula in Superbase Personal 2. When you load a Personal file into Personal 2, calculated fields will be defined as CLC RDO fields. If they were originally intended to act as constants, F-4 Changes in Superbase you should change the CLC attribute to CON by selecting Edit File and editing the file definition. You may also want to remove the Read Only attribute. • The list of words that are reserved for the use of the system is more extensive in Superbase Personal 2 than in earlier versions. (see Ap pendix D). As a result, you may find that some of the field names in your Personal 1 files are treated as reserved words in Superbase Per sonal 2. For example, Personal 2 offers a large of number of new func tions such as YEAR and HRS. If you have used YEAR as a field name, it would now become invalid. Before loading a Personal 1 file, check that the field names are valid; if they are not, change them by editing the file definition. APPENDIXG TUNING FOR OPTIMUM PERFORMANCE To obtain the best performance from Superbase, follow these guidelines: • Don't create unnecessary indexes. • Don't index fields that contain large numbers of duplicate entries, or have a small range of possible entries, such as "M" and "F" for gender. • If you work with a large file and you need to delete many records, re organize using the following procedure: 1. 2. 3. 4. Remove all indexes but one. Use Process Remove to delete the required records. Rebuild the other indexes. Use System Reorganize to create a compressed file. • If you consistently use one index with a file, you can improve perfor mance with this procedure: 1. 2. 3. 4. Make a backup of your data. Export all the data into a sequential file. Execute Process Remove to empty the database file. Import the data back into the file. • Uyou do not need to retrieve records in indexed order, use Process Query without specifying any Order fields; this is the quickest way of reading a file. APPENDIX H GAINING MORE MEMORY The advice given here only applies to Gem versions of Superbase which are running under MS DOS. On other machines, users are advised to close any open files that are not in use. This Appendix explains how you can gain more memory if you are having difficulty in displaying the pictures or text files from the External File System. There are two ways of doing this: 1. Rename your Desktop accessories. 2. If you have one, disable your RAM Disk. Rename your Desktop accessories This can either be done from the Desktop using the RenamelInfo option from the File menu, or using MS~DOS. To rename your desk accessories via MS-DOS you must first be in the GEMBOOT directory, which is on your Startup disk. So, change to that directory, then list the directory on the screen. The desk accessories are identified by the ".ACC extension to the filename. If you look at the screen you should see that you have "CALCLOCK.ACC and "SNAPSHOT.ACC" fI In order to temporarily remove them, you have to rename them something else other than ".ACC ", So, if we use the "Snapshot" as an example, you'll see how easy it is. Assuming you are at the MS-DOS colon prompt, type in the following: Rename SNAPSHOT.ACC SNAPSHOT.TMP Remember to press Return at the end of the line. If you now list the current directory, you will see that the extension has changed to ",TMP ". You can now follow this procedure for your other Desktop accessories. When you want to get them back on the Desktop, you simply rename them, remembering this time to use the extension' .ACC ' Once you've renamed all your desk accessories, remember to switch your computer off. This will free the memory used up by the desk accessories. Then start up your computer in the usual way. Gaining More Memory H-2 Disable your RAM Disk Note: This section applies to the Amstrad PC 1512. If your computer has a RAM disk, or if you have installed one, please refer to your User Manual to find out how to disable your RAM Disk. The program necessary to disable the RAM disk is on your Desktop disk, so make sure that you have the Desktop disk in your disk drive, and you are in MS-DOS. Now type in the following: nvr Remember to press Return once you've typed it in. A menu will now be displayed, which has an option "Size of RAM disk". Use the cursor control keys to move the pointer down the menu to select this option. A message will now be displayed telling you of the current size of the RAM disk. You should now set this to 2, not O. If you set your RAM Disk to zero you will have difficulty in loading your DOS and GEM Start-Up disks. Now press the Esc key to return to the menu. Move the pointer down the menu and select the last option, "Exit Menu". Press Return to save the alterations you have made, followed by another Return to exit back to DOS. You will now have to re-start your computer. So, switch off your computer and place your MS-DOS Disk in drive A. Now switch on your computer. Once the prompt appears on your screen, remove the MS-DOS Disk, and put in your GEM Startup Disk. Now type in "cd gemsys". Press Return. Then enter "gemvdi" and press Return again. You will now see the usual dialog appear on your screen asking you for your Desktop Disk. Now you can continue in the usual way. APPENDIX I THE PRINTER DEFINITION FILE The printer definition file contains information about the control codes used by the printer. Whenever you output data to the printer - whether as a text file, as program output, a query, a report, or by printing records - Superbase consults this file to fmd out which (if any) control codes it needs to send. The file is called SB.PRT and it contains three types of printing information: • Control codes for the Superbase print styles - bold, underline and italics. • A printer initialization sequence. This has the same effect as the printer option on the System menu. It allows you to define a se quence of commands which are sent to the printer before printing starts. • An unlimited series of character substitutions. This feature is primar ily for users who need to print characters which are not available from the keyboard such as foreign characters or certain symbols. Each of these three features is explained in more detail further on in this document in the section headed Creating a Printer Definition File. Many users, however, will not need to familiarize themselves with these details. The SB.PRT file which is supplied with your Superbase program disk is set up for Epson printers. Ifyou have an Epson printer or one of the many makes of printer that is Epson compatible, you can leave the SB.PRT file as it is. Also include on the program disk is a printer definition file for Diablo and compatible printers: DIABLO.PRT (compatible with Qume and Juki printers) If this matches your printer, you can substitute it for the existing SB.PRT file, using the Rename option on the System menu or the equivalent MS DOS command. Before doing this, you will need to rename SB.PRT as something else (such as SB.TMP). Then rename name the file DIABLO.PRT as SB.PRT. Owners of other makes of printer will have to create their own printer definition file, as explained in the next section. Note: It is important that you store the printer definition file in a directory where Superbase can find it. This should be the directory that is current after you have loaded Superbase. The SB.PRT file is loaded at the start ofa session with Superbase and it will then take effect for the rest of the session. 1-2 The Printer Definition File Creating a Printer Definition File SB.PRT is an ASCII file so you can edit it or create a new file using the Superbase Text Editor or any word processing program. If you create a new SB.PRTwith the Text Editor, you will need to load in the existing file, edit it and then save it under the same name. This way, you will ensure that it is saved as an ASCII file rather than in Superbase's text format. (It is in fact possible to create ASCII files from scratch using the Text Editor - see Chapter 10.) Similarly, with a word processor, you should take care that SB.PRT is saved as ASCII and not in the word processor's text format. This may mean that you have to type it in 'non-document' mode, or the program may provide an option for saving documents as ASCII files. The information in the SB.PRT file is interpreted according to its line number. Thus in the first line Superbase expects to find the control codes which turn underlining on, while the codes on line 7 will be interpreted as the printer initialization sequence. The exact sequence is as follows: 1. Underline on 2. Underline off 3. Bold on 4. Bold off 5. Italic on 6. Italic off 7. Printer initialization sequence 8. Attribution off sequence 9 onwards. Character substitution. If you wish to insert comments in the file, you can do so by entering a semicolon at the end of the line, followed by the comment. Alternatively, by placing a semicolon in the first column, you can enter a comment line on its own. If the first character is a semicolon, Superbase will ignore the line and will not take it as part of the control code sequence. The Printer Definition File 1-3 In the first eight lines of the printer definition file the control codes should be entered as numeric values separated by commas. For example, the SB.PRT file for Epson printers (which is the file Superbase uses by default) looks like this: Superbase printer definition EPSON type printers Same as Superbase defaults 27,45,1; 27,45,0; Underline on Underline off 27,69; 27,70; Boldon Bold off 27,52; 27,53; Italics on Italics off 27,45,0,27,70,27,53; Initialize: Reset all modes 27,45,0,27,70,27,53; Attr off : Reset all modes £ =35; Special for UK convert pound sign When you create your own SB.PRT file, you will have to consult your printer manual to find out which control codes are used to set the print styles. Usually, the codes will be given in two formats: as the ASCII control character ESC followed by one or two ASCII characters, and as the decimal values for these characters. (There may also be several single character controls such as SI, decimal 15, which sets condensed pitch.) The codes to set bold print on Epson printers, for example, are shown as: ESC E (as ASCII characters) and 2769 (as decimal values) Remember to enter the control codes in the second format - as decimal values rather than ASCII characters. The Printer Definition File 1-4 The lines in the SB.PRT file from 7 onwards are optional and can be left blank. Line 7 is used to set up the printer before output in the same way as the printer initialization sequence in Printer Options on the System menu. If used, Line 8 should contain the control codes to tum off any attributes that may have been turned on previously. In the SB.PRT file listed above, Line 7 is redundant since it merely turns off the print styles and is repeated in Line 8. By editing this line you could insert quite a different set of printer commands. For instance, you could use it to set up the printer for Near Letter Quality (NLQ) printing. To do this on an Epson printer (or, at least, on some makes of Epson printer) the sequence to enter would be: 27,120,01 Lines 9 onwards must take the form: char = char1 [,char2] [,char3] [, ...] where 'char' is the character you want to change, and the characters to the right of the equal sign are the ones that are to be substituted for it. 'char' can be either the character itself or its ASCII code; for the substitution characters the decimal values must be given. When Superbase sends data to the printer, it first checks each character in the output against the characters specified in lines 9 onwards. If it finds a match, Superbase translates the character into the substitution character(s). In most cases, this facility will be used to substitute a single character only, such as a currency symbol. But it also allows owners of daisy wheel printers to create printing characters which are made up of two characters in combination with the backspace character (ASCII 8). Suppose, for example, your daisy wheel does not offer the French character 'd' ('a' circumflex) but it does include the circumflex. You can display 'a' on the screen by holding down the Alt key while typing the ASCII code for this character, 131, on the numeric keypad. The letter 'a' and the circumflex accent have the ASCII codes 65 and 94; to ensure that the character appears on the printer, you would enter the following as line 9: a = 65,8,94 Another application for the character substitution facility is to use it for inserting control characters within the text ofa document. An example would be: { = 27,87 The Printer Definition File 1-5 Here the control codes for enlarged print on Epson printers are substituted for the curly bracket character. If you create control code sequences in this way, there are two things you should take into account. First, within Superbase the character will be treated as a printable character even though it does not appear in printed output; and it will therefore have an effect on the format of a line. For this reason, it is best to place control characters on a blank line. Second, any occurrence of this character will be translated into the substitution characters when output to the printer; so you should make sure you choose a character that is not used elsewhere. APPENDIX J SUPERBASE START OPTIONS These options are used to configure Superbase in certain ways before starting up. For example, they allow you to remove the scroll bars or the remote control panel. AMIGA .'--.--. When you run SBP from the CU, you can use the following optional parameters: SBP [-c] [or] [-fformname] [-p] [os] [-z] -c -r -f -p ·s ·z Selects custom screen Disables returns (chr$(13)) when writing to disk files Loads form at startup time Removes remote control panel Removes scroll bars from Superbase window Removes sizing gadget and disable sizing NOTE: Remember to set the stack to at least 8000 before running Superbase from the CU. The start options are also available from the Workbench by setting Tool Types in the Info for the SBP icon as follows: SCREEN =WORKBENCH Use Workbench SCREEN = CUSTOM Use custom screen RETURN = ON Enable returns Disable returns RETURN = OFF SYSTEM = NOPANELI NOSCROLLI NOSIZE Remove panel scroll bars and size gadget You also may use any combination of the three options in the SYSTEM item. To load a form at startup, create an icon for it with the default tool set to SBP and then double click on it. GEM Versions On GEM Versions of Superbase, you can specify start options by placing the following parameters in the first three lines of the SB.PAR file in any combination and in any order: -p -s -z Remove the remote control panel Remove scroll bars Remove size gadget APPENDIX K SUPERBASE ON THE ATARI-ST This Appendix explains a number of tasks and features which are specific to the ATARI-ST version of Superbase. '-- If you have not used the GEM environment before, you should read Chapter 2 of your ATARI-ST Owner's ManuaL Installing and Loading Superbase Superbase Personal 2 is not copy-protected, so the first thing to do is make a backup copy of the program disk. The procedure for copying a disk is explained in the ATARJ-ST Owner's Manual. Hard disk owners are advised to create a new directory (a new folder) for Superbase. Then open a window on the floppy disk and drag all the files on the disk into the new folder. Apart from this, Superbase Personal does not require a special installation procedure. On floppy disk systems, you should insert the program disk in drive A and click on its icon; hard disk owners should open a window on the Superbase directory. You can then load the program straight away by double clicking on the SBP.prg icon. Screen Resolution Superbase can operate in high or medium resolution; it is not designed for low resolution screens. If you attempt to run Superbase in low resolution mode, the system will advise you to reset the resolution mode in Desktop Preferences, and reload Superbase. Superbase Environment The Superbase Screen The Superbase screen is made up ofseveral different areas, bars and gadgets. At the top of the screen is the Menu Bar. This shows you the Superbase menus. These are: Project, Record, Process, Set and System. K-2 Superbate on the Atari-ST Below the Menu Bar is the Title Bar. At the moment you will see the message: "Superbase: Please open a file". This message is always displayed until you open a file. Once you open a file, the Title Bar displays the name of the open file and its current index. Below this bar is the display area. This is where your record data, pictures or text files are displayed. Below and to the right of this area are the scroll bars. These allow you to scroll the display area vertically and horizontally. Finally at the bottom of the Superbase window is the Control Panel. This allows you to browse through the current file looking at your records and perform certain other database activities. For further details on how to use the Control Panel are given in Chapter 1. Using the Mouse All operations within Superbase are performed with the left-hand button of your mouse. The other button or buttons on your mouse have no function and can therefore be ignored. There are four types of action you can perform with your mouse. These are: • • • • Point Single click Double click Press and hold (Drag) USing the Mouse to Point Throughout Superbase you use the pointer to make selections and to make decisions. The position of the pointer on the screen is determined by where you have positioned the mouse on your work area. If you have not already used the mouse, move it around your wo:t;k area and watch what happens to the pointer on the screen. The pointer will imitate the exact movements you make with the mouse. Superbase on the Atari-ST K-3 Single Click A 'single click' is a single depression and release of the left-hand mouse button. It is used in situations where you want to make a selection from a menu or where you make a decision such as clicking on an OK or a Cancel button. Double Click A double click is two single clicks in quick succession. In Superbase the double click is used as a selection shortcut. For example, when you open a file, instead of clicking on the file name then clicking on the OK button, you can speed up the selection process by double clicking on the file name instead. Press and Hold (Drag) This is when you depress and hold down the mouse button, then move the mouse. This method is used when you want to drag a field name around the screen or resize a window. To end the dragging action, simply release the mouse button. Gadgets There are five gadgets within the Superbase window. These are: Move Bar, Scroll Bar, Size Box, Full Box and Close Box. The purpose and use of these gadgets, are explained in your ATARI-ST Owner's Manual, Chapter 3. K-4 Superbase on the Atari-ST Keyboard Equivalents Throughout the Superbase User Guide you will find that several keys are mentioned for which you have no equivalent on your ATARI-ST keyboard. The list below shows those keys for which you have no equivalent, under the heading "Manual", and those keys you can use in their place, under the heading "ATARI-ST'. Manual Alt-(key) Alt-U Home End Shift-Tab Escape ATARI-ST Alternate-(key) Undo (Alt-U also available) ClrHome Insert Control-T Esc File Management System On the ATARI-ST, Superbase's method of handling external files takes into account the three possible resolutions in which images may be found. In high resolution screen mode, Superbase reads and displays high, medium and low resolution images in monochrome shades. There may be some aspect ratio distortion for images which are not themselves high resolution. In medium resolution screen mode, Superbase reads and displays high, medium and low resolution images. • High resolution images are shown in monochrome, twice the size of the original, with inevitable aspect ratio distortion. • Medium resolution images are shown in their correct colours. Super base is set to the colour palette of the image - certain colour combi nations could make data hard to read. • Low resolution images are shown fun screen only, in their correct col ours. Low Resolution Images When Superbase displays a low resolution image, it does so on a full screen. In this situation, the normal windows and database control facilities are not available. Your only possible action is to return to the normal Superbase window. To return to the medium resolution screen you must click the mouse once. Superbase on the Atari-ST K-5 The low resolution image may be redisplayed by clicking on the highlighted camera button, until you select another external file image. To close a low resolution image, double click while it is being displayed. Image Format Compatibility Superbase can read images in the following formats: Degas (compressed and uncompressed) Neochrome -img Superbase uses the three character extension on the file name to determine the type of file it is reading. For Degas, these will be .pil, .pi2 and .pi3 for uncompressed low, medium and high resolutions, and .pcl, .pc2 and .pc3 for the compressed equivalents. Neochrome files have a .neo extension. Preserve these extensions if you need to rename image files. '-.j APPENDIX L SUPERBASE ON THE AMIGA This appendix explains a number of tasks and features which are specific to the Amiga version of Superbase. These are: • Setting up Superbase • How to load Superbase and under the heading, The Superbase Environment: • • • • • • .~. Menus and Requesters Windows Changing the Directory Using Preferences External file formats Ram disk support Setting up Superbase Before you can load Superbase for the first time, there are several preparatory tasks to be performed. This section takes you through the procedure step by step. It assumes that you already know how to do a number of things which are either essential to the Amiga operating system or common to almost all Amiga programs: ~. • Switching on the power. • Loading Kickstart and then Workbench. • U sing the mouse to point, click on icons or menu items, and drag icons or windows around the screen. • Resizing windows. • Using the format and back gadgets. • Using the close gadget. • Creating a new directory. • Formatting a disk. If you do not know how to do any of these, refer to the Amiga User Guides, in particular Introduction to Amiga. Superbase on the Amiga L-2 Prerequisites To run Superbase on an Amiga, you need at least 512K RAM. A second disk drive is optional. For the setting up procedure, you should prepare at least one blank, formatted disk on which you will make a 'backup' copy of Superbase. You are also advised to format another disk to be used for storing data. Make a Backup of the Program Disk Use either the CLI 'copy' command or the Workbench copying procedure to make a backup copy of the Superbase program disk, or to install the program on a hard disk. Store the original in a safe place. You have now made an authorized copy of Superbase. To run any copy, you must use the software protection device described below. Using the Software Protection Device (Dongle) Insert the dongle that comes with the Superbase package into the games port marked with a '2' on the right-hand side of the computer. The dongle must be present while Superbase is loading and throughout its operation. Loading Superbase Superbase does not require a special installation procedure before it can be run on the Amiga. Once you have loaded the Amiga Workbench, you can load Superbase straight away simply by double clicking on its icon. First insert the Superbase program disk, and double click on the disk icon when it appears on the Workbench. double click on the program icon when the program disk window opens. Chapter 1 in this guide explains how to proceed from there. Alternatively, if you have two disk drives, you can run Superbase from the CLI (it is possible to do this with one disk drive but less convenient). Open a CLI window, type "stack 8000" and press Return; then type in the program name ("Superbase and press Return. lt ) Superbase on the Amiga L-3 The Superbase Environment Menus and Requesters Superbase menus are obtained in the same way as for all Amiga programs. Press the right-hand menu button and hold it down. Superbase will display its menu bar at the top of the screen, showing the menu headings. When you release the mouse button, the menu bar will disappear. To select an item from a menu, keep the right-hand mouse button pressed down and move the pointer to the top of the screen, so that it highlights the menu heading. As you do this, the menu appears below the heading. You can now select one of the menu options by moving the pointer down the list; highlight the option you want to select and release the mouse button. Some Superbase menus options present you with a sub-menu. This will appear at the right of the main menu. You select an option from a sub-menu in the same way as from one of the main menus: move the pointer to the right and highlight the option you require. As well as menus, many Superbase operations make use of requesters. Note that throughout this guide requesters are referred to as 'dialogs'. You will find an explanation of how to use requesters in Chapter 1. The only point that needs to be made here is that you select items from a requester by clicking or double clicking the left-hand mouse button - not the right-hand button. Windows Superbase takes advantage of all the features provided by the Amiga's 'desktop' interface, Intuition. All the standard gadgets are available to you - the Close Gadget, the Back and Front Gadgets, the Scroll Bar, the Sizing Gadget, and the Drag Bar - and they allow you to manipulate windows in the normal way. The menu bar at the top ofthe screen is fixed at this position; but every other element in the Superbase environment can be rearranged to suit your requirements. Windows can be closed, opened, sized, and moved to a new position. The Control Panel at the bottom of the screen occupies a separate window; so, if you wish, you can even drag this to another position on the screen. Superbase on the Amiga L-4 In addition, you can specify that Superbase is displayed in a separate screen (a custom screen) to the Workbench screen. You will then be able to move the screen down to reveal the Workbench windows underneath. This option (which should not be used unless your computer has more than 512K) is described in Using the Set Menu, Chapter 7. Using Preferences Provided the Workbench disk is inserted in one of your computer's disk drives or if you have a hard disk system, provided it is present on the disk you will be able to access the Preferences tool. You can then make use of any of the functions provided by Preferences; for example, to change screen colours, or to alter the keyboard response rate. Note that you can also access other Amiga tools, such as the CLI, while you are running Superbase. Changing the Directory You are advised to keep your data files in a separate directory or on a separate disk to the Superbase program. If you do this, you will need to change the directory after loading the program. Select the Directory Change Option from the System menu. Type in the name of the drive you wish to work on (usually DFO: or D Fl:), or the volume name of the disk (e.g. Datadisk:). If you are using a hard disk, type in the directory path name. Note that you need to change the directory even if you are only using one drive. When you replace the disk in the drive with another disk, select Directory Change and type in the drive name (Le., change DFO to DFO). Make sure, however, that you close any open files before swapping the disks. External File Formats Chapter 9 describes the formats which are acceptable for external text files. External picture files must be in the IFF image format. External sound files can be either: • IFF sound samples., produced by a sound sampler program such as Perfect Sound. or • Data dumps, produced by sound digitizer. Superbase on the Amiga L-5 RAM disk support Normally if you wish to use the Amiga RAM disk within a program, you need to copy data files into the RAM disk before running the program. With Superbase Personal 2, this step is unnecessary. You can load data into the RAM disk simply by using the drive identifier RAM: when you open a Superbase file. If the file is not already in the RAM disk, Superbase will copy it to the disk from the current directory, and open it at the same time. Superbase also provides a similar service when you close the file. It asks if you want the file to be copied back to the current directory, i.e. to the floppy or hard disk it was originally copied from. If you click on OK it does the job for you. Should you click on CANCEL the file will not be copied back and you will be asked if you want to erase the copy you have in the RAM disk. Selecting CANCEL will leave the RAM copy intact. (Note that if you open an existing file on RAM disk which has not been put there by Superbase then when you close that file Superbase will not ask you if you wish to copy it back.) As an example, suppose the Address file is stored on the disk in drive DFl: and the current directory is DFl:. To open this file from the RAM disk you would select the Open File option on the Project menu and then enter: RAM:Address You can now work on the file in the normal way - retrieve data, edit data, remove records, and so on - with the advantage that file operations using a RAM disk are much faster than they are on a physical disk. Remember to close the file at the end of a session so that any changes you have made can be saved permanently in the directory from which it was copied. This feature also works with other Ram disk facilities where the drive identifier is VDO: or VDK:. Index & Length 11-5 .par file 7-6 @position 11-5 A Add button 2-6 Address file 1-6 ALL 11-3 Amiga RA\1 disk support L-4 AS Heading 11-4 ASCII codes E-1 ASCII files Creating 11-25 Listing 6-3,8-4 Loading 10-13 Auto Calculation 2-27,7-7 B Batch data entry 4-8 BF 11-7 BG.11-8 Buffer count 7-8 Buttons Current record 1-10 External 4-10 External File 1-28, 9-7 External File Query 9-6 Fast Forward 1-10 Last record 1-11 Next record 1-10 Pause 1-11 Previous Record 1-10 Rewind 1-11 Stop button 1-11 Test 5-25 C Calculation Count 2-27, 7-7 Calculation Formula 2-22 Entering data 4-5 Calculation options 7-7 Changes in Superbase F-1 Check marks 7-1 Checklist Calculation 2-28 Validation 2-20 Close Fields 2-45 Close File 2-44 Closing dependent files 2-45 Colours 11-8 Colours (Aroiga Only) 11-7 Columns 1-13 Constant formulas 4-5 Constants 2-29 CONTAINS 9-5 Control Panel 1-9 Converting dBase files 2-35 Converting to ASCII 10-14 Copying Files 8-7 COUNT 11-14 Cross-file Calculation 2-33 Validation 2-32 Currency symbol 7-11 Current file printing 5-16 Current Record 1-10, 1-17 Custom screen 7-12 D Database files 2-1 Maximum number 2-38 Index Date fields 2-13 Changing 2-48 Date format 3-4 Date format 7-13 dBase compatibility 2-35 dBase files 5-13 Decimal point format 7-10 Default dialog keys 1-5 Default Form View 1-14 Deleting Files 8-6 Demonstration files 1-5, 11-9 Derived columns 11-4, 11-18 Desktop accessories H-l Dialogs 1-4 Default keys 1-5 Query 11-1 Query Order 11-23 Directory 8-2 Changing 1-5, 8-2 Current 1-5 Listing 8-2 Printing 8-2 Display speed 7-7 DOWN 11-6 -11-7 E EJECf 11-8 Error messages A-I Exponential format 2-12 ExportS-IS Example 6-2 Export!Import separators 6-4 External 4-10 External < 4-10 External file Button 1-28 External File Fields 2-16 External File Management System 9-1 External file query 7-9 External Files Amiga 9-10 Gem 9-6 Picture 9-1 Querying 9-6 Searching text 9-5 Sound (Amiga only) 9-15 Text 9-2 F Fast Forward 1-10 FG 11-8 Field 11-6 Adding new 2-6, 2-47 Deleting 2-7, 2-50 Field Attributes 2-16 Constants 2-29 Field names 2-5 Changing 2-47 Field types 2-6 Overview 2-1 Text 2-8 Fields Close 2-45 External File 9-2 Maximum number 2-38 Moving 1-15 Opening 1-12 File Close 2-44 Definition dialog 2-4 Merging 11-25 Opening 1-3 Removing 2-52 Saving 2-51 File definition 2-39 Editing 2-46 File names 2-3 File types .PRTI-1 Index 2-1 Overview 2-1 sb.par7-10 sbd 2-1, 2-51 Index '~ '--.-/ ,~ sbf2-1 sbt 10-3 Filter Button 1-19 Command line 1-20,1-23 Dialog 1-19 Import 6-4 Mail Merge 5-21 Suspending 1-24 Using 1-24 Filters Print 6-6 Query 11-20 Fixed length 5-19 Form letter 5-17 Form View 7-2 Saving 7-3 Form View design 1-14 Format overflow 11-19 Formulas Calculation 3-8 Changing 2-49 Constants 4-5 Validation 3-7 Functions 2-29, C-l LOOKUP 2-33 SER2-30 G Gaining more memory H-l Ghosted items 1-3 Group 11-13 Group totals 11-16 H ,-" Hard copy documentation 8-2 Housekeeping commands 8-6 I Image Menu (Amiga only) 9-11 Import 5-13, 6-4 Import!Export separators 7-8 Indexes Changing 2-43 Maximum number 2-38 New 2-35,3-9 Open 2-42 Removing 2-52 Insert mode 10-8 IT 11-7 K Key controls Filter 1-23 Record editing 4-3 Text Editor 10-6 Key lookup 1-16 Keyboard equivalents 1-3 L Labels 5-22 Fields per line 5-23 Save format 5-24 Single 5-26 Last record 1-11 LIKE 1-21, B-1 List 6-3, 8-4 Loading Superbase 1-1 LOOKUP 2-32 M Mail merge 5-17 Filter 5-21 Fixed length 5-19 Other applications 5-19 Previewing 5-21 Running 5-20 Setting the print style 5-18 Main Display 1-7 Mean 11-14 Memory Requirements 9-1 Merging files 11-25 Index Multi·file applications 11-9 11·21 . ' MultIple response field 2·9 Multiple response fields 2·8 N Next Record 1-lO Non-document files See ASCII files Number format 7-13 Numeric field Changing the length 2·lO Selecting numeric format 2-11 Numeric Fields Changing 2-48 Numeric overflow 2-13 o ON file 11-9 Open Fields 1-12, 2-40 Open Fields list Saving 2-41 Open Index 2-42 Operators 1-20 Logical 1-22 Mathematical 1-22 Relational 1-21 Options 7-5 Order 11-23 Output device 7-1 Output to disk 11-25 Output to File 11-25 Output to Printer 11-25 Output to Screen 11·25 Overwrite mode 10-9 p Paging 1·13, 7-4 Record View 7·4 Table view 7-4 Parameters directory 7·10 Parameters file 7-6 Password 2-39 Passwords 2-3 Path names 1-6 Pattern matching SeeUKE Pause button 1·11 Previous record 1-10 Print 5-16 Print raw 7-12 Print style Mail merge 5-18 Printer 7-1,8-2 Printer definition file 1·1 Printer driver 7-12, I-I Printer options (GEM) 8-1 Printing Current file 5-16 Directory 8-2 Records 6-5 Process Menu 5-1 Process Remove 5-11 Q Query 5-8, 11-1 Applications 5-8 Command lines 11-2 Dialogs 5-9 Editing 5-9 Fields 11-2 Format Parameters 11-6 Loading 5-10 NEWUNE 11-6 Output destination 11-25 Saving5·lO Title 11-2 Query Definition Dialog 11-1 Query Order 11-23 Query Output Disk 11-25 File 11-25 Printer 11-25 Screen 11-25 Index Query Report 11-12 Quit 2-53 R ~/ "- '--" '-..-/ "'---....'/ '--" ',_/ '-.../ Read Only Fields 2-16 Changing 2-49 Record Duplicate 4-9 Record Menu 4-1 Record New 4-6 Record Remove 4-10 Record save 4-7 Record View 7-3 Records Editing 4-1, 4-9 New 4-6 Saving 4-7 Relational Queries 11-21 Remove A set of records 5-11 Filter 1-27 Record 4-10 Remove File 2-52 Removing Records 6-8 Renaming Files 8-6 Reorganize 8-4 For data recovery 8-6 Report 11-13 Example 11-14 Reporting 11-12 Requesters See Dialogs Required Fields Changing 2-49 Reserved words D-1 Rewind 1-11 Rulers 10-10 S '~ Save Label format 5-24 Open Fields List 2-41 Text 10-14 Save File 2-51 SAY 11-25 Screen Dump (Amiga) 9-13 Scroll bar 1-9 Scrolling the screen 1-9 Selective Calculation 2-27, 7-7 SER2-30 Set Menu 7-1 Sorting Multiple File 11-24 Sorting records 5-8, 11-23 Sound files (Amiga) 9-15 Start directory 7-9 Start options J-1 Status 8-3 Printing 8-2 System 8-3 Status File 8-3 Stop button 1-11 Style Query parameters 11-7 Text Editor 10-12 Style parameters 11-7 Sum 11-13 Summarize 11-13, 11-18 Superbase on the Amiga L-1 Superbase on the Atari K-1 System menu 8-1 System status 8-3 System variables 2-24, 7-13 T Table View 1-8,7-2 Temporary file 11-24 Ternary Operator 2-30, 2-34 Text Copying lines 10-8 Deleting 10-7 Editing 10-5 Entering 10-4 Index Formatting 10-9 Loading 10-13 New file 10-4 Paragraphs 10-4 Printing 10-14 Saving 10-14 Undo 10-7 Word wrap 10-4 Text Editor 10-1 Help 10-5 Text fields Changing 2-47 Setting the case 2-8 Text format 3-3 Text rulers 10-10 Time Fields 2-15 Changing 2-49 Time Format 7-13 Tutorials Entering and editing data 4-10 Setting Up a New File 3-1 The Process Menu Options 6-1 Using the filter 1-25 Type style 10-12 U UL 11-7 Update 5-1 V Validation Help messages 2-19 Validation formula 2-17,3-7 Validation Formulas Entering data 4-4 Version (Aroiga only) 8-2 Views 7-2 Form 1-8, 1-14,7-2 Record 1-8,7-3 Table 1-8, 7-2 w Windows Database 10-1 Text 10-1