home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / apps / powerbase / Docs / Create < prev    next >
Encoding:
Text File  |  1994-10-01  |  25.5 KB  |  485 lines

  1.                         Creating a New Database
  2.                         =======================
  3.  
  4. To create a new database you need to go through five steps:-
  5.  
  6.         (i)     Create the database application shell.
  7.         (ii)    Design the record screen.
  8.         (iii)   Specify the number of records the database is to contain.
  9.         (iv)    Specify the primary key.
  10.         (v)     Build the empty database.
  11.  
  12. Each of these will be described in the order just given.
  13.  
  14. Creating the database application shell
  15. =======================================
  16. You need to have Powerbase installed on the icon bar but with no database
  17. open, i.e. ‘No data’ should appear under the icon. Click SELECT over the
  18. icon and a save box will appear. Type in the name of your database and drag
  19. the database icon to a directory viewer. Remember that it cannot exceed 10
  20. characters, including the initial “!”. If you enter more the name will be
  21. truncated and you could end up overwriting an existing database with a
  22. similar name. You don’t actually need to enter the “!”; Powerbase will
  23. insert it automatically.
  24.  
  25. If you open the newly-created application directory (SHIFT/double click) you
  26. will find that it contains files called !Boot, !Run, !Sprites, chkspr and
  27. Colours and four subdirectories called Indices, PrintJobs, PrintRes and
  28. ValTables. All Powerbase applications require these objects to be present so
  29. don’t delete any of them. 
  30.  
  31. Designing the record screen
  32. ===========================
  33. When you created the application shell you were left with a blank window on
  34. screen and it is on this window that you must design your database record. 
  35. This is the lengthiest and trickiest part of setting up any database,
  36. although efforts have been made to render it as painless as possible. If you
  37. have closed the window just click on the Powerbase icon on the icon bar to
  38. re-display it. 
  39.  
  40. Clicking MENU over the window brings up the ‘New database’ menu on which
  41. every item except ‘Design field’ and ‘Help’ is shaded at this stage. The 
  42. ‘Design field’ choice leads to a dialogue box which allows you to specify the
  43. characteristics of a field. First you must decide what category of field you
  44. want to create. There are four such categories, selected via radio buttons:-
  45.  
  46.       (i) Data  (ii) External  (iii) Button  (iv) Check-box 
  47.  
  48. For the present we will confine ourselves to the first, which is the default
  49. selection. As well as the field category you must decide on the type of
  50. field within the category. Most fields are of ‘Alphanumeric’ type and that
  51. is offered as the default. We’ll see about other types later.
  52.  
  53. Decide on a name for the field and enter it in the ‘Descriptor’ icon. This
  54. is the name which will appear on the record window and may be up to 40
  55. characters long. You should also enter a ‘Tag’, which is limited to 4
  56. characters. Next enter the ‘Data length’; the maximum number of characters
  57. the field is to hold. Values up to 246 are allowed. Now click on ‘Create’
  58. and the field will appear on the record window. It’s probably not where you
  59. want it so use SELECT to drag the white rectangle to the position required.
  60. When you drop the field in its new position you’ll see that the descriptor
  61. falls into place too. If you want the descriptor somewhere other than to the
  62. left of the data icon (above it, for example) then you can move the
  63. descriptor by itself without the data icon moving.
  64.  
  65. Basically that’s all you actually need to do in order to create fields.
  66. Mistakes may be corrected by clicking MENU over the field to be altered and
  67. making the required changes. You then click on ‘Update’ rather than ‘Create’
  68. (‘Create’ is shaded, in fact). A field may be deleted by clicking MENU over
  69. it then clicking on ‘Remove’. To insert a field into the middle of a record
  70. you must enter the number of the field which must follow the new one in the
  71. space provided. Clicking ‘Create’ will then create the field in the
  72. correct place in the field sequence. It isn’t sufficient to just drag the
  73. fields around - the order in which they are accessed when the database is in
  74. use won’t be altered by that.
  75.  
  76. You might want to change the sequence of fields without recourse to the
  77. tedious method of deleting a field and then re-creating and inserting it.
  78. There are two ways of doing this. Click MENU over an existing field to bring
  79. up the dialogue box. We will call this the “current field”. Enter the number
  80. of another existing field in the same place as was used above to specify the
  81. insertion position of a new field. We’ll call this the “entered field”. The
  82. two button ‘Swap with’ and ‘Renumber as’ may then be used. ‘Swap with’ does
  83. exactly what you would expect: it swaps the positions of the current field
  84. and the entered field in the field sequence.
  85.  
  86. The action of ‘Renumber as’ is more complex. The current field acquires the
  87. number of the entered field. If this involves giving the current field a
  88. lower number than previously the fields above the new position are all moved
  89. up one place to open a gap for it, at the same time closing up the gap left
  90. by moving the current field from its old position. If it is being given a
  91. higher number the fields above its old position all move down one place,
  92. closing up the gap left by its removal and opening a gap in the required
  93. place farther up the sequence.
  94.  
  95. You can, if you wish, build up the record by creating more fields in the
  96. same way and then go straight to the next main section (Specifying the
  97. database size). If, however, you want more at this stage read on!
  98.  
  99. Re-sizing the bounding box
  100. —————————————
  101. Left to itself Powerbase makes all its field icons the same height and of a
  102. suitable length to contain the number of characters specified in ‘Data
  103. length‘. This may not be quite what you want. If the Data length is more
  104. than about 70 the field runs off the right edge of the window. You may also
  105. want to make the field taller for emphasis. (But NOT for displaying multiple
  106. lines. Only fields of ‘Text block’ type can be multi-line. These are
  107. discussed later.) There are two ways of altering the size of a field’s
  108. bounding box:-
  109.  
  110.         (a) By dragging with ADJUST.
  111.         (b) By typing in the required width and height in the ‘Data field’
  112.         dialogue box. The units used are such that, in the most common
  113.         screen modes such as 12 and 15, a character is 16 units wide and 32
  114.         high and the screen itself is 1240 units wide and 1024 high. (N.B.
  115.         the default height for bounding boxes is 48 units.)
  116.  
  117. Besides altering the size of the bounding box by typing the data directly,
  118. you may adjust its position in the same way by entering the X and Y
  119. co-ordinates of the lower left corner. The units are the same as for width
  120. and height but the origin is the TOP left corner of the record window. This
  121. means that the Y values are always negative.
  122.  
  123. More about tags and descriptors
  124. ———————————————-
  125. Tags are of great importance in Powerbase. They are used when querying the
  126. database to produce reports, export CSV files etc. and also by some internal
  127. operations. Every writable field must have a tag and no two fields may have
  128. the same tag. Descriptors are less important. Their main purpose is to
  129. provide visible labels for fields and in some cases you may not need a
  130. descriptor at all. e.g. If your database is to hold names and addresses you
  131. might want the record to look like this:-
  132.  
  133.                            NAME Fred Bloggs
  134.                         ADDRESS 27, Every Street
  135.                                 Anytown
  136.                                 Woolshire
  137.                                 WL4 7XZ
  138.  
  139. There are 5 fields here but, having given the second one the descriptor
  140. ADDRESS, you don’t really want descriptors for the remaining 3 (except
  141. perhaps POSTCODE for the last). It is quite in order to have null
  142. descriptors like this, but your MUST give each field a tag. Suitable ones
  143. might be NAME, ADD1, ADD2, ADD3, ADD4. (Remember they must be unique and not
  144. more than 4 characters.)
  145.  
  146. The only cases in which you may omit the tag is where the field is simply an
  147. explanatory label and contains no actual data so that there would be no
  148. reason to include it in a query.
  149.  
  150. Other types of Data field
  151. ————————————-
  152. So far we have only used fields of ‘Alphanumeric’ type. Clicking on the
  153. “bump icons” to the left of the field type lets you cycle through the
  154. various types available. These are:-
  155.  
  156.         (a) None                Accepts any printable character.
  157.         (b) Alphanumeric        Accepts all letters and numerals and common
  158.                                 punctuation.
  159.         (c) Upper case          Accepts capital letters and numerals only.
  160.         (d) Number              Accepts numerals,+,- and . (decimal point).
  161.         (e) Yes/No              Accepts Y and N only
  162.         (d) Date                Accepts dates in the form dd-mm-yy or
  163.                                 dd-mm-yyyy.
  164.         (e) Calculated          Can’t be typed into directly. Takes its
  165.                                 value from other (Numeric) fields. 
  166.         (f) Composite           Similar to a Calculated field, but for
  167.                                 textual rather than numeric data.
  168.         (g) Time                Accepts times in the form hh:mm:ss up to
  169.                                 a maximum value of 23:59:59.
  170.                                 
  171. As an alternative to the “bump” icons you may click with SELECT or MENU on
  172. the right-pointing arrow to the right of the field-type icon. This displays
  173. a menu of field types from which to make your choice.                                        
  174. When ‘Numeric’ or ‘Calculated’ is selected, certain icons in the dialogue
  175. box which are normally shaded become available. Thus, you can make such a
  176. field of fixed-point type and Powerbase will modify whatever you type in so
  177. that it is displayed to the specified number of decimal places. For
  178. ‘Numeric’ fields only, you may also specify an upper and lower limit for
  179. numbers which may be entered in these fields.
  180.  
  181. A ‘Date’ field should be either 8 or 10 characters long in order to hold the
  182. date in one of the two formats specified above. The separator in these dates
  183. need not be a hyphen. Look in the Powerbase directory for a subdirectory
  184. called ‘Resources’. Inside it is a file called ‘Config’. Load this into
  185. Edit. There is a line specifying the character to be used as a date
  186. separator. If you change this make sure it is the first character on the
  187. line. Note that the actual TYPING IN of dates allows far more flexibility.
  188. You may type ANY non-numeric character as a separator and Powerbase will
  189. make sense of entries such as 4/5/87, duly converting it to 04-05-87 when
  190. you press RETURN.
  191.  
  192. A ‘Calculated’ field is used when you want the record to automatically
  193. display the result of a calculation based on other fields. Similarly, a
  194. ‘Composite’ field might be used to display a person’s name in the form
  195. FORENAME SURNAME when the data actually typed in uses separate fields for
  196. SURNAME and FORENAME. You don’t specify at this stage how the field value is
  197. derived; that’s done when the database is actually working.
  198.  
  199. A ‘Time’ field (like a date) is checked for validity and (again like a date)
  200. you may be fairly flexible in how you actually type the values in. If you
  201. enter 3.45;9 it will be reformatted as 03:45:09. The colon separator may be
  202. changed by editing the ‘Config’ file. Arithmetic may be performed on times
  203. held in this type of field (see ‘Calculate’). 
  204.  
  205. Other field categories
  206. ———————————
  207. Only the ‘Data’ category of field has been discussed so far. The other three
  208. will now be dealt with.
  209.  
  210. External fields
  211. ———————-
  212. External fields allow you to link a Powerbase record to pieces of data of a
  213. size and type which make them unsuitable for inclusion in a ‘Data’ field.
  214. Such items are sometimes called “BLOBs” (Binary Large Objects) in the PC
  215. world. The field types in this category and the types of data they “hold”
  216. are as follows:-
  217.  
  218.         (a) Text                Plain text files, such as Edit creates.
  219.         (b) Sprite              Sprite files, such as Paint creates.
  220.         (c) Draw                Drawings such as Draw creates.
  221.         (d) Text block          Plain text files, as for (a).
  222.         (e) Picture             Sprite files, as for (b).
  223.  
  224. When you create a field of type ‘Text’, ‘Sprite’ or ‘Draw’ it appears on the
  225. record window as a button bearing a small version of the icon for Edit,
  226. Paint or Draw respectively. Files of the appropriate type may be dropped on
  227. these buttons, whereupon the file is copied into a special system of
  228. subdirectories within the database application. Unlike fields of the ‘Data’
  229. category the data doesn’t become part of the ‘Database’ file within the
  230. application; the text, sprite or drawfile retains its identity and may be
  231. exported for editing in the appropriate application. Clicking on the button
  232. in the record window will display the file if the filer knows the
  233. whereabouts of the relevant editor (Edit, Paint or Draw).
  234.  
  235. ‘Text block’ and ‘Picture’ fields take this a step further by actually
  236. displaying a text or sprite file on the record window. The bounding box of
  237. the icon needs to be of suitable size to hold the text or picture. In the
  238. case of a ‘Text block’ too small a box will cause the text to appear
  239. truncated. None is actually lost; it just can’t all be displayed. Too small
  240. a box for a ‘Picture’ field will cause the sprite to spread beyond its
  241. boundaries. (N.B. To display the same sprite on each record, e.g. a company
  242. logo, define the field as of type ‘Logo’, not ‘Picture’. The inclusion of
  243. logos is described in the file ‘Calculate’ which may seem an odd place for
  244. it but there is a reason!)
  245.  
  246. Check-box fields
  247. ————————
  248. These are fields whose status alternates between two values when clicked
  249. over with SELECT. Three types are defined:-
  250.  
  251.         (a) Cross/tick  Displays a cross by default. A click changes it to a
  252.                         tick. A second click changes it back to a cross.
  253.         (b) Null/tick   Similar to (a), but first state is an empty box.
  254.         (c) Null/star   Similar to (b), but second state is a star.
  255.  
  256. Check-boxes provide the fastest way of entering true/false or yes/no type
  257. data. If you examine the ‘ValStrings’ file inside the Powerbase directory
  258. you will find strings associated with each of these three types the latter
  259. parts of which read, respectively:-
  260.  
  261.                 QNo,Yes
  262.                 Q ,Yes
  263.                 Q ,*
  264.  
  265. These specify what will actually appear in a print-out when a check-box
  266. field is included in a query. You may change them if you wish, but don’t
  267. omit the initial Q and take care not to alter the remainder of the string.
  268.  
  269. Stamp fields
  270. ——————
  271. These are of the following types:
  272.  
  273.         (a) Record number       Database record number.
  274.         (b) Sequence number     A unique value which is numbered upwards 
  275.                                 from a base value set by the user.
  276.         (c) Time                Time at which record was created.
  277.         (d) Date                Date on which record was created.
  278.         (e) Date and time       Date and time of record creation.
  279.         (f) Day                 Day on which record was created (in the form
  280.                                 Mon,Tue etc or day of month as 10,24 etc).
  281.         (g) Month               Month in which record was created (as either
  282.                                 a string; Jan,Feb etc or a number; 1,2 etc).
  283.         (h) Year                Year in which record was created (as a 
  284.                                 four-digit number, e.g. 1993).
  285.         (i) Last altered        Records the date and time when a record is
  286.                                 first created and updates it when the record
  287.                                 is subsequently altered. Merely displaying
  288.                                 the record does NOT cause updating to occur.
  289.         (j) Logo                Allows a sprite to be included as a logo on
  290.                                 every record. (See note below.)                          
  291.  
  292. Like ‘Calculated’ and ‘Composite’ fields none of the above is editable by
  293. the user; all are automatically “stamped” by Powerbase at the time a record
  294. is first entered. When using (a) or (b) make sure the ‘Data length’ fill-in
  295. box contains a large enough value to accommodate the longest number which
  296. will be encountered. In the case of (b) the base value from which the
  297. sequence numbers begin is entered in the ‘Numeric min’ box. For the other
  298. types the required field length is already known by Powerbase and the
  299. ‘Data length’ box is therefore shaded.
  300.  
  301. Type (d) fields may display the date in any of three formats:
  302.  
  303.         (i)     Sun,01 Aug 1993         (called “Date stamp”)
  304.         (ii)    01-08-93                (called “Date stamp8”)
  305.         (iii)   01-08-1993              (called “Date stamp10”)
  306.  
  307. (ii) and (iii) are identical to the formats in which Powerbase displays
  308. dates of the ordinary editable-data type (see “Other types of data field”,
  309. above). The numbers refer to the field length occupied by the date stamp.
  310.  
  311. Type (j) fields require the name of the sprite to be entered as the tag of
  312. the field to be used as a logo. This means that the sprite name is limited
  313. to four characters. You may have several logo fields on your record, all the
  314. required sprites being included in a file called ‘UsrSprites’ which is
  315. placed inside the database directory. There is a bug in this feature which
  316. results in an Address exception error if the UsrSprites file is already
  317. present when the field is created. The procedure is to create the logo
  318. field with the appropriate sprite name as a tag, create the empty database
  319. then, finally, copy your UsrSprites file into the database directory.
  320.  
  321. Button fields
  322. ——————-
  323. Any or all of the control buttons on the Powerbase keypad may be made to
  324. appear on the record window itself. They have exactly the same functions as
  325. their keypad equivalents. There are also a few extras (Print, Exit, Quit and
  326. Directory) which have no keypad equivalent. The first three duplicate the
  327. actions of ‘Print’ on the main menu and ‘Close database’ and ‘Quit’ on the
  328. icon bar menu. ‘Directory’ enables you to open a filer window by
  329. clicking on the button. The descriptor may be used to give the name of
  330. the associated directory and the link is established by dropping the
  331. directory onto the button in the same way that files are linked to
  332. fields of ‘External’ type. These button fields allow you to build a
  333. customised database which lets the user use only the features you want
  334. him/her to have access to, since the keypad and menus can then be
  335. suppressed.
  336.  
  337. Specifying the database size
  338. ============================
  339. Immediately beneath the ‘Data field’ entry on the menu is one called
  340. ‘Default database’. Choosing this is by far the fastest way of getting a
  341. database up and running. Its action is to create three files inside the
  342. application directory. These are called ‘Form’ (which holds the record
  343. design), ‘PrimaryKey’ and ‘Database’ (which will ultimately contain the
  344. entered records). The number of records in the database is set to 100, with
  345. 25 as the amount by which this should increase when the database becomes
  346. full. The primary key is defined as the first four characters of the first
  347. writable field. The database is opened and a blank record displayed ready
  348. for data entry.
  349.       
  350. Since you can always alter such things as the database size and primary key
  351. structure later, you might wish to use these defaults while you experiment
  352. with the database. If, however, you want to set the database size yourself
  353. at this stage proceed as follows:-
  354.  
  355. (1) Save the ‘Form’ file by following the menu option and clicking on ‘OK’
  356. or typing RETURN when the save box appears. The pathname is correctly set
  357. for saving the file inside your database application.
  358.  
  359. (2) You will now see that the ‘Database size’ choice is no longer shaded and
  360. may be used to reach the dialogue box in which you specify the number of
  361. records in the database and the increment for expanding the database when it
  362. becomes full.
  363.  
  364. Specifying the primary key
  365. ==========================
  366. The primary key (or any other key) is derived from a record field called a
  367. key field. The key field is selected by either clicking on the “bump” icons
  368. which allow you to cycle through the field tags, or by choosing from a menu.
  369.  
  370. There is a choice of two mechanisms whereby the key is derived from the key
  371. field:
  372.        (1) The division between words in the field may be ignored (this
  373.            being the default).
  374.        (2) Characters may be taken from one or more words in the field.
  375.  
  376. An option switch allows you to choose (1) or (2). With the first choice you
  377. specify only the length of the key; the contents of the four Word icons must
  378. all be set to ZERO. With the second choice you specify the number of
  379. characters to be taken from each of up to four words and need not specify
  380. the actual key length at all. Suppose the key field contains a person’s
  381. name. The following examples compare the keys which would be assigned with a
  382. key length of 8, firstly by ignoring word breaks and secondly by using 4
  383. letters from each of words 1 and 2.
  384.  
  385.         Bloggs Fred             BLOGGSFR        BLOGFRED
  386.         Doe Joe                 DOEJOE##        DOEJOE##
  387.         Percival Jean           PERCIVAL        PERCJEAN
  388.         Simpson Janet           SIMPSONJ        SIMPJANE
  389.  
  390.  
  391. Key fields need to be chosen with care. An ideal key field is one whose
  392. contents would never be repeated in another record. Powerbase allows you to
  393. enforce this condition if you wish (see “Passwords”). Occasional repetitions
  394. need not be serious, but a field which can have only a few “values” is
  395. usually a poor choice. A customer number or membership number is the sort of
  396. thing we are looking for, but your database may not contain anything like
  397. that.  In a database of school pupils the pupil’s name would be a good
  398. choice of key, but the form teacher’s name would not, since only a small
  399. number of names would be involved, each appearing on the record of many
  400. pupils.
  401.  
  402. Suppose we decide to use a person’s name, stored surname first, as a key. We
  403. can hardly use the whole name; it would be far too long. The first four
  404. letters would be more appropriate but, since this is the start of the
  405. surname, we might have a lot of Smiths or, in Wales, a VERY large number of
  406. repetitions of Jones or Evans! To get round this problem, Powerbase allows
  407. you to construct an alphanumeric key from characters taken from up to four
  408. successive words. You will seldom need to go as far as this. In this case
  409. a five-letter key made up from the first four letters of the surname and one
  410. letter of the forename would be good enough for most purposes. Smith Peter
  411. and Smith Janet would have the keys SMITP and SMITJ. Duplication can still
  412. occur, but not often enough to be a serious problem. It isn’t normally
  413. sensible to build a numeric key from several bits in this way and Powerbase
  414. won’t let you do so. Such a key consists of the numeric value of the chosen
  415. key field.
  416.  
  417. There are databases where no field seems suitable as a key field. Consider
  418. a database of classical music. There would be a field for the composer’s
  419. name and one for the name of the work. Neither is much use on its own: the
  420. former would contain possibly hundreds of occurrences of Mozart and
  421. Beethoven and the latter would have numerous repetitions of Symphony No.5
  422. or String Quartet in D minor.
  423.  
  424. To deal with such situations Powerbase allows you to use a composite
  425. alphanumeric key, based on two fields in combination. A second group of
  426. icons allows you to cycle through the tags for the second field, or choose
  427. it from a menu.
  428.  
  429. Imagine the two fields placed end to end, with a single space between them.
  430. The key may then be based on the first four words of the composite field. We
  431. might, for the music database, use all four words and take 4,3,3,2
  432. characters respectively from them.  The following two works then give the
  433. keys shown:
  434.  
  435.                 BEETHOVEN  Symphony No 5:       BEETSYMNO5
  436.                 MOZART Piano concerto 23:       MOZAPIACON23
  437.  
  438. Note the following points in these examples:
  439.        
  440.         (a) If a word is shorter than the number of letters assigned to it 
  441.         (“No” in the first example) then the whole word is used but no
  442.         padding is inserted.
  443.  
  444.         (b) It may be necessary to leave out an insignificant word (“No” in
  445.         the second example, so that a significant one (“23”) comes in the
  446.         first four words of the composite field.
  447.  
  448. Once you have decided on the structure of your primary key, go to the 
  449. dialogue box from the ‘Primary key’ menu entry. Click on the first icon
  450. until the tag of the required field is shown. Do the same with the second if
  451. specifying a composite key. Enter the numbers of letters assigned to each
  452. word. 
  453.  
  454. Another choice to be decided is if the indexing is to pay any attention to
  455. whether letters are upper or lower case. By default indexing is NOT
  456. case-sensitive, all keys being forced to upper case before insertion in the
  457. index and search strings being similarly forced to upper case. Thus if a
  458. record has the word “Horse” as the contents of a key field and the first
  459. four letters are used as the key then the entry in the index will be “HORS”
  460. and you may search for it by entering “HORS”, “hors”, “Hors”, “hOrS” etc.
  461.  
  462. This might not be what you want. If you require indexing to be case-
  463. sensitive then select the switch labelled ‘Case sensitive’. The forcing to
  464. upper case described above does not then take place - keys are inserted and
  465. strings are searched for “as is”. The field containing “Horse” will be
  466. indexed as “Hors” and only that precise combination of upper and lower case
  467. letters will successfully find it. Alphabetic keys will be ordered according
  468. to the ASCII values of the letters. Since lower-case letters come later in
  469. the ASCII table than upper-case ones a record containing “dog” would appear
  470. AFTER one containing “Horse”, whereas one containing “Dog” would come before
  471. “Horse”.
  472.  
  473. Once you are satisfied click OK and your database will be created. The
  474. record window is redrawn and you may start entering data at once.
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.