Ability PDF Manual

Document technical information

Format pdf
Size 2.7 MB
First found May 22, 2018

Document content analysis

Category Also themed
Language
English
Type
not defined
Concepts
no text concepts found

Persons

Organizations

Places

Transcript

2 Getting Started
Table of Contents
Getting Started ............................................................................................................ 6
Installation ................................................................................................................. 6
Running Ability........................................................................................................... 8
Documents and folders ............................................................................................. 9
Customizing toolbars and menus ............................................................................18
Windows basics.......................................................................................................21
Getting help .............................................................................................................27
Launcher ....................................................................................................................29
Starting Launcher ....................................................................................................30
Write ...........................................................................................................................34
Starting Write...........................................................................................................34
Creating a document ...............................................................................................38
Formatting paragraphs ............................................................................................43
Moving, copying and deleting text ...........................................................................48
Finding and replacing text .......................................................................................49
Tables......................................................................................................................51
Spell checker and thesaurus ...................................................................................53
Columns ..................................................................................................................55
Frames and callouts ................................................................................................57
Footnotes.................................................................................................................63
Captions ..................................................................................................................64
Using styles .............................................................................................................66
Bulleted and numbered paragraphs........................................................................68
Page set-up .............................................................................................................72
Headers and footers................................................................................................73
Printing ....................................................................................................................76
Including fields in a document .................................................................................78
Using templates.......................................................................................................83
Mail merge...............................................................................................................86
Changing Write options ...........................................................................................89
3 Getting Started
Spreadsheet...............................................................................................................92
Worksheets..............................................................................................................97
Entering information ..............................................................................................100
Formatting the spreadsheet ..................................................................................103
Copying and moving information...........................................................................117
Inserting and deleting cells, rows and columns.....................................................124
Comments .............................................................................................................127
Merging and splitting cells .....................................................................................128
Styles.....................................................................................................................129
Using formulas.......................................................................................................129
Naming cells and ranges.......................................................................................137
Page set-up ...........................................................................................................142
Default settings......................................................................................................149
Chart.........................................................................................................................151
Creating a chart .....................................................................................................151
Style.......................................................................................................................152
Data range.............................................................................................................155
Editing a chart........................................................................................................157
Attached charts......................................................................................................157
Resizing and moving an embedded chart.............................................................158
Deleting a chart from a spreadsheet .....................................................................158
Printing a chart ......................................................................................................158
Database ..................................................................................................................159
Starting Database..................................................................................................161
Creating a new database ......................................................................................166
Indexes and primary keys .....................................................................................191
Saving a new table ................................................................................................196
Opening a table using database manager ............................................................196
Sorting a table .......................................................................................................215
Filtering a table ......................................................................................................217
Queries ..................................................................................................................224
Joining tables.........................................................................................................228
Form view ..............................................................................................................232
Reports ..................................................................................................................250
Deleting a database ..............................................................................................264
Photopaint ...............................................................................................................268
Starting Photopaint................................................................................................269
Creating a new image ...........................................................................................269
Color selection.......................................................................................................271
Opening an existing image....................................................................................273
Information dialog..................................................................................................274
Selections ..............................................................................................................274
Selection editing ....................................................................................................277
Paint tools..............................................................................................................284
4 Getting Started
View tools ..............................................................................................................293
Brushes .................................................................................................................294
Brush modes .........................................................................................................295
Typing and color fill tools.......................................................................................296
Filters.....................................................................................................................304
Filters: examples ...................................................................................................307
Layers....................................................................................................................317
Edit menu ..............................................................................................................327
Image menu...........................................................................................................330
The Tools menu.....................................................................................................345
Image file formats ..................................................................................................354
Vector tools............................................................................................................364
Creating a vector object ........................................................................................364
Editing vector objects ............................................................................................369
Vector objects: Fill options ....................................................................................376
Plug-ins..................................................................................................................381
Draw .........................................................................................................................383
Creating a drawing ................................................................................................386
Selecting, moving and resizing draw objects ........................................................389
Formatting a shape ...............................................................................................390
Working with groups of objects .............................................................................394
Integration in Ability ...............................................................................................397
Copy and paste .....................................................................................................397
Linking through fields ............................................................................................400
Linking and embedding documents ......................................................................408
Fields – an introduction .........................................................................................413
WriteFX - a text effects tool....................................................................................420
Using WriteFX .......................................................................................................420
Editing an existing WriteFX object.........................................................................422
Macros......................................................................................................................424
Write macros .........................................................................................................426
Spreadsheet macros .............................................................................................435
Database macros ..................................................................................................439
Automating Ability from other programs................................................................443
Macros – examples ...............................................................................................445
An introduction to the VBScript language .............................................................458
SQL Guide................................................................................................................464
Selecting records - the basics ...............................................................................464
Groups and aggregate functions ...........................................................................470
Crosstabulations....................................................................................................472
Relational links and joins.......................................................................................474
Editing records.......................................................................................................476
5 Getting Started
Function reference..................................................................................................480
Using built-in functions ..........................................................................................480
Using the function dialog box to build formulas.....................................................481
Text arguments......................................................................................................482
Arrays ....................................................................................................................482
Logical operators...................................................................................................483
Relational operators ..............................................................................................484
Arithmetical operators ...........................................................................................484
Priority of evaluation of operators..........................................................................485
Cell error indicators ...............................................................................................485
Date functions........................................................................................................486
Financial functions.................................................................................................493
Logical functions....................................................................................................512
Mathematical functions..........................................................................................513
Trigonometric functions .........................................................................................527
Lookup functions ...................................................................................................529
Information functions .............................................................................................534
Statistical functions................................................................................................536
Text functions ........................................................................................................557
Document functions...............................................................................................565
Remote functions ..................................................................................................568
Index.........................................................................................................................589
6 Getting Started
Getting Started
Ability Office (or just Ability for short) consists of four powerful applications:
•
WRITE lets you create, format and print documents (see Write on page 34).
•
SPREADSHEET lets you create numeric models, make “what if” projections, produce
cash flows, and draw charts (see Spreadsheet on page 92).
•
DATABASE lets you organize and store information, create reports, and use onscreen forms (see Database on page 159).
•
PHOTOPAINT lets you edit and design images and photographs (see Photopaint on
page 268)
Ability’s four applications work under the Microsoft Windows 95™ and later and Windows
NT™ 4.0 and later environments, and use standard Windows operations. They are
integrated, which means that they work together: you can take information from a
spreadsheet, display it as part of a report in Write and mail merge it with information from
Database.
What’s more, with Ability you can link the spreadsheets, drawings, databases, forms and
documents you have created. Once you tell Ability that two documents are related, Ability
can make changes for you automatically. For example, your letter to the board of
directors contains the total amount from your quarterly sales spreadsheet. If you get new
sales figures, you enter them in the spreadsheet, and Ability updates your letter
automatically.
Installation
Hardware requirements
To run Ability, you need a minimum configuration of:
•
A Personal Computer with Pentium CPU or better that is capable of running one of
the operating systems below.
•
32 MB of memory (RAM) - 64MB recommended for Windows 98, ME, 2000, NT or
later.
•
A hard disk with at least 50 MB of free space.
•
A Microsoft Windows compatible mouse (optional)
7 Getting Started
Ability will work with any of the following operating systems:
•
Windows 95, 98, ME or later
•
Windows NT version 4.0, 2000 or later.
You’ll probably want a printer so you can see your work on paper. Ability works with any
printer supported by Windows. With most laser and inkjet printers, you can print
documents, graphics, spreadsheets, charts, database reports and forms, just as they
appear on the screen.
Running Setup
1. Put the Ability CD into the CD-ROM drive.
2. Wait for the "auto-run" program to start and follow the on-screen instructions.
If your computer is configured not to run CD's automatically, follow these steps instead:
1. Click the Start button, select the Settings command, and then select the Control
Panel command.
2. Double-click the Add/Remove Programs icon.
3. In the Install/Uninstall tab, click the Install button.
4. Now follow the setup instructions on screen.
Removing Ability
Ability can be removed completely by following these steps:
1. Select Start from the Windows taskbar.
2. Select Settings then Control Panel.
3. Double-click the Add/Remove Programs icon.
4. From the list of programs, select Ability.
5. Click Add/Remove and follow the instructions on screen.
Ability installs itself in a directory "C:\Program Files\Ability Office" by default. If you've
created or modified any documents in this directory, the uninstall process won't remove
the directory structure. You can use Windows Explorer to do this (check that you don't
need any data files first).
8 Getting Started
Running Ability
You can start Ability applications, switch between them (and other Windows applications)
and exit them in the same way as with any standard Windows application.
Starting an Ability application
There are three ways to start an application:
•
Select the Start button on the Windows taskbar, select Programs, select Ability
from the list of programs, and then select an Ability application.
•
If you are running an Ability application and wish to start a different one, click the
relevant application button on the launcher toolbar. If you can’t see this toolbar, select
View/Toolbars and then check the Launcher toolbar option.
•
Select the Ability Launcher from the list of Ability applications under Programs, and
then select an application or other icon as required.
Switching between Ability applications
As Ability is an integrated suite of applications, you can change between applications
very easily, using several methods:
•
Click on the relevant application button on the toolbar of any other open application.
•
Click on the relevant application along the taskbar at the bottom of the screen to
change to an already open window.
•
Use ALT+TAB to sequence through all the open windows.
•
If the application’s window is visible on the screen, simply click on it to make it the
active application.
Exiting Ability
To exit any Ability application, select the Exit command from the File menu. You will be
asked if you want to save each open document within that application before exiting, but
only if you have made changes to a document.
Alternatively, click on the close box
window.
in the top right hand corner of the application
9 Getting Started
Documents and folders
Documents are saved in folders. You can think of a folder as a filing cabinet containing
several files (the documents). You can keep all your documents, whether created in
Write, Spreadsheet, Database or Draw, in a single folder. If you have many documents, it
may be better to group them into several different folders.
In older versions of Windows (or DOS) folders were called directories and documents
were frequently called files. This is less common now, although the terms are
interchangeable.
Creating a new document
To create a new document, go into an application and do one of the following:
•
Click on the New button
•
Select the New command from the File menu.
on the toolbar.
Selecting this option in Write will display a list of templates, one of which can be used as
the basis for the new document. Otherwise, the two methods are identical.
A new window will be opened displaying the new document. In Database you will also be
prompted to enter a new database name.
Document summary information and statistics
When you create a document, you may want to store some information about it to help
you remember the document’s purpose, who created it, and so on. Also, you might want
to know how many characters or words are in the document, and other useful statistics.
Write, Spreadsheet and Draw documents each have an attached Document Properties
box. This contains Summary information and Statistics.
To access Document Properties select Properties under the File menu.
The Summary tab enables you to enter comments, keywords, subject, title, and other
information. You can open and edit this dialog box as often as you want.
The Statistics tab enables you to see document statistics, such as the number of pages,
words and characters, creation and last saved dates, and other information. This
information is updated automatically every time you enter the Document Properties box.
Not all this information is completed for each application: for example, Write is the only
application containing a word count.
10 Getting Started
Opening existing documents
There are various ways of opening existing documents when using Ability. You can open
a document from within an application, by using the launcher, or by using the Windows
recent document list.
Opening a document within an application
1. Click the Open button
on the toolbar. The Open dialog will appear with a list of
documents in the current folder.
2. If you want to open a document that is on a different drive, use the Look In box to
select the drive you want.
3. If you want to open a document that is in a different folder from the current one, use
the folder list to navigate to the folder you want.
4. Double-click the document you want to open.
Write and Spreadsheet support many document formats from other programs. Use the
Files of Type box to choose an external file format - a list of the selected file type will be
displayed. Database also supports other file formats but you'll need to open these using
the Import command from the File menu.
Note: A time saving feature is the Recent File option on page 10 from the File menu.
Recent files and folders
Ability remembers (up to) the last 16 files you worked on. To quickly access any of these
files, select Recent Files from the File menu.
Ability also remembers the last 16 folders you accessed and these are available by
selecting Recent Folders from the File menu. Selecting one of the recent folders is
equivalent to using the open dialog on page 10 and changing the current folder. This is
very useful if you store your files in separate locations (e.g. c:\my documents for general
files, c:\my documents\sales for sales related documents and so on).
You can fine tune the way the recent files and folders operate. Select Open and save
options from the File menu.
•
Set the number of files and folders Ability remembers (maximum 16)
•
Specify a default Open folder. Clear the "remember last used" checkbox and type the
folder you want to default to in the edit box or use the browse button to locate the
folder. Ability will always display this folder when using the Open button.
11 Getting Started
•
Specify a default Save folder. Similar to above.
•
Tell Ability to default all file open and saves to the last used folder by turning on the
"remember last used" checkbox. Works separately for open and save operations.
Using the Launcher
from the Launcher. This can be used
Select the Open Ability Document button
whether or not you are currently in an application. Click on one of the four application
tabs to access Ability write, spreadsheet, database or draw documents, and then open
the required document by either double-clicking on it or selecting the Open button.
If you want to open a document that is on a different drive, use the Look In box to select
the drive you want. If you want to open a document that is in a folder other than the
current one, use the folder list to navigate to the folder you want.
Using Windows recent document list
Windows records the 15 most recently used documents. To access these, click on Start
and select Documents. If the document you wish to access is among these, click on the
document name to open it.
Saving a document
It is recommended that you save your work often. This protects you against unexpected
power loss, which can result in the loss of any changes made since you last saved your
work.
Click on the Save button
on the toolbar to save a document. Alternatively, select the
Save command from the File menu.
If the document already has a name (i.e. you opened an existing document and did some
work on it), it will simply be saved under the same name, overwriting the old version.
If you have not yet given the document a name (i.e. you created a new document or
imported a document from a different format), the Save as dialog box will be displayed. In
this dialog box you can give the document a name and, optionally, choose a different
folder to the current one (see Saving a document under a different name on page 12 for
more details).
Note: When you name a document you do not need to give it an extension (the letters
after the dot), as Ability automatically adds the appropriate extension, according to the
application you are using or the file format you have chosen.
See Open and save options on page 10.
12 Getting Started
Saving a document under a different name
If you have already given a document a name but you want to save it under a different
one, follow these steps:
1. Select the Save As command from the File menu.
2. Enter a new name in the File name box and then click Save.
You can choose to select a different folder and drive in the Save As dialog. You can also
choose the file format in which you wish to save the document. This can be useful, for
instance, if you want to save your spreadsheet data in a format that can be read by other
spreadsheet programs.
Working with documents and folders
A typical hard drive with Windows installed will have at least 3 folders, arranged
hierarchically:
The My Documents folder is the default
location for all your data files.
The Program Files folder is where all the
program files are installed (or at least that's
where they should be installed). The picture
above only shows Ability installed on this PC.
It will be normal for you to see many different
folders here.
The Windows folder is where the Windows
operating system installs itself. Normally you
won't have to deal with this folder. It too has
many sub-folders.
If you only have a few documents, you can put them all in the My Documents folder. If
you have more than a few, it is usually best to organize them into different sub-folders.
The above picture shows that My Documents has two such sub-folders, "Sales" and
"Marketing". You should choose a folder name that makes sense to you in your work and
have as many sub-folders (which can themselves contain more sub-folders) as you think
sensible.
To organize folders and put documents into them, you'll need to understand the following
sections.
13 Getting Started
Using the Open dialog
To view the Open dialog, click on the Open button
application or select Open from the File menu.
on the toolbar of any Ability
The Open dialog displays the current folder in the Look in box:
.
The documents and folders within the current folder are shown in the main window of the
Open dialog. The folders are indicated by the folder icon , the documents by an icon
that is appropriate to the application that usually opens documents of a particular type.
The Open Dialog also has buttons for:
Up One Level. Moves up one level from the current folder. This moves towards the
root directory of the current drive.
Create New Folder. Creates a new folder within the current folder.
List. Displays the folders and documents in the current folder with the names and
icons only.
Details. Displays each document with extra detail, such as document size and
modification date.
Selecting Details allows you to sort documents in ascending or descending order. Click
on the Name, Size, Type or Modified bar to sort on that column. Switch between
ascending and descending on alternate clicks.
Navigating folders
You can navigate through the folders and drives of your PC, using either the Open dialog
or the Save dialog. Folders are arranged hierarchically (see Working with documents and
folders on page 12). In changing folders you move either towards or away from the root
directory (see Root directory on page 28).
To change the current folder, do any of the following:
•
icon to make it the current folder. Since the folders listed in
Double-click a folder
the main box of the Open and Save dialogs are sub-folders of the current one, this
will move away from the root directory.
14 Getting Started
•
Click the Up One Level
button to move to the folder above the current one, and
so towards the root directory. This will reverse the "Double-click a folder" as
described above.
•
Click on the drop-down button in the Look-in box:
.
This lists all folders above the current one (that is, if you are in a sub-sub-folder, it will
show each folder on a path back to the top level) and also the different drives your
PC may have.
Copying and moving documents or folders
To copy a document or folder, follow these steps:
1. Display the Open dialog - select the Open button
menu.
or select Open from the File
2. Right-click on the document or folder to be copied.
3. Select the Copy command from the shortcut menu and do one of the following:
•
Navigate to the folder to which you want to copy the document or folder (don't
open the folder, just make it display in the Open dialog). Right-click over the
folder name and select the Paste command.
•
Right-click over a space in the current folder (that is, make sure the pointer is not
over a file or folder) and select Paste from the shortcut menu.
If a document (or folder) with that name already exists, a new name will be used.
If you just want to copy a document or folder to the floppy drive, skip steps 2 and 3 above
and right-click over it instead. Select Send To and then 3 ½ Floppy (A).
To move a document or folder, select Cut in step 3 rather than Copy.
To undo a copy or move, right-click over a space in the folder (that is, make sure the
pointer is not over a file or folder) and select Undo Copy from the shortcut menu.
Deleting documents or folders
To delete a document, follow these steps:
1. Display the Open dialog - select the Open button
menu.
or select Open from the File
15 Getting Started
2. Right-click on the document to be deleted.
3. Select the Delete command from the shortcut menu.
4. You will be asked whether you are sure you want to proceed with the deletion. Select
Yes.
To recover the file immediately afterwards, right-click over a space in the folder (that is,
make sure the pointer is not over a file or folder) and select Undo Delete from the
shortcut menu. For more information about recovering files, search for "Recover" in the
Windows Help index.
To delete a folder, follow steps 1 through 3 above. You will be asked if you want to delete
the folder and all its contents. Make sure you no longer need these documents before
continuing.
Renaming documents or folders
To rename a document or folder, follow these steps:
1. Display the Open dialog - select the Open button
menu.
or select Open from the File
2. Right-click on the document or folder to be renamed.
3. Select the Rename command from the shortcut menu.
4. Type in a new name.
As an alternative to steps 2 to 3, click on a document on folder, then click again (like a
slow double-click).
When renaming documents make sure you maintain the same extension or use the
extension of a compatible program, otherwise the document may become unusable.
To undo a rename, right-click over a space in the folder (that is, make sure the pointer is
not over a file or folder) and select Undo Rename from the shortcut menu.
Document extensions
Each Ability document has an appropriate extension after its name. The same is true for
documents from other programs, though different programs usually use different
extension letters.
An extension consists of some letters (always three letters in Ability) after the document
name. The name and the extension are separated by a dot. Each type of document has
16 Getting Started
its own extension, thereby enabling Ability to identify which documents go with which
application. Here is a list of Ability extensions (* stands for the document name):
Application
Extension
Write
*.aww
Spreadsheet
*.aws
Database
*.adb
Photopaint
*.apx
Draw
*.awd
Occasionally you may need to type a full document path, for example, in a function
parameter, and so will need to know the extension.
When you create a new document, Ability automatically adds the appropriate extension
for the current application. However, if you want to select a different file type, that is files
of a different extension that are compatible with the current application, click on Files of
Type in the Open dialog and scroll through till you come to the relevant type (if available).
Click on this to make it the current file type.
Finding documents
There are two ways of finding documents:
•
To find documents using the Open dialog, where you know roughly what the
document is called and where it is located, see Finding documents in the Open dialog
on page 16.
•
Where you don't know what the document is called and where it is located, but you
do know what it contains, use Windows Explorer. See Finding documents with
Explorer on page 17.
Finding documents in the Open dialog
To find a document using the Open dialog:
or select Open from the File menu. The Look In box
1. Click on the Open button
displays the name of the current folder:
The main box shows all the documents belonging to the current application. It also
within the current folder (sub-folders).
shows all the folders
17 Getting Started
2. Assuming the document you want is not in the current folder, do one of the following:
• Double-click a folder
icon to make it the current folder.
• Click the Up One Level
button to move to the folder above the current one.
• Click on the drop-down button on the Look-in box and select either a folder at a
higher level or another drive.
If you know the location of the document you want, using the Open dialog in this way is a
good way to find it.
However, you may have forgotten the document’s location, and since there are too many
folders on too many levels to make a random search through the Open dialog
practicable, it is better to make a search using Windows Explorer.
Finding documents with Explorer
Windows Explorer is a standard part of the Windows operating system and so will be only
briefly explained here.
To find a document, follow these steps:
1. Click the Start button on the taskbar, select Find, and then select Files or Folders.
2. If you know the extension of the document you are looking for, enter it in the Named
box. For example, to find Ability Write documents, enter *.aww in this box. See
Document extensions on page 15 for a list of other Ability extensions.
3. If you know that the document contains some specific text, like a company name,
select the Advanced tab and enter the text in the Containing text box.
4. Click Find Now.
There are other options you can set - see the Help that comes with Explorer for more
details.
Creating backups
As well as saving your work regularly, you should get into the habit of saving your
documents to a floppy disk, or some other media, and preferably keeping at least one
copy in an alternate location.
One day your computer may break down or be lost or stolen - only you will know what
this data loss may mean to you personally or professionally.
18 Getting Started
A backup is really just a copy of the file. There are three ways you can do this:
•
Copy a document using the Open dialog in Ability. This allows you to copy a
document (or folder) to a floppy disk or another drive. See Copying and moving
documents or folders on page 14.
•
Using Windows Explorer - this is very similar to using the Open dialog but will allow
you to copy more than one file at a time. Reference the Help inside Explorer for more
details.
•
Windows comes with its own backup system. This is useful for scheduling backups or
when a document becomes too big to fit on a single disk. See Backing up using
Windows or a third party backup system on page 18.
Backing up using Windows or a third party backup system
Windows Explorer and other document-based methods of copying files to floppy disks do
not let you span several disks should a document become too big to fit on a single floppy.
To get round this, you may find it worth your time to learn how to use the backup program
that comes with Windows 95, or perhaps invest in a tape, DAT or CD backup system.
For further information on the Windows backup program, please refer to your Windows
documentation. (Select Help from the Start menu and search for "Backup" in the Help
index)
For further information on backup solutions, please contact your local dealer.
Customizing toolbars and menus
Toolbars and to a lesser extent menus, can be customized to suit your own needs. With
toolbars you can do any of the following:
•
Reposition toolbars on page 18
•
Add and Remove buttons on page 19
•
Create new toolbars on page 20 and buttons on page 20
•
Change the style (button size and appearance) on page 20
Menus cannot be changed but it is possible for a short-cut key on page 21 to be set or
changed.
Moving and displaying toolbars
Turning toolbars on and off:
•
•
19 Getting Started
To remove a toolbar from view, select Toolbars from the View menu and deselect it
(remove the tick next to the toolbar name). Alternatively, drag and drop the toolbar
on the toolbar.
into the middle of the screen and click on the close button
To bring a toolbar into view, select Toolbars from the View menu and select it by
clicking on the check box next to the toolbar name.
You can also right-click over any toolbar docking handle for a menu with the same
options:
To move a toolbar, click on the toolbar docking handle and drag to any new location you
wish. Toolbars are either docked or floating – most toolbars are docked (combined into a
group of toolbars that are locked to the top of the screen). When moving a toolbar, you
can drop it over another toolbar and the toolbars will be redrawn to fit.
Adding and deleting toolbar buttons
If you decide that a particular button is not needed on a toolbar, or you want to add
another one that is not currently visible, select Customize from the Tools menu then
select the Commands tab in the dialog. Choose from the following:
•
Click on a category to show all the buttons for that toolbar.
•
Click on a button to bring up a button description.
•
To add a button, click on it and drag the button onto a toolbar (it will probably help if
you put the button in the same toolbar group as the rest of the buttons in the
category).
•
To remove a button from a toolbar, then right-click over the button (on the toolbar that
is, not the dialog box) and select Delete from the menu.
•
To reposition individual buttons, drag and drop them to a new location elsewhere,
either in their current toolbar or in another toolbar.
Alternatively, select Customize from the Tools menu and then select the Toolbars tab in
the dialog and click the Reset button to restore all buttons to the selected toolbar.
20 Getting Started
Creating new toolbars
You can create a new toolbar group for your own collection of buttons. This is especially
useful if you are using macros and want to create new buttons to run macro commands
(see Creating new buttons on page 20)
To create a new toolbar:
1. Select Customize from the Tools menu.
2. Select the Toolbars tab in the dialog.
3. Click the New button and give the toolbar a name.
The new toolbar will be displayed ready for repositioning on page 18 and adding buttons
on page 19.
To remove the new toolbar, select Customize from the Tools menu and then select the
Toolbars tab in the dialog. Click on the toolbar you want to remove (not one of the builtin toolbars) and select the Delete button.
Creating new buttons
Buttons can only be created for the purposes of running macros.
1. Select Customize from the Tools menu.
2. Select the Macro Shortcuts tab in the dialog.
3. Select the macro command you want to create a button for and drag and drop onto a
toolbar.
Additionally you can:
•
Change the icon for the button by right-clicking over the button (on the toolbar not on
the dialog) and selecting Button Appearance. Select from one of the built-in icons.
•
Add "dividing lines" between buttons by right-clicking over the button where you want
the divider to appear before (on the toolbar not on the dialog) and selecting Begin a
Group. Select the command again to turn off the dividing line.
Toolbar appearance
The style of the toolbar can be modified. Select Toolbars from the View menu and then
select:
•
21 Getting Started
Cool Look - turns the coolbar mode on and off. Coolbars are the Windows 98 style
flat buttons.
•
Large Buttons - increases the size of all buttons.
•
Show Tooltips - a brief functional description for each button, which appears when
you run the mouse pointer over the buttons.
Menu and macro shortcuts
Shortcuts are commands that are executed by a key on the keyboard (or usually a
combination of keys). For example, F1 brings up Help and Ctrl-X cuts text (unless you
assign the keys differently).Shortcuts can be assigned to macros.
1. Select Customize from the Tools menu.
2. Select the Keyboard tab in the dialog (or Macro Shortcuts.for macros).
3. Choose a command group, for example File, Format or Macros (for macros) and then
pick an individual command (like Open or one of your own macros).
4. Review the current shortcut in the Current Keys box
5. Click into the Select New Shortcut Key box
6. Assign a new shortcut by pressing a key combination – for example Alt-Z. You will be
warned if the chosen shortcut is already in use.
7. Click the Assign button to save the changes.
The shortcut can be removed by selecting it in the Current Keys box and selecting the
Remove button. Note that the built-in shortcuts (like Ctrl-P for print) cannot be removed
although you can assign additional shortcuts to these commands so that either will work.
Once the Customize dialog is closed, you can execute the command or macro by
pressing the new keyboard shortcut.
Windows basics
Common to all Ability applications are basic Windows structures, like toolbars, and
techniques, such as using menus and selecting text. Some of these are in fact common
to all Windows applications.
Common to all Ability applications
Shortcut keystrokes on page 22
22 Getting Started
Changing the screen view on page 23
Toolbars on page 23
Status bar on page 24
Common to (most) Windows applications
Using the mouse - clicking on page 24
Using the mouse - selecting on page 25
Drag and drop on page 25
Using menus on page 25
Shortcut menus on page 26
Closing, minimizing and maximizing windows on page 26
Note: Help is written with the Windows 95, Windows 98 and NT 4.0 (or later) interface in
mind. Users with Windows NT 3.51 should refer to the operating system documentation
and/or on-line help that comes with the operating system.
Shortcut keystrokes
Ability includes a number of shortcut keystrokes. These enable you to execute
commands without opening the menus. As you become more familiar with Ability and you
start to use these shortcuts, you will find that they can save you a lot of time.
The shortcut keystrokes, where available, are shown down the right-hand side of the pulldown menus, alongside the commands they represent.
Here are some useful shortcuts:
Ctrl-X
Cut
Ctrl-C
Copy
Ctrl-V
Paste
Ctrl-P
Print
Ctrl-N
New document
Ctrl-O
Open document
23 Getting Started
Ctrl-S
Save document
Ctrl-B
Bold text
Ctrl-I
Italic text
Ctrl-U
Underline text
Changing the screen view
You can change how large or small the document appears on the screen by selecting the
Zoom command from the View menu. A Zoom dialog box is displayed.
You can choose how large or small you want the document to appear, as a percentage of
its usual size. You can select a size between 25% and 400%.
400%
displays the document at four times its usual
size
200%
displays the document at twice its usual size
100%
returns the document to its usual size
75%
displays the document at three-quarters of its
usual size
50%
displays the document at half its normal size
25%
displays the document at a quarter of its
normal size
Page Width
scales the display so that the width of the
Page fits within the document window
Margin Width
scales the display so that the width of the
Work Area fits within the document window
Whole Page
scales the display so that you can see an
entire page in the document window
Custom
reduces or enlarges the display of the
document according to the percentage you
type in. Percentages of less than 15% and
greater than 999% are disregarded.
Toolbars
A toolbar is a group of buttons that provide a shortcut to using the menus. For example,
this is the standard toolbar that appears in every application:
24 Getting Started
Usually a toolbar appears attached to the top of an application, but can be torn off and
docked on the left, right or bottom edge of the application, or appear floating over the
application.
If a button is “grayed” out, then that button is temporarily not available. For instance, if
you are in an application but have not yet gone into a particular document, then the
formatting buttons will not be available for use.
Certain buttons, when selected, will appear depressed. These buttons will operate until
they are deselected. For instance, the format buttons will continue to operate while
depressed.
You can add and remove buttons from the toolbar and even create your own toolbars –
especially useful if you want to put macro commands on the toolbars. See Customizing
toolbars on page 18 for more details.
Status bar
The line at the bottom of each application window is called the status bar. Here's a typical
status bar for Write:
Status bars can give you information about the current process, such as a progress
report on saving a file or a description of the currently selected menu command.
To turn the status bar on or off, select the Toolbars option from the View menu and
select the Show Statusbar box.
Clicking
If your mouse button has more than one button, use the left button unless otherwise
advised. If you are left-handed and have swapped mouse buttons over for convenience,
use the right-hand button instead.
To click on an item (such as a button or a window), move the mouse pointer until the
mouse arrow is resting on the item on screen. Then push down and release the mouse
button.
To double-click on an item, position the mouse arrow and then click and release the
mouse button rapidly, twice in succession.
25 Getting Started
Selecting
You will constantly be selecting text and other items, for instance, when you select text
for formatting.
1. Use the mouse to point to the start of the area you want to select.
2. Holding down the mouse button, move the mouse pointer to the end point of the area
you want to select.
3. Release the mouse button.
The area should now be selected (visible by inverse color on screen).
If you do not have a mouse, use the arrow keys to position the cursor at the first position.
Then hold down the SHIFT key and use the arrow keys to drag it to a new position. Then
release the SHIFT key.
Drag and drop
You can move selected items around on the page by using a technique called drag and
drop:
1. Select the item you want to move.
2. Hold down the mouse button and move it to the new location.
3. Release the mouse button.
The following items can be dragged and dropped:
•
Selected text in Write
•
A cell, or range of cells, in Spreadsheet
•
Inserted objects in Write or Spreadsheet
•
Graphic objects in Forms or Draw
Using menus
Ability has a series of pull-down menus from which you can select commands. The titles
of these menus are the words, such as File and Edit, along the menu bar at the top of the
window.
26 Getting Started
To open a menu, move the mouse pointer to the required menu title and click the mouse
button. If you open the wrong menu, simply click on another menu title.
To choose a command from the menu, move the mouse pointer to the command and
click with the mouse button. The menu will close and Ability will perform the action you
have chosen.
Note: Not all menu commands are available at all times. For instance, if you have not yet
opened a document, the Save command will not be available. Commands that are not
available are shown “grayed out” in the menus and you cannot select them.
Shortcut menus
Shortcut menus are special menus that are tailored to match the application you are
currently working in. They are accessed by right-clicking over a part of the working
document.
For example, in spreadsheet, right-click over the main body of the sheet to get a menu
that features a selection of common editing and formatting commands.
Generally, the shortcut menus will “know” which menu commands are useful within
particular applications and in different parts of applications.
Closing, minimizing and maximizing windows
All the Ability applications are MDI applications - meaning that more than one document
window can be open at once. Each window has it's own set of buttons to close, minimize,
maximize and restore the window. The application itself also has the same set of buttons:
•
at the top right-hand corner of any window to close it. If
Click on the Close button
there is anything not saved, you will be asked whether you want to save it or not. If
the window is an application, it will be exited.
•
Click on the Minimize button
Taskbar.
•
to make a window full size. Alternatively, doubleClick on the Maximize button
click on the application title bar. Maximize is not available if the window is already
maximized.
•
to return a window to its previous size. This converts
Click on the Restore button
a maximized window into a reduced window full size. Alternatively, double-click on
the application title bar. Restore is only available if the window is maximized. For
details on how to change the size of a reduced window, see Changing the size of a
window on page 27.
to reduce a window to an icon on the Windows
27 Getting Started
All these command are also available from the system menu - click on the application
icon in the top left corner of the window to access the system menu.
Changing the size of a window
To change the size of a reduced window:
1. Move the mouse pointer to the border of the window.
2. When it is positioned exactly over the border, it will turn into a double-headed arrow.
3. Now click and drag, and the border will move with the arrow.
All four borders can be moved independently, so you can alter the shape of the window
exactly.
Getting help
You can ask for help at any time in Ability.
General help
•
Select the Application Help command from the Help menu to access the on-line
help system for that application.
•
Select the Ability Office Help command from the Help menu to get the full on-line
manual.
Context sensitive help
•
and point and click on any
Toolbars - select the "What's This?" help button
toolbar button, or any other part of the application window, to get context sensitive
help.
Also note that tooltips are available for toolbar buttons - just place the mouse pointer
over any button and a brief description will pop up.
•
Menu commands - select the "What's This?" help button
command from the menus, to get context sensitive help.
•
Dialog boxes - in dialogs, click the dialog "What's This?" button
and then point
and click on any part of the dialog to get specific help on that item.
and select any
Some dialogs also contain a help button to provide supplementary assistance to the
"What's This?" help.
28 Getting Started
Using the help topics dialog
A Help Topics window (accessible through the Application Help command from the
Help menu) keeps the help organized like a book. It is a tabbed dialog and so provides
three entry points into the actual help text.
Contents - this is like the contents page of a book and is arranged in chapters, subchapters and, finally, help pages. Double-click on any chapter
to see what's in it, and
double-click on a help page to display the actual help.
Index - allows you to search for key words. For example, enter "Mail Merge" (without the
quotes) to locate all the help pages containing this key word.
Find - searches for the supplied word in all the text within Help. When you first use this
option, Windows will index the help system - this will take a short while.
Once you've opened a help page, you can always use the Help Topics button to return to
this dialog.
Navigating inside the help pages
In the help pages, you can navigate through the rest of the help system as follows:
•
Use the green underline links to move to related help topics.
•
Use the Topics Help button to move back to the Topics Help Page.
•
Use the forward
and backward
buttons to move to the next and previous
topic. The help system is arranged in the same order as a manual, so you can start at
the top and read the entire help system in this way.
•
Use the Back button to jump to the last visited topic.
Root directory
This is an outdated, if still useful, term. The root directory is the top-level folder for a
particular drive. It contains a list of folders from which you can navigate to any sub-folder
on the drive. It also contains start-up information for your operating system (if it happens
to be the boot drive) and sometimes documents, although this is not really a good place
for them to be saved.
29 Launcher
Launcher
The Launcher provides a convenient way to start any of the Ability modules and an easy
way of opening existing documents.
Launcher can be configured (see Display options on page 30) in a similar way to the
Windows taskbar (see Windows taskbar on page 33): docked to the edge of the display,
or floating as an "always-on-top" toolbar.
The Launcher can be extended to quick start other applications (see Adding an
application on page 31) - for example, Windows Explorer and Control Panel.
Here's what each of the buttons on Launcher does:
Open Ability
Document
Opens any Ability document – see
Opening existing documents on page 10
Write
Starts Write with a new document – see
Launching an application on page 30
Database
Starts Database – see Launching an
application on page 30
Photopaint
Starts Photopaint – see Launching an
application on page 30
Spreadsheet
Starts Spreadsheet with a new
document – see Launching an
application on page 30
Draw
Starts Draw with a new document – see
Launching an application on page 30
Explorer
Windows Explorer. Part of the Windows
operating system, it allows
comprehensive file management and
access, including finding, deleting,
copying, organizing and renaming of
files.
Launcher Menu
Options for configuring Launcher.
30 Launcher
Starting Launcher
To run Launcher, do one of the following:
• Click the Start button, select Programs, select Ability Office and then select
Launcher from the list of Ability applications.
•
If you are already in an Ability application, click on the Launcher button
toolbar.
on the
Display options
In its default state, the Launcher will appear as a floating toolbar, which can be moved
anywhere on the screen simply by dragging it to a new location.
You can dock it by dragging it to an edge of the screen where it will appear in similar way
to the Windows taskbar.
You can have the Launcher always visible or choose to display it only when the mouse is
moved over it. Right-click over Launcher and choose from the following:
•
Select Always on Top to make Launcher appear on top of other windows, so you
can always see it.
•
Select Auto hide to make Launcher disappear while you’re not using it and reappear
as you move the mouse over it. This option only applies if Launcher is docked to the
edge of your display.
The Launcher buttons can be displayed with flat buttons (the default "Coolbar" mode),
with large buttons, and with (or without) tooltips. Select Options from the Launcher
Menu. Choose any combination you wish.
Launching an application
To run Write, Database, Spreadsheet or Draw, simply click on it’s button.
In the case of the Ability applications, here's what happens:
Write
Opens Write with a new document,
based on the normal template.
Spreadsheet
Opens Spreadsheet with a new
spreadsheet.
Photopaint
Starts Photopaint
31 Launcher
Draw
Opens Draw with a new draw document.
Database
Starts Database.
Other applications that may be added to Launcher, such as Windows Explorer, start in
their default state.
Opening existing documents
To open an existing document, click on the Open button
. A tabbed dialog will
appear. This divides your files into four categories: Write documents, spreadsheets,
databases and drawings. Click on the tab for the file you want.
The Open dialog only displays files in the current folder, so if you cannot see the file you
want, you’ll need to change folder.
Closing applications
Click the Launcher Menu button
and select Exit All Applications to close all Ability
applications started from Launcher. Each application will prompt for unsaved files in turn.
To close Launcher, right-click and then select Exit.
Modifying Launcher
You can add applications to and remove them from the Launcher. You can also
determine the start-up properties for these applications.
In addition, you can choose the display options for Launcher and also make Launcher
start up automatically.
Adding an application
To add an application, click the Launcher Menu button
and select Add Application.
Choose the application you want to add by typing in a path and program name in the
Target box. Alternatively, click the Find button and choose the folder and program you
want.
32 Launcher
You can optionally modify the following start-up properties:
1. In the Start In box, type the path of the directory you would like the application to
point to when it loads. For example, type in c:\myfiles if you would like the myfiles
folder to display first when selecting the File Open command.
2. In the Shortcut Key box, type a key combination that you’d like to start the
application. Valid key combinations are F1 through to F12, Ctrl-A through to Ctrl-Z
and Alt-Ctrl-A though to Alt-Ctrl-Z.
3. To pass additional arguments to the application, enter them in the Arguments box.
For example, many applications accept filenames as an argument so they can open
the file directly.
4. In the Run combo-box, choose between Normal, Minimized and Maximized. This will
determine the style of windows the application loads into.
Removing an application
Click the Launcher Menu button
and select Modify.
Select the application you want to remove and click the Delete button.
Note that Ability's own applications - Write, Spreadsheet, Database and Draw - cannot be
removed in this way.
Modifying an application
To modify an application already in Launcher, click the Launcher Menu button
and
select Modify. In the Applications tab, select the program you want to modify and then
select the Attributes tab.
Choose the new settings - see Adding an application on page 31 for more details.
Select OK to save and exit the dialog. Select Apply to save and continue modifying other
applications.
Adding Launcher to the startup group
If you want Launcher to appear automatically every time you start Windows, add it to the
Windows StartUp group by following these steps:
1. Right-click on the Start button, select Open and then double click the Programs
folder. The Programs Folder will open and you’ll see, among other folders, an Ability
Office folder and a StartUp folder.
33 Launcher
2. Double-click the Ability Office folder.
3. Arrange the Windows so you can see the Ability Office folder (now opened) and the
StartUp folder on screen at the same time.
4. Keeping the Ctrl key pressed, drag the Launcher icon and drop it over the StartUp
folder.
Note: This procedure will work with any application so you can add Write or Spreadsheet
(or both) to the StartUp folder in exactly the same way. They will then start every time you
start Windows.
Windows taskbar
Part of the Windows operating system. This allows you to run applications with the
Start button. It also shows all running applications and allows you to switch between
them.
34 Write
Write
Write is the Ability word-processing application. With word-processing, you can type a
document, then revise it until it reads and looks just the way you want. Using Write, you
can create and edit documents, correspondence, business reports, and other printed
materials, including:
•
Inter-office memos
•
Sales promotional material
•
Annual reports
•
Advertising copy
•
Business letters
•
Book manuscripts
Additionally, you can include spreadsheets, charts and drawings in any document you
create with Write.
Starting Write
To start Write, follow these steps:
1. Click the Start button on the Windows Taskbar
2. Select Programs
3. Select Ability Office
4. Select Ability Write
Write will open with a new document ready for typing.
Parts of the Write window
The following sections tell you about the different parts of the Write window and how to
work with them. These include the toolbars, the horizontal ruler, the vertical ruler, the
status bar, and the workspace.
35 Write
The toolbars
Across the top of the window are the toolbars. The toolbars contain buttons and dropdown lists that enable you to format and manipulate the text quickly and easily, without
needing to open the menus.
There are several different toolbars, each grouping buttons and controls of similar
function. Here are three of the most common toolbars in Write:
The standard toolbar is common to all applications and contains basic file opening,
closing, saving, printing, editing, searching and zoom functions:
The format toolbar contains text styling options for fonts and paragraphs, and also and
allows you to define border and background styles for paragraphs:
You can always get help on what each button does by moving the mouse pointer over it a yellow box, or tool-tip, containing a brief description is displayed.
Note: If you cannot see a particular toolbar, open the View menu and click on the
Toolbars command - make a selection from the list of toolbars. The screen will be
redrawn and the toolbar shown.
The horizontal ruler
Across the top of the window is the horizontal ruler.
This ruler shows the margin settings and tab stops which are in use.
You can change the size of the left and right hand margins directly from this ruler:
1. Place the pointer over the left or right border that separates the grey and white
portions of the ruler - a double-headed horizontal arrow is displayed.
2. Drag this to set a new margin.
The right and left margins are set separately.
36 Write
You can also set paragraph and tab settings directly from this ruler. See Paragraph
indents on page 43 and Tab stops on page 44.
Note: You can choose not to display the horizontal ruler. To do this, use the Ruler Bars
option from the View menu.
The vertical ruler
Down the left side of the Write screen is the vertical
ruler.
You can change the size of the top and bottom
margins directly from this ruler:
1. Place the pointer over the top or bottom border
that separates the gray and white portions of the
ruler - a double-headed vertical arrow is
displayed.
2. Drag this to set a new margin.
The top and bottom margins are set separately.
Note: You can choose not to display the vertical
ruler. To do this, use the Ruler Bars option from the
View menu.
The workspace
The area in which you work on a Write document is called the workspace.
You can think of this as a piece of paper that is ready to write or draw on.
The status bar
The status bar in Write gives you some very useful information about where you are in
the document:
In the above example, the status bar tell us:
•
The cursor is on page 6 of a 9-page document.
•
The cursor is on line 12 and there are 12 lines in total on page 6.
•
37 Write
The cursor is at the 28th character column on the line and there are 48 characters in
total on the line.
•
Write is in Insert mode. Press the Insert key to change to Overwrite mode. When
Write is in Insert mode, anything you type will be inserted at the cursor position. In
Overwrite mode, anything you type will replace whatever is at the cursor position.
Press the Insert key again to change back to Insert mode.
•
“Modified” tells us that the active document has been changed and the changes have
not been saved. If the active document has not been changed, or if any changes
have been saved, this message changes to “Saved”.
Note: When you highlight a menu command, Write describes the command on the left
side of the status bar.
Moving around a document
To move around a Write document, you will usually locate where you want the cursor to
go by using the mouse and clicking. You can also use the scroll bars at the right and
bottom of the screen to see more of the document.
However, you can also move the cursor with the cursor movement keys, and there are
times when this can be quicker. The following table shows all the ways you can move the
cursor.
Key
Description
Arrow keys
The arrow keys move the cursor one character at a
time in the direction of the arrow (up, down, left, or
right).
ctrl + Í &
ctrl + Î
Hold down the ctrl key and press the left arrow key
to move to the left a word at a time. Hold down ctrl
and press the right arrow key to move to the right a
word at a time.
home & end
The home key moves the cursor to the beginning of
the current line; the end key moves it to the end of
the current line.
page up
Moves the cursor up one whole screen at a time.
page down
Moves the cursor down one whole screen at a time.
38 Write
ctrl + page up &
ctrl + page down
Hold down the ctrl key and press the page up key
to move to the top of the previous page; hold down
ctrl and press the page down key to move to the
top of the next page.
ctrl + home &
ctrl + end
Hold down the ctrl key and press the home key to
move the cursor to the beginning of the document;
hold down ctrl and press the end key to move to
the end of the document.
As you move around a document, the page, line and column information displayed on the
status bar changes.
Creating a document
When you start Write, a new document is automatically opened for you to begin working.
From within Write, there are two different ways of creating a new document:
•
on the toolbar. This creates a new document, based on
Click on the New button
the Normal template. See Using templates on page 83 for more details on document
templates.
•
Select the New command from the File menu. Ability will display a list of templates –
choose the one you want and click on OK (you would anyway usually choose the
Normal template).
Typing text
In a new or existing document, a flashing cursor shows the current location. When you
start typing, text will appear at the cursor and you will notice that the cursor moves to
show the current location.
You do not need to press the Enter key at the end of a line of typing: Write automatically
wraps the text round onto the next line when there is no more room on the current line.
You can use the ← (backspace) key to erase typing mistakes.
To start a new paragraph, press Enter.
When the page is full, you will automatically be taken to the top of the next page. You can
also choose to start a new page at any point - select the Page Break command from the
Insert menu, or press ctrl+enter.
39 Write
You can use the Tab key to move the cursor to the next tab position as shown on the
ruler. After pressing the Tab key, the next piece of text you enter will be aligned to the
left, right or center, according to the alignment setting of the tab (see Changing tab
settings on page 45).
You can modify existing text by placing the cursor at the point where you want to begin
typing. The new text will either replace that text character by character or be inserted into
it. This depends on whether you are in Insert mode or Overwrite mode (see Status bar on
page 36 for more details).
It is wise to get into the habit of saving your work regularly. As with all Ability programs,
you do this by clicking the Save button
command from the File menu.
on the toolbar or selecting the Save
Selecting text
You need to select portions of text if you want to change font, cut, copy or move the text,
or apply.
To select text use one of the following techniques:
•
Select any text - hold down the mouse button and dragging the cursor over the text
to highlight it. You can do the same thing with the keyboard by holding down the shift
key and moving the cursor with arrow keys to highlight text.
•
Select a line of text - move the mouse pointer to the left of a paragraph (i.e. into the
left hand margin) until the pointer changes to a right-facing arrow. Click once to
highlight a line.
•
Select a paragraph of text - move the mouse pointer to the left of a paragraph (i.e.
into the left hand margin) until the pointer changes to a right-facing arrow. Double
click.
•
Select an entire document - use the Select All command from the Edit menu.
Note: You can extend a highlighted area by holding down the shift key, pointing at the
new position with the mouse, and then clicking.
Editing text
The first step in editing text is to select it (see Selecting text on page 39).
You can then:
•
Copy, move or delete (see Moving, copying and deleting text on page 48)
40 Write
•
Apply text formatting (see Formatting text on page 40)
If you change your mind after editing or formatting the text, you can click the Undo button
or select the Undo command from the Edit menu.
This command enables you to undo as many actions as you like, e.g. you can reverse
your last few editing or formatting actions and further.
If you change your mind again, you can reverse the undo by clicking the Redo button
or selecting the Redo command from the Edit menu.
If you want to perform several undos or redos at the same time, click on the arrow
buttons next to the Undo and Redo buttons. In the "Undo" and "Redo" dialogs click on
the action up to which you want to undo or redo: all the actions listed in the dialog that
are placed before the action you click on will also be undone or redone.
Word count
You can count the number of words, characters and pages in a Write document. To
ascertain the number of words in your document select Word Count from the Tools
menu. Among other information the number of pages, words and characters are shown.
The same information, plus additional statistics relating to editing time and number of
document revisions, is available by selecting Properties from the File menu (see
Document summary information and statistics on page 9).
Formatting text
To format text, first select it (as explained in Selecting text on page 39) and then use the
format toolbar (see Toolbars on page 35) across the top of the Write window to set the
font, style and size of the selected text:
Click on the arrow to the right of the font
name box to display a list of available fonts,
and then choose the one you want:
Click on the arrow to the right of the font
size box to choose a font size:
Font name box
Font size box
Finally, you can apply a limited range of styling to the text directly from the toolbar.
Click on the Bold button
to make the text bold.
Click on the Italic button
to italicize the text.
41 Write
Click on the Underline button
to underline the text.
Click on the Strikethrough button
to draw a line through the text.
Click on the Font Color button to color text with the currently selected color (to change
the selected color click on the arrow and choose a color from the drop-down menu).
The changes you make are applied to the selected text right away.
You can also format text using the options under the Format menu.
Formatting text using the menus
As an alternative to formatting text using the toolbars (see Formatting text on page 40),
you can use the menus instead.
First, select the text (see Selecting text on page 39), and then select the Font command
from the Format menu or right-click and select the Font option. On the Font page of the
“Text Property” dialog:
•
Use the Font box to select the type of font.
•
Use the Font style box to choose from Regular (i.e. no styling), Italic, Bold and
Bold Italic.
•
Use the Size box to select the font size.
•
Use the Effects group box to choose from Strikeout, Underline, Superscript and
Subscript.
•
Use Apply to field to choose whether to apply the chosen effects to any fields in the
selected area.
•
Use the Color box to choose from the list of available colors.
The options chosen are displayed in the Sample box. This enables you to get some idea
of the effect before actually applying it to the document, and therefore allows you to
experiment without committing yourself.
Once you are satisfied, click on the OK button and the formats will be applied to the
selected text.
You can store frequently used combinations of font and font styles by defining a
character style (see Creating new styles on page 68).
42 Write
Changing case
You can change the case of text (i.e. choose whether it is to appear as capitals, small
letters or as a mixture of the two) without having to re-type it. To do this, select the text
and select the Change Case command from the Format menu. The “Change Case”
dialog appears.
There are five options:
Sentence case
starts each sentence with an uppercase letter, while all other words
start with lowercase letters
lowercase
changes all letters in the selected text to lowercase
UPPERCASE
changes all letters in the selected text to uppercase
Title Case
capitalizes the first letter of each word
tOGGLE cASE
changes uppercase letters to lowercase, and vice versa
Select the option you require and click on the OK button to implement it.
Symbols
Sometimes you will want to use symbols that are not found on the standard keyboard.
Windows comes supplied with a wide range of these, such as the copyright symbols and
the registered trademark symbol, Greek characters and various mathematical symbols.
To insert a symbol, position the cursor at the point where you want the symbol, and then
select the Symbol command from the Insert menu. The “Character Map” dialog is
displayed.
Select the symbol font in the Font box - “Symbol” and “Wingdings” are two common ones
that provide a good selection of symbols. The character map will change to show the
symbols in that font.
Click on a symbol to magnify it and double-click to insert it into the Characters to copy
box. Multiple symbols can be inserted in this way or by using the Select button. Click the
Copy button to insert the symbols into the document.
Note: You can apply all the usual formatting commands to these inserted symbols.
Symbols are inserted in the document as text. If you later change the font of selected text
that contains inserted symbols, the symbols will take on the new font just like any other
text.
43 Write
Formatting paragraphs
Paragraphs can be formatted in the same way as any other text: you can select font,
size, bold, italic, etc. (see Formatting text on page 40 for more details).
Paragraphs have additional properties that you can control:
•
Alignment - left, center, right, justified (see Paragraph alignment on page 43)
•
Indentation - how far the paragraph is indented from the left and right margin (see
Paragraph indents on page 43)
•
Tab stops – where the tab stops are placed and the type of tab stop (see Tab stops
on page 44)
•
Borders and backgrounds (see Borders and backgrounds on page 46)
•
Line spacing - single, double, custom, before and after spacing (see Line spacing on
page 44)
Note: To style more than one paragraph at once, just select all the relevant paragraphs.
Paragraph alignment
The format toolbar (see Toolbars on page 35) allows you to align selected paragraphs, as
follows:
Click on the Left Align button
Click on the Right Align button
Click on the Center button
to align the paragraph to the left.
to align the paragraph to the right.
to center the paragraph between the margins.
to justify the paragraph (which alters the spacing between
Click on the Justify button
the words so that straight left and right margins are created).
Paragraph indents
Use the horizontal ruler (see Horizontal ruler on page 35) to set the amount of extra
indent from the left and right margins that you require for your paragraphs.
44 Write
To change the indentation of the paragraph, click on one of the indent markers and drag
it to a new position. The top left marker sets the first line indent and the bottom left
marker sets the indent for the rest of the lines. The right-hand marker sets the right
indent. The paragraph is redrawn when you release the mouse after setting each indent.
Note: You cannot set paragraph indents outside of the overall page margin settings.
Tab stops
You can position tabs and set their alignment directly from the horizontal ruler (see
Horizontal ruler on page 35). There are three ways in which tabs can be positioned:
•
Click on a tab stop and drag it to a new location.
•
Press shift, click on a tab and drag it to a new location (continuing to press shift). All
the other tab stops will move relative to the moved tab.
•
Press ctrl and click on a tab. As you drag the tab to a new location, intermediate tab
positions are erased.
To set the alignment of a tab, click on it with the right-hand mouse button. Keep clicking
to toggle through these values:
Left align - text at this tab stop will be displayed to the left
Right align - text at this tab stop will be displayed to the right
Center align - text at this tab stop will be centered on the tab
Decimal align - numbers at this tab stop will be centered on the decimal point
Line spacing
To adjust line spacing, select the Paragraph command from the Format menu.
In the Spacing group box, you can specify the amount of vertical space allowed for each
line of text. From the Step drop down-list, choose between, Single, 1.5, Double, 2.5 and
Custom.
45 Write
By default, Ability uses single line spacing, which works by examining the largest font on
the line and setting the line height to approximately 120% of the font’s height. Double
spacing uses 240% and so on. You can set your own line spacing by typing a value in the
Custom box or clicking on the arrow to scroll through the values.
The Before and After boxes allow you to specify the spacing at the beginning and end of
a paragraph respectively. This is useful in conjunction with styles when creating long
documents, as you can specify the exact spacing before and after headings and subheadings.
Paragraph formatting using the menus
You can make minute changes to the paragraph margins and indentation by selecting the
Paragraph command from the Format menu or double-clicking on a paragraph indent
marker from the ruler. The “Paragraph” dialog is displayed.
In the Margins group box, you can set exact measurements for the Left paragraph
margin, the Right paragraph margin, and the first line Indent. These work on top of the
page settings. So, if the work area has a left page margin of two inches and you set a
paragraph margin of an inch, the text will actually begin three inches from the left of the
piece of paper.
In the Alignment box, you can set the alignment of the paragraph, choosing one of Left,
Right, Center and Justified.
Click on the Tabs button to modify the tab stops for the paragraph (see Changing tab
settings on page 45).
Choose the line spacing option (see Line spacing on page 44) in the Spacing group box.
When all is set, click on the OK button. The horizontal ruler (if it is displayed) will be
redrawn with the new marker locations on it.
Changing tab settings
To change tab settings for a paragraph, select Tabs from the Format menu or doubleclick a tab stop on the ruler to display the “Tabs” dialog.
To enter a new tab location, type a value in the entry box at the top left of the dialog, then
choose one of the four styles of tab stop:
Left - text is inserted to the right of the tab position
Right - text is inserted to the left of the tab position
Center - text is inserted equally to the left and right of the tab position
46 Write
Decimal - text is inserted so that the decimal point lines up with the tab position
Click on Set to set the new tab.
To erase a tab stop, click on it in the list of tabs on the left of the dialog and then click on
the Remove button. Click on the Remove All to clear all the tab settings.
To reset all the tabs, enter a value for the tab spacing in the Step box (in the Auto
Ordering group box) and click on the Reorder button. All the tabs are replaced with new
settings following the Step value you have chosen.
Borders and backgrounds
Borders and backgrounds are applied at the paragraph level - you can put a border
around one or more paragraphs but not individual sentences within paragraphs.
Borders and backgrounds are set with the borders buttons on the right of the Format
toolbar (see Toolbars on page 35) or in the Borders and Shading box from the Format
menu.
Select the text you wish to put a border around and use the border buttons as follows:
Set the border Line Style for subsequent
borders. If you want to change an existing
border, set the style and re-apply the border
edges by removing and then reinstating them
(as outlined below).
Set the background Shade Style. Choose
from a range of options between Clear and
Solid. By default, the background is Clear and
white - this can be changed in the borders
dialog (see Using the borders dialog on page
47). In conjunction with the Shade Style you
can determine the color of the shading by
selecting one of the options in Fore Color,
bearing in mind that no color can be set for a
clear background.
Turn on or off the left, right, bottom and top
border lines using Change border style.
Select one of these by clicking on the arrow
and selecting it in the displayed box. The
currently selected line style will be applied to
the selected border.
47 Write
Turn all borders on, using Change border
style.
Turn all borders off (that is, remove borders),
again using Change border style.
In addition to the above border styles there are others that can be set only in the Borders
and Shading dialog, including the option to change border colors other than the standard
black and the ability to specify an offset between the border and text - see Using the
borders dialog on page 47.
Using the borders dialog
Select Borders and Shading from the Format menu to view the borders dialog.
You can use this as an alternative to using the borders toolbar (see Borders and
backgrounds on page 46) - there are some extra settings that can only be set here as
well.
Choose whether to border the selected text on the Left, Right, Top or Bottom, or to
apply a full border using the All checkbox. Click on the appropriate checkbox to apply the
border; click on any selected checkbox to remove the border. To remove all borders at
once, click on None.
You can also choose the Line style and Border Color for the border, and the type of
Shading you want within the border. Click on the arrows attached to these boxes to see
the range of options and then select the required option. The color and line style will be
applied when the border is applied. The shading will be applied as soon as it is selected.
The “Border” dialog has a couple of features that can't be implemented using the border
buttons:
The Offset box allows you to increase or decrease the distance between the border and
the text.
The Shading group box enables you to choose the colors to be used in a particular
shading style. First select a shading style in Style, and then the background and
foreground colors in Back Color and Fore Color respectively. If style is set to solid, back
color will have no effect and if style is clear, fore color has no effect. Anything in between
will display a mixture of the two colors.
48 Write
Moving, copying and deleting text
Moving, copying and deleting text is very easy to do, as is explained in the following
sections.
Moving text
The easiest way to move text is by drag and drop: select the text you want to move (see
Selecting text on page 39), place the mouse over the selection, left-click and drag the text
to a new location.
Alternatively, select the text, right-click and select Cut from the displayed menu (or click
on the toolbar). The text will disappear from the document. You
on the Cut button
cannot see this, but it has been placed in a Windows feature called the clipboard.
To put the text back into the document (or into another document), click where you want
the removed text to go (the cursor indicates where the text is to start).
Right-click and select Paste from the displayed menu (or click on the Paste button
on the toolbar). The text will be “pasted” into the document.
Note: The cut text stays in the clipboard until you put something else in there, allowing
you to paste it into documents as many times as you like until it is replaced.
Copying text
The easiest way to copy text is by drag and drop: select the text you want to copy (see
Selecting text on page 39), place the mouse over the selection, left-click as you depress
the Ctrl key on the keyboard, and drag the text to a new location.
Alternatively, select the text, right-click and then select Copy from the displayed menu (or
click on the Copy button
into the clipboard.
on the toolbar). The text stays where it is and a copy is put
To put a copy of the text into the document (or into another document), click where you
want the copy to go (the cursor indicates where the text is to start). Right-click and select
Paste (or click the Paste button
document.
on the toolbar). The text will be “pasted” into the
Deleting text
To remove text, first select it (see Selecting text on page 39) and then right-click and
select Cut (or click on the Cut button
on the toolbar). The text will disappear from the
49 Write
document. The text is now in the clipboard, so is available for pasting if you want to do
so, but since you do not have to paste it anywhere it has effectively been deleted.
Alternatively, select the text and then:
•
overtype with something else
•
press the del key or select Delete from the Edit menu
•
press the ← (backspace) key
Finding and replacing text
You can use Write to change a word or phrase anywhere in a document. You can change
all occurrences of a particular word or phrase in a single “search and replace” operation.
For example, if you have written a report on a company called Jeans Limited, and realize
later that it is called Genes Limited, you can quickly search for every occurrence of Jeans
and replace it with Genes.
Finding text
To find a word or phrase, follow these steps:
on the toolbar or select the Find command from the
1. Click on the Find button
Edit menu. The “Find” dialog is displayed, in which you can find all instances of a
piece of text, for example, the words “blue sky”.
2. In the Find What box, type the text you wish to find.
3. In the Direction box, choose where you would like to look for the text:
•
All searches the whole document
•
Up searches from the cursor to the beginning of the document
•
Down searches from the cursor to the end of the document
4. In the Matching box:
•
Select the Match Case option to find only those occurrences that have the
combination of uppercase and lowercase letters specified in the Find What box.
50 Write
•
Select the Match Whole Words Only option to find occurrences that are words
by themselves, and not part of a larger word e.g. searching for “foot” will not find
“football”.
5. In the Style box, you can choose to search for text in a particular font style. Click on
the arrow next to Style, and then choose a style from the list e.g. searching for
“eucalyptus” in the Normal style will ignore any examples of this word that are, say, in
italics.
6. When everything is set, click on the Find Next button, and Write will find the next
occurrence of the word or phrase. Click on Find Next again until there are no more
matches. A message will tell then tell you that the search has been unsuccessful.
7. Once you have exited the "Find" dialog, you can continue to search for the same text
string without having to enter the “Find” dialog. Ability remembers the last text string
searched for in Find, so to continue your search just select Find Next from the Edit
menu.
Replacing text
To find and replace text, follow these steps:
on the toolbar or select the Replace command from
1. Click on the Replace button
the Edit menu. The “Replace” dialog is displayed. This is very similar to the “Find”
dialog (see Finding text on page 49) and allows you to determine how text will be
matched and the direction of search. However, there are some additional features
specific to Replace.
2. In the Replace With box, type the text or phrase you wish to replace the found text
with (or you can paste it in from the clipboard if it has been previously copied). There
is also the option to set the style of the replacement text in the Style box.
3. When all is set, click on the Replace button to find the next occurrence of the find
text. Click on Replace again to replace the found text and move on to the next
occurrence of the find text, and so on till you reach the end of the document or no
longer wish to proceed. Alternatively, click on the Replace All button to replace all
occurrences in the document of the find text with the replace text. If no matching text
is found for replacing, a message is displayed saying that the search was
unsuccessful.
4. While in the "Replace" dialog you can also choose to search for text without
replacing. Click on Find Next to do this and ignore any text that may have been
placed in the Replace With box. If you find text using the Replace button and you
decide that you don’t want to replace a particular occurrence of the text, then just use
Find Text. Switch back to Replace when you are ready to replace some text.
51 Write
Go to
You can go to a specific place in a document. To do this, follow these steps:
1. Select the Go To command from the Edit menu. The “Go To” dialog is displayed.
2. In the Go to group box, you can choose to go to a page, a field, or an object. To go
to the next page, field or object from the current location, leave the Number box
empty and click on the Next button. To go to the previous page, field or object, again
leave the Number box empty and click on Previous.
3. You can go to a specific page, field or object by entering a number in the Number
box (or using the scroll arrow at the side of this box). For example, to go to page 4 of
a document, click on Page in the Go to group box and enter 4 in the Page Number
box. The Go To button is displayed; click on it to go to page 4.
4. To move relative to the current location, enter + and - in the Number box. For
example, click on Page in the Go to group box and enter +4 in the Page Number
box. Click on the Go To button to move forward four pages from the present location.
Note: Ability goes to a field or object according to its position in the document. For
example, if you tell Go To to move to the third field in a document, it will search for the
third field from the top of the document, not the third field inserted.
Tables
Tables allow you to separate off and structure information in a Write document. Each
table is displayed as a grid. Once you have created a basic table, you can add or delete
columns and rows, format individual cells or the whole table, split the table or join it to
another table, and so on.
Insert a table as follows:
1. Select Insert Table from the Table menu.
2. The “Insert Table” dialog box is displayed with options for Number of columns and
Number of rows. The maximum possible number of columns is 30 and of rows is
10,000 (the default is 2 for each). Type in the number of columns and rows you need
(or alternatively use the scroller). If you wish to alter these later you can always add
or delete rows and columns.
3. Click on OK to close the box and insert the table.
Note that the top left-hand cell of the table is placed at the current position of the cursor in
the document.
52 Write
To enter data in a particular table cell, first select the cell and then type the data. Note
that when you reach the right-hand border of the cell a new line will be created to allow
more space for further data entry.
Editing Tables
After you have created a table (see Tables on page 51) you can to edit it in a number of
ways, including entering or deleting data, adding or removing row or columns, splitting or
merging cells.
Edit the data in a cell by selecting the relevant cell and editing just as you would in the
body of the document i.e. typing to enter data, backspacing to delete data. Delete the
entire contents of a cell by selecting the contents with your mouse and pressing the
Delete key (or right-clicking and selecting Cut).
Stretch or shrink cell borders by moving your mouse over the relevant border. When the
pointer changes form depress the left mouse button and drag the border to a new
position before releasing.
Format a cell, row, column or group of cells by first making the appropriate selection and
then applying the formats in the usual way. Select a cell by clicking on it; a row by moving
the mouse pointer to the left of the table, on the same level as the row, and clicking once
when the pointer turns to an arrow; a column in the same way as for a row but moving
the pointer above the column. To select a group of cells, rows or columns, follow the
above procedures but keep the Ctrl key on the keyboard depressed. This prevents a
later selection from canceling an earlier one.
The following commands are available through the Table menu (or from the drop-down
menu when you right-click your mouse):
ƒ
Insert Rows allows you to insert a row, with the option of choosing to insert the row
above or below the currently selected row. You can also choose how many rows to
insert.
ƒ
Insert Columns allows you to insert a column, with the option of choosing to insert
the column to the left or the right of the currently selected column. You can also
choose how many columns to insert
ƒ
Delete Rows allows you to delete selected rows. Access this through the Delete
command in the Tables menu. Select a row to be deleted by clicking in any cell in
that row.
ƒ
Delete Columns allows you to delete selected columns. Access this through the
Delete command in the Tables menu. Select a column to be deleted by clicking in
any cell in that column.
ƒ
53 Write
Delete Table allows you to delete a whole table. Access this through the Delete
command in the Tables menu. Select a table to be deleted by clicking in any cell in
that table.
ƒ
Merge Cells allows you to merge selected cells. The cells must be adjacent and form
a complete rectangle or square before the command is activated. The selected cells
will then be formed into one big cell, with the individual cell borders erased.
ƒ
Split Cell allows you to split a cell into several smaller cells. In the “Split Cell” dialog
box you can choose how many rows (between 1 and 30) and columns (between 1
and 10000) to split the selected cell into. Note that the cell to be split may be a cell
that was previously created by using the Merge Cells command.
ƒ
Split Table allows you to split a table into two parts. Before selecting the Split Table
command, you need to select a row (or any cell in the row) at which to make the split.
The table is split so that the rows above the selected row form one table and those
below, along with the selected row, form the second table.
ƒ
Join Table allows you to join separate tables into one table. First, select the topmost
of the two tables to be joined (note that you need only select a row or a cell in the
table). On applying the command the selected table is joined to the table beneath it.
If there is some intervening text between the tables in the main body of the
document, this is placed after the new joined table.
Spell checker and thesaurus
Ability incorporates a spell checker to check the spelling of a document and a thesaurus
to suggest synonyms. In addition, you can add words to a user-defined dictionary.
Checking the spelling
Click the Spell button
to begin checking the spelling of the active document
(including any text in headers and footers). Alternatively, select the Spelling command
from the Tools menu.
Note: To limit the spell check, select the text you want to check first.
When the spell-checker comes across a word it does not recognize, the “Spelling” dialog
box is displayed.
The unrecognized word is shown in the Suggestion for box, and the reason for the
query (e.g. word not found, or word doubled) is given next to it.
The closest replacement (if any can be found) is given in the Change To box. To accept
this suggestion, click on the Change button.
54 Write
To see other suggestions, click on the Suggest button (which will be grayed out if there
are no other suggestions). To choose one of these other suggestions, click on it and then
on the Change button.
To delete the word from the document (for instance, if it is a doubled word), delete the
text from the Change To box and click on the Change button.
There are several other buttons you can use:
•
Ignore - ignores the highlighted word
•
Ignore All - ignores all occurrences of the same word
•
Change All - changes all occurrences of the same word
•
Add - adds the highlighted word to your personal dictionary - see User defined
dictionary on page 54 for more details.
If you don’t begin the spelling check at the beginning of the document, Write checks all
the way to the end and then asks if you want to check the spelling from the beginning.
Click on the OK button to continue checking, or on the Cancel button to end the check.
User-defined dictionary
The spell-checker has a main dictionary with many common words, and can remember
new words in a personal dictionary, so that special words such as acronyms,
abbreviations and specialist terminology can be stored and used to extend the main
dictionary.
During a spell check, when you select the Add button, the current word is entered into
your own personalized dictionary. All subsequent occurrences of the word will be treated
as if the word were part of the standard dictionary.
By default, all the words are added in a document called user.lex. You can select
alternative personal dictionaries to use instead - see Spell-checker and thesaurus options
on page 90.
You can edit the user dictionary by opening it with Write. Select the Open command from
the File menu and pick the dictionary from the file list. You may need to select Other
Files (*.*) from the List Files Of Type drop-down list to be able to do this. Remove or
edit any words and select the Save command from the File menu to finish editing your
dictionary.
55 Write
Using the thesaurus
For any word in your Write document, you can select, from a list of words, one which has
the same meaning but is perhaps more appropriate to the context of the document.
These words are called synonyms.
From any list of synonyms, you can select any of the words and enter another area of the
thesaurus to explore all the synonyms for that word. You can explore as many areas of
the thesaurus as you like, and at any time you can select an appropriate synonym to
replace your original word.
To use the thesaurus, highlight the word whose synonym you wish to find, and then
select the Thesaurus command from the Tools menu. The “Thesaurus” dialog box is
displayed.
In the Looked Up box is the word you originally selected. Its broad meaning is given
beneath in the Meanings box; of course, a word might have several meanings, in which
case they will be listed here, together with their parts of speech.
Note: If the word you have looked up is not in the thesaurus, the title of the Looked Up
box is changed to Not Found.
Contained in the Replace With box is the synonym that Write has chosen as being
closest in meaning to the original word. Any further synonyms are listed beneath in the
Synonyms box. Click on one of these synonyms to place it in the Replace With box.
Double-click on a synonym to place it in the Looked Up box (and then click on the Look
Up button to display its synonyms).
When you have put the synonym you require into the Replace With box, click on the
Replace button.
Click on the Previous button to step back through the contents of the Looked Up box.
Columns
You can think of a plain document as a single column of text stretching the width of the
page: when a line of text reaches the right border of the page it "wraps" around onto the
next line, before eventually moving to the next page.
When working with two or more columns, the text wraps to the next column and only
wraps to the next line at the end of the last column. Otherwise, all the text and paragraph
formatting remains the same.
You can apply create up to six columns for individual paragraphs or for the entire
document - see Creating columns on page 56.
56 Write
Columns are, by default, of equal width. You can set the width of all the columns, and all
the inter-column gaps, in one go or else have unequal column widths - see Formatting
columns on page 56.
To see how to remove and split columns and how columns can be used in conjunction
with frames, see Working with columns on page 57.
Creating columns
To create columns, follow these steps:
1. Select the text you want to put into columns. To turn the entire document into
columns, use the Select All command from the Edit menu. If no text is selected, only
the current paragraph will be turned into columns.
2. Click the Columns button
menu.
or select the Columns command from the Format
3. Set the number of columns (up to a maximum of six) and click OK.
Your document will be redrawn showing the columns. You can now edit the text as
normal.
Formatting columns
Click the Columns button
or select the Columns command from the Format menu
to display the “Columns” dialog:
1. Use the Number of Columns box to increase or decrease the number of columns:
the minimum is 1 (equivalent to removing previously set column formatting), the
maximum 6.
2. Make sure the Equal Columns checkbox is switched on if you want the columns to
be of equal width (the default setting). If they are equal, any changes to the column
widths or column gaps will apply to all columns; if not, you'll need to select each
column in turn in the Col # box.
3. Use the Width box to set the column width(s) according to the Equal Columns
setting. i.e. if it is checked the column widths will change together, if not you should
scroll through the Col # box and set the width for each column in turn. Note that
increasing the width will decrease the column spacing.
4. Use the Spacing box to change the spacing between the columns according to the
Equal Columns setting i.e. for all the columns at once if switched on, otherwise
scroll through the Col # box and set the spacing for each column in turn. Note that
increasing the spacing will decrease the column width.
57 Write
5. Use the Line between box to display a vertical line between the columns. Uncheck it
if you want the columns to be displayed without lines.
Note that you can also use the horizontal ruler to set column widths and spacing in the
same way you can use it to adjust margins (see The horizontal ruler on page 35).
Working with columns
When you type into columns, Write attempts to keep the number of lines in each column
equal. The text in one column shifts across to the adjacent column as more text is added.
This will continue until you select an area not formatted as columns or else issue the
Column Break command from the Insert menu.
A Column Break can do two things:
1. If the command is issued with the cursor in the middle of the column text, a blank line
will be inserted and the result will be two separated column areas. You can then
enter text in the blank line and this will continue in a single column (i.e. as in a
standard page).
This process can be reversed, simply by deleting the blank line. The two column
areas will be joined together again.
2. If the command is issued with the cursor at the end of the column text, Write will drop
out of column format and allow you to continue your document in a single column.
To return text back to a single column:
1. Select the text.
2. Click the Columns button
or select Columns command from the Format menu.
3. Set the Number of columns box at 1.
You can insert a frame and position it to sit across two columns. The text flows around
the frame in both columns - this is a page layout style frequently used in newspapers.
Frames and callouts
A frame is like a mini page that sits on top of your standard page. This mini page can be
positioned and sized anywhere on the standard page. The text within it can be formatted
in the same way as normal text and can also contain pictures or objects. This makes
frames ideal for tasks such as creating newsletters.
58 Write
You can click anywhere in a frame to make it active so that the text within it is editable.
Click anywhere on the standard page outside of the frame to return to the body text.
A callout is a frame that points to some other area on your page. This is ideal for creating
annotations. A callout has all the properties of a frame, combined with a range of line
styles to do the actual pointing.
Creating frames
You can create a new frame for text to be entered, or turn existing text into a frame.
To create a blank frame:
1. Select the Frame command from the Insert menu. The mouse pointer will change to
a +.
2. Click anywhere over the document to insert a default-sized frame or click-and-drag
the pointer to define the size.
To turn existing text or graphics into a frame:
1. Select the text or graphics you want in the frame.
2. Select the Frame command from the Insert menu.
You can change the position and size of the frame, and also alter other frame properties.
Creating callouts
To create a callout:
1. Select the Callout command from the Insert menu. The mouse pointer will change to
a +.
2. Move the mouse pointer over the position you want the callout to point to, click, and
drag the mouse to the position where you want the callout text to appear.
Alternatively, click anywhere over the document to insert a default callout.
You are now ready to enter the callout text.
You can change the position, size and appearance of a callout.
Modifying frames
When working with frames, there are five aspects you need to control:
59 Write
•
size of the frame – see Sizing frames on page 59
•
position of the frame – see Positioning frames on page 60
•
text flow around the frame – see Text flow around frames on page 61
•
text offset within the frame – see Setting the text offset to frames on page 61
•
Contents of the frame
The last of these is an easy matter – it's the same as editing text on the standard page.
Also, note that you can exchange text between the frame and the page (or other frames)
by using drag and drop – see Moving text on page 48 for more details.
Sizing frames
There are two ways you can modify the size of a frame:
Sizing the frame directly, using the mouse
1. Click in a frame to make it active - so that the frame edges are visible.
2. Click anywhere on the border of the frame so that the eight resize boxes appear.
3. Click on any resize box and drag the frame to the new shape.
Sizing a frame using the frame dialog
More control is available in the frames dialog, where you can set the height and width
exactly or set them to be automatic.
1. Click in a frame to make it active.
2. Right-click and select the Frames command from the shortcut menu (or select the
Frames and Callouts command from the Format menu).
3. Width - since the Width Type is set at Exactly, set the width you want in the Width
box.
4. Height - choose from:
•
Auto. The frame will grow and shrink vertically to match the amount of text within
the frame. With this setting the dimension in the Height box is ignored.
•
At Least. The frame will grow vertically to match the amount of text but will not
shrink if the text is reduced. You can optionally enter a value in the Height box note this cannot be set to less than the current value.
60 Write
•
Exactly. The height is fixed at the dimension you enter in the Height box.
Positioning frames
There are two ways to position a frame:
Moving a frame with the mouse
1. Click in a frame to make it active, so that the frame edges are visible.
2. Click on the frame edge so that the eight resize boxes appear on the frame.
3. Click anywhere on the frame edge, apart from the resize boxes, and drag the frame
to a new location.
Note that you can drop the frame outside the margins.
Using the frames dialog
As well as being able to position a frame anywhere on the page, you can use the
“Frames” page of the “Properties” dialog to set the position of a frame relative to the
page, margin, column or current paragraph.
1. Click in a frame to make it active.
2. Right-click and select the Frames command from the shortcut menu (or select the
Frames and Callouts command from the Format menu).
3. Horizontal. Set the distance in the Position box and then specify what you want the
position to be relative to in the Relative To box (that is, the distance from the left
edge of the frame):
•
Page - the distance is measured from the left edge of the paper.
•
Margin - the distance is measured from the left margin. If the margins are
changed, the frame will automatically adjust its position to match.
•
Column - the distance between the current column and the frame. If the column
is changed, the frame will automatically adjust its position to match.
4. Vertical. Set the distance in the Position box and then specify what you want the
position to be relative to in the Relative To box (that is, the distance from the top
edge of the frame:
•
Page - the distance is measured from the top edge of the paper.
•
•
61 Write
Margin - the distance is measured from the top margin. If the margins are
changed, the frame will automatically adjust its position to match.
Paragraph - the distance is measured from the start of the current paragraph.
Use this setting if you want the frame to flow with the text.
Setting the text offset to frames
The distance between each edge of the frame and the text within it is governed by
vertical and horizontal offsets. To set this:
1. Click in a frame to make it active.
2. Right-click and select the Frames command from the shortcut menu (or select the
Frames and Callouts command from the Format menu).
3. Set the horizontal offset in the horizontal Distance From Text box. A setting of zero
will display the frame contents horizontally flush with the body text. The default
setting is 3.6mm.
4. Set the vertical offset in the vertical Distance From Text box. A setting of zero will
display the frame contents vertically flush with the body text. The default setting is
1.8mm.
Text flow around frames
When you insert a frame into a page, the text on the page moves aside to create space
for the frame - in other words it flows around the frame. This is the default behavior for
frames. There are two other options, which you can set as follows:
1. Click in a frame to make it active.
2. Right-click and select the Frames command from the shortcut menu (or select the
Frames and Callouts command from the Format menu).
3. In the Text Wrapping group box, choose from:
•
None - flow of the body text stops at the top of the frame and continues at the
bottom.
•
Around - the default setting. Body text wraps around the frame.
•
Transparent - body text flows under the frame and the frame itself is
transparent.
62 Write
Modifying callouts
A callout shares many of its properties with frames (which is not surprising, given that a
callout is a frame with a line). See Modifying frames on page 58 for more details.
To modify the properties that only apply to a callout, follow these steps:
1. Click in a callout to make it active.
2. Right-click and select the Frames command from the shortcut menu (or select the
Frames and Callouts command from the Format menu).
3. Select the Callout tab in the dialog and set any of the following:
•
Attachment - the callout line can join the frame at the nearest Corner or at the
nearest Middle of a side. Select None to convert the callout into a plain frame.
•
Arrowhead - modify the appearance of the arrowhead. The default is to display
no arrowhead, that is, the callout will be a plain line. Select an arrowhead Style
to turn the line into an arrow and determine the arrow’s direction. The width and
the length of the arrowhead itself can be set using the Width and Length dropdowns respectively.
•
Line - set the thickness and style of the line using the Line Style drop-down and
the color of the line, which includes the color of the arrowhead, with the Color
drop-down.
4. The results are displayed in the Preview box. Click on OK when you are ready.
Deleting frames and callouts
Delete a frame or callout as follows:
1. Click in the frame or callout to make it active.
2. Right-click and select the Frames command from the shortcut menu (or select
Frames and Callouts from the Format menu).
3. Click on the Delete button at the bottom of the “Frame” page in the “Properties”
dialog.
4. The dialog is closed and the frame or callout is deleted.
63 Write
Footnotes
Footnotes allow you to annotate your text. They are used in the same way as in a normal
printed book, with superscript numbers appearing next to points in the main body of the
text that need explanation or require a reference, and the explanation or reference
appearing at the bottom of the page next to the appropriate matching number.
Write makes it easy for you to insert a footnote number field wherever you need one. A
corresponding footnote field is automatically inserted at the bottom of the page for you to
type the relevant footnote text.
To insert a footnote you should follow these steps:
1. Position the cursor at the place in your text where you want the footnote number field
to go.
2. Select Footnote from the Insert menu. The “Footnote” dialog is displayed.
3. Select a number (or letter) format in the Number Format box i.e. 1, i, A, a.
4. In the Numbering box you can choose appropriate sequencing for the footnote
fields.
•
The default is Continuous. Footnote numbering is sequential in increasing order,
that is each footnote you insert is given a number one along from the previous
footnote. Note though that if you insert a new footnote in between the previously
inserted footnotes then numbering of the footnotes as a whole is adjusted to
maintain the sequential order.
•
Restart on each page works in the same way as Continuous, except that the
numbering starts at 1 again for each new page. If there are already some
footnotes after this new footnote then they will be adjusted to be in sequence with
this new footnote.
•
Start at also works in the same way as Continuous, except that you can choose
a new start value by entering it in the Start at box. Again if there are already
some footnotes after this new footnote they will be adjusted to be in sequence
with the new footnote.
5. Once you have chosen the relevant numbering, click on OK to insert the footnote
number field. This will be inserted both at the cursor position and at the bottom of the
page, where you can type the actual footnote. To do this scroll to the bottom of the
page and click on the footnote to make it editable (the corresponding part of the lefthand ruler will be highlighted). Type the actual footnote.
6. Once you have typed the footnote you can return to the main body of the document
by clicking. The footnote can be edited as many times as you like.
64 Write
7. If you want to remove a footnote just select its number in the main body of the
document and press Delete on the keyboard.
Note: You are allowed to choose different number formats in the same document. These
will be treated separately and so kept in their respective sequential orders without
interference from one another.
Captions
A caption is a field label that you can affix to portions of text and other items, such as
pictures, fields and tables, that you may have inserted into your document. Each caption
consists of a caption name and a number (or letter). Ability allows you to use a variety of
caption types and to create your own when you need to. This is useful in that you may
want to give different types of item in your document different types of caption. Moreover,
the caption command guarantees that you can maintain an incremental order for the
various caption types you use.
To insert a caption, follow these steps:
1. Select Caption from the Insert menu. The “Caption” dialog is opened.
2. In the Label box click on the arrow to see the available caption types: Caption,
Table, Picture, Label. As you would expect, Picture and Table naturally go with
inserted pictures and tables.
3. In the Numbering box leave Continuous selected if you want the caption number to
increase by 1 from the previous caption of the same type. If you want a caption to
start at a chosen value then select Start at and enter the number in the
accompanying box.
4. Select a number or letter format in the Number Format box.
5. Click on OK to close the dialog and insert the caption.
There are certain simple rules for how caption numbering works. If, say, you choose the
Caption label, with Continuous numbering and number format 1, 2, 3, …, then the first
few captions will be Caption 1, Caption 2, Caption 3, … You can then force the next
caption to start at 1 (or any other number for that matter) and the following captions will
proceed continuously from this new caption number until you choose to start again.
Likewise if you switch from one label to another, for example, Table, the numbering will
start again for that label. When you go back to the original label, for example, Caption,
the numbering will continue in line with how you left it before switching to Table (unless,
of course, you force the numbering to start again).
Along the right side of the “Caption” dialog there are buttons for adding and deleting label
types.
65 Write
To add a label follow these steps:
1. Click on Add Label to display the “Insert Label” dialog.
2. Type in the name of the new label and then click on OK.
3. The new label name will be included in those displayed in the drop-down list in the
Labels box.
To delete a label:
1. Select the label you wish to delete from the Label box.
2. Click on Delete Label.
3. In the “Delete Label” dialog you will be asked if you want to go ahead with the
deletion. Click on Yes to delete the label.
The Caption command also enables you to set up an Auto Caption (see Auto captions
on page 65).
Auto captions
The Caption command allows you to insert various types of caption one-by-one at will
(see Captions on page 64). In addition you can ensure that a caption is inserted
automatically whenever you insert a particular type of object - field, picture, or OLE
object. The Auto Caption will accompany the inserted object.
To set up an auto caption follow these steps:
1. Select Caption from the Insert menu.
2. Click on the Auto Caption button in the “Caption” dialog. The “Auto Caption” dialog
is opened.
3. In the Object box select the type of object that is to have an associated auto caption.
The types of object are Image, OLE and Field.
4. In the Label box you choose the type of label that is to be associated with the
inserted object. By default these are Image, Object and Field for object types
Image, OLE and Field respectively. You are free, though, to choose any of the
available options from the Label box (note that in the “Caption” dialog it is possible to
add your own label types).
5. In the Position box you choose the position of the label in relation to the inserted
object. The options are Left, Right, Top and Bottom. Left is the default position.
66 Write
6. In the Number Format box choose the style of numbering you want for the auto
caption. Succeeding auto captions of the same type will be numbered incrementally
in the chosen number style.
7. Check the Auto Caption box to activate the auto caption instructions, otherwise no
caption will be inserted. Check the Auto Generic box, along with the Auto Caption
box, if you just want a generic caption i.e. Caption, without numbering to be inserted.
(The usual situation is that you will have the Auto Caption box checked and the
Auto Generic box unchecked, which will lead to your chosen object type and chosen
associated caption type being implemented.)
8. Click on OK to save the auto caption details and go back to the “Caption” dialog.
9. In the “Caption” dialog make sure the Enable Auto Caption box is checked, before
clicking on OK to close the dialog.
Whenever you insert an object of the chosen type (for example, a field), a caption of the
chosen type (for example, Field) will be inserted too. The caption will have the relevant
position and incremental numbering style.
You can cancel the auto caption command by returning to the “Caption” dialog
(Insert/Caption) and clicking on Enable Auto Caption to uncheck it.
Using styles
A style is a collection of attributes, for example font, font size and paragraph settings, that
you can apply to your text. At any point, you can edit the attributes and so cause your
entire document to be updated to reflect the new style. This is a very efficient method of
managing the appearance of long documents. Typically you may want to set a paragraph
style for the paragraph as a whole and then apply a character style on top of this to
certain words or sentences. If you do it the other round, applying a character style first
and then a paragraph style, the character style will be obliterated.
A standard style (called simply a style) works at the paragraph level, that is, it affects
every word and line within the paragraph. A character style can also be set up. This
differs from a paragraph style in that formatting is applied to selected text within a
paragraph, rather than to the paragraph as a whole.
Style
Applies to whole paragraphs.
Consists of font, font size, font effects, indentation,
paragraph alignment, and line spacing.
Character Style
Applies to selected text within a paragraph.
Consists of font, font size, and font effects.
67 Write
Here is an example of how styles can be used:
The general idea is to implement different formats in your text. In line with the above
example, there will be many headings throughout the document. These can all be
formatted with a “Heading” style. The general text can be formatted as the “Normal” style.
To apply a style, select the text and then select
the style name from the style drop down list on
the toolbar. Alternatively, use the style shortcut
- for example, Alt-Ctrl-Shift-N will apply the
Normal style, unless you define it differently.
Modifying styles
When you first install Write, several styles are already defined, including "Normal" and
some "Headings", as you can see immediately if you click on the arrow in the Styles
drop-down box. You can modify these styles, as well as create your own (see Creating
new styles on page 68), to suit your own requirements.
To modify an existing style:
1. Select Styles from the Format menu. The "Styles" dialog is displayed.
2. Select the style you want to modify. Note that a description of the selected style,
which includes details of fonts and paragraph settings, appears at the bottom of the
dialog.
3. Click on the Modify button.
4. Choose the paragraph and font settings you want for the style (or, if it's a character
style, just the font settings). See Paragraph formatting using the menus on page 45
and Formatting text using the menus on page 41 for more details.
5. On returning to the Styles dialog, check the Character Style box if you want the
current style to be a character style.
6. Select a combination of Alt, Ctrl, Shift and Keyboard character as the style shortcut.
68 Write
Click on the Apply button to put the style into effect. If you don't want to apply the style
immediately, then close down the dialog and select the style from the Styles drop down
menu when you are ready to apply it.
Creating new styles
To create a new style, do the following:
1. Select Styles from the Format menu. The "Styles" dialog is displayed.
2. Click in the Style Name box
3. Type in the new name for the style.
4. Click on the New button.
The new style will be inserted into the styles’ list. Use the Modify button to define the font
and paragraph settings.
Renaming and deleting styles
To rename a style:
1. Select Styles from the Format menu.
2. Select the style you wish to rename in the "Styles" dialog.
3. Click on the Rename button.
4. Enter a new name for the style and click on OK.
To delete a style, first select the style and then click on the Delete button.
Bulleted and numbered paragraphs
You can create bulleted and numbered lists and paragraphs in your documents. A typical
bulleted list may look like this:
Numbered paragraphs may look like this:
69 Write
Creating bulleted paragraphs and lists
Bullets can be applied to single lines of text or one or more paragraphs of text.
1. Select the text that is to be bulleted.
2. Select the Bullet button
.
The selected text will be redrawn with bullets preceding the first line of each paragraph
(or the lines of a list). The position where the bullet appears along the left-hand page
margin, is called the first level.
Use the Increase Indent button
to increase the level so that the text moves to the
right (or use the Increase Indent command from the Format menu).
to decrease the level so that the text moves to the
Use the Decrease Indent button
left (or use the Decrease Indent command from the Format menu).
Modifying a bulleted paragraph
When you insert bullets into a document they are given a default font size, color,
alignment and "margins". However, all these can be changed.
Go into the "Bullets and Numbering" dialog by selecting the Bullets and Numbering
option from the Format menu.
If you want to use a bullet style that is different from those displayed in the Bullet Style
group box, click on the Change Symbol button. The "Character Map" dialog is displayed.
Click on the required symbol and then on Select. Note that you can choose a different
font style for the symbol in the Font box. Click on Close and the symbol will replace the
previously selected standard bullet (you can recover this later on by going through the
same process).
In the Bullet Color group box choose a color for the bullet.
In the Font Size box use the arrows to increase or decrease the font size for the bullets.
70 Write
Set the total gap between the margin and the text in the Distance from indent to text
box according to the following:
The bullet symbol itself can lie anywhere between the margin and a position that is an
offset from the text and governed by the Distance from bullet to text box. Within this
area, use the Alignment box to choose whether to have the bullet aligned to the left,
right or center.
Removing bullets
To remove bullets from your text, select the text and click on the bullets button
.
Alternatively, select the Bullets and Numbering command from the Format menu. In
the "Bullets" dialog, click on the None option in the Bullet Style group box and then click
on the OK button.
Creating a numbered list
Numbers can be applied to single lines of text, or one or more paragraphs of text.
1. Select the text that is to be numbered.
2. Select the Numbers button
The selected text will be redrawn with numbers, in sequence, preceding the first line of
each paragraph (or the lines of a list). The position where the number appears, along the
left-hand page margin, is called the first level.
Use the Increase Indent button
to increase the level so that the text moves to the
right (or select the Increase Indent command from the Format menu). The numbers are
re-sequenced so that the next level is shown with an extra digit. For example, two levels
will resemble this:
71 Write
A third level would show three digits and so on.
to decrease the level so that the text moves to the
Use the Decrease Indent button
left (or select the Decrease Indent command from the Format menu).
Modifying a numbered paragraph
Numbered paragraphs or lines can be modified in various ways, depending on the
numbering property you wish to change. The main properties of numbering are as
follows:
•
A series of numbered paragraphs or lines can be numbered incrementally in a variety
of number styles.
•
Numbered paragraphs or lines can be multi-level and defined separately for each
level.
•
Numbered paragraphs or lines can be defined with text before and text after the
number symbol.
To modify the numbering of paragraphs or lines, first select the relevant text. Select the
Bullets and Numbering command from the Format menu and then click on the
Numbers tab.
In the Numbering Style box you can choose a style for the numbers from Number,
Roman, CapLetter, NumShort, CapShort, Letter and Custom. Note that the default
style is Number. The Preview box shows the chosen style and the number of levels to
which it can be taken. For instance, for Number there are nine possible levels. If you use
Increase Indent to go beyond the ninth level in this case, then no extra numbers will be
added i.e. the numbering for the tenth and higher levels will stay the same as for the ninth
level.
You can alter the number style for a particular level by selecting the level in the Level box
and then selecting the appropriate style in the Numbering Style box.
In the Numbering group box you can set various options:
72 Write
•
The Number Format box displays the currently selected numbered paragraph: click
on the arrow to see the full range of available styles and click on the one you want to
make it the current style.
•
The Text Before and Text After boxes allow you to put text, punctuation and
brackets before and after numbers. Usually there is already a "." after any numbered
paragraph e.g. 2.1. - you might want to change this to (2.1).
•
In the Alignment box choose whether to align the numbers to the left, right, or center
of the space between the left page margin and the left paragraph margin.
•
In the Start box you decide what number you want the numbering to begin at. Set the
incremental step size for numbering in the Increment With box. The default is 1 for
both of these.
•
The Distance from number to text and the Distance from Indent to text boxes
measure the space between the number and the text (left hand page margin) and the
distance of the paragraph indent from the text (left hand paragraph margin)
respectively. Change these by using the attached arrows.
•
Click on the Append To Higher Level box to check it if you want to create multileveled lists where all the numbers show higher levels in the list (for example 1.1.4
rather than just 4. on its own). The box is checked by default.
Removing numbers
To convert a numbered list back into plain paragraphs, select the text and click on the
Numbering button
.
Alternatively, select the Bullets and Numbering command from the Format menu. On
the "Numbers" page, click on the Remove Numbering button and then click on OK.
Page set-up
Whenever you open a new file in Write, it is given a default page set-up covering such
information as paper size and page orientation. The defaults will depend on which
template your document was based on (see Using templates on page 83 for more
details).
To change the default settings for the current document, choose the Page Setup
command from the File menu. The “Page Setup” dialog is displayed.
•
In the Paper group box, click on the arrow to the right of the Size box to choose from
a list of standard paper sizes.
•
73 Write
In the Paper group box, click on the arrow to the right of the Source box to choose
from a list of paper sources, such as lower tray, upper tray and manual feed −
provided your printer supports these options.
•
In the Orientation group box, select either Portrait (vertical) or Landscape
(horizontal/sideways) orientation.
•
To set the margins for a document, go to the Margins group box. Enter the required
margins in the Left, Right, Top and Bottom boxes. These specify the distance from
the edges of the paper to the beginning of the work area in the document.
You can also choose which printer to use by clicking on the Printer button (see Print setup on page 77).
Headers and footers
You can add information, such as a chapter title and page number, that will appear at the
top and bottom of every page in a document. Text that appears at the top of every page
is called a header; text at the bottom is called a footer.
Headers and footers can be treated in the same way as you would treat normal text on
the page - you can style them, use borders and other paragraph formatting, and insert
objects. You can switch between editing the body text and editing a header or footer (see
Editing a header on page 73 or Editing a footer on page 75).
By default, Ability uses the same header and footer on every page. You can choose to
use a different header and footer for the first page and/or odd and even pages (see
Setting up headers and footers on page 75).
In a document with body text and a header and footer, Write uses a "faded" font to
distinguish the non-active area. For example, if you were editing the body text, the
header text would appear in a gray font.
Editing a header
To make the header active, do one of the following:
•
Double-click anywhere in the header area, that is the region on the page above the
first line of the document.
•
Select the Header command from the View menu.
As soon as a header is active, the vertical ruler is reset according to the depth of the
header. You can resize the header directly using this ruler in the same way you would
resize body text (see The vertical ruler on page 36).
74 Write
Also displayed is the Header and Footer toolbar (see Using the headers and footers
toolbar on page 74) to assist in inserting dates and times and switching between headers
and footers.
Type the text just as you would do on a standard page. You can create a single line
header or use several paragraphs; edit the header text to make it bold or italic; increase
the font size; and use a different font or fonts. You can also insert objects into headers,
such as graphic images, or make use of borders or columns.
Note: If you have chosen to use more than one set of headers and footers (e.g. a
different set for the first page, or different sets for odd and even pages), you will need to
set up a header or footer for each set. Move to a representative page from each set
before editing the header or footer text.
To return to the body of the document, double-click anywhere in the body text or select
Close Header and Footer from the displayed toolbar.
Using the headers and footers toolbar
The headers and footers toolbar is displayed automatically whenever a header or footer
is being edited. For example, whenever you double-click in the header (or footer) area or
select Header or Footer from the View menu. The toolbar itself contains several useful
buttons.
Use these buttons to insert page numbers, dates, times, and document titles:
Insert a page number field
Insert a date field
Insert a time field
Insert a document title field
Use these buttons to move between headers, footers and the body text, and to use the
header and footer set-up option:
Move to the header (when in a footer)
Move to the footer (when in a header)
Move to the body text
75 Write
Set up the header and footer
Note that you can change the arrangement of the buttons in the header and footer toolbar
by using your mouse to change the shape of the toolbar by dragging on its borders.
Editing a footer
To make the footer active, do one of the following:
•
Double-click anywhere in the footer area, that is the region on the page below the
last line of the document.
•
Select the Footer command from the View menu.
You can now edit the footer in exactly the same way as you would a header.
Setting up headers and footers
To change header and footer setup, do one of the following:
•
If the header and footer toolbar is currently displayed, click on the Header and
Footer Setup button
•
.
Select the Header and Footer Setup command from the View menu.
Usually, header and footers are simply repeated on each page. However, you can
choose to have different headers and footers on odd and even pages, or a different first
page header (the first page could have a blank header for example), or a combination of
the two. Use the Different first page and Different odd/even checkboxes to select
these options.
Note that if you select one of these options, you'll have to define a different header and
footer on pages 1 and 2 of your document. If you select both of these options you'll need
to define a different header and footer on pages 1, 2 and 3.
By default, the header sits within the top margin and directly over the body text. You can
choose to specify exactly where the header starts using the From edge boxes.
Decreasing the header setting will cause the header text to print nearer to the top of the
page and will move the main body of text upwards. If you set this to be less than 1cm, it
is likely that your text will be "clipped" by the printer, as most page printers cannot print at
the very edges of the paper. The same applies to the footer within the bottom margin and
below the body text.
76 Write
Deleting headers and footers
You can delete a header or footer simply by deleting all the text within it.
1. Make the header or footer active (see Editing a header on page 73 or Editing a footer
on page 75).
2. Select all the text and/or objects.
3. Press the Del key or right-click and select Cut.
Printing
You can print the whole of the document you are working on or a range of pages from
with the document. You can also print to a file rather than to paper (perhaps for taking a
postscript file to a professional print bureau) or convert a file into PDF format.
Before printing you can set up the document in print set-up and review it in print preview.
Print preview
Before starting to print, you might like to see how your document will look on paper.
on the toolbar (or select the Print Preview
To do this, click on the Preview button
command from the File menu). The display switches to print preview mode, in which the
document is shown at a reduced size to give you an overall view:
In print preview mode you can do any of the following:
•
Click on the Two Page button to view two pages of your document side-by-side.
•
Click on the One Page button to return to a single page view.
•
Click on the Next Page button – or press the pgdn key – to page forward through
your document.
•
Click on the Prev Page button – or press the pgup key – to page backwards through
your document.
•
Click on the Print button – or press P – to print the document directly from print
preview mode.
•
Click on the Close button to exit print preview and return to a normal view of the
document.
77 Write
•
Click on the Zoom In button to magnify the preview.
•
Click on the Zoom Out button to reduce the preview from a magnified state.
Print set-up
To choose which printer, paper size and orientation you want to use and the source from
which you want the paper to feed, select the Print Setup command from the File menu.
The “Print Setup” dialog is displayed.
•
In the Printer group box, you can choose to use the default printer or another printer
accessible from your machine – click on the arrow to the right of the Name box to see
a list of available printers.
Note: Only installed printers are listed. To install another printer, you need to use the
Windows Control Panel; see your Windows documentation for instructions.
•
In the Orientation group box, you can specify the orientation of the printed
document: Portrait is upright; Landscape is sideways.
•
In the Paper group box, you can choose the size and source of your paper. Click on
the arrows to see the available options.
If you want to modify printer settings, select the Properties button. The different options
displayed in subsequent dialogs will depend on the current printer. See your printer
documentation, or Windows help, for more details.
Printing the document
To print the document, select the Print command from the File menu (or click on the
Print button
on the toolbar). The “Print” dialog is displayed.
The active printer and connection are displayed at the top of the dialog. You can choose
to use another printer by selecting it in the Name box (see Print set-up on page 77).
In the Print range group box, you can specify how much of the document you want to
print:
•
All pages – prints the entire document.
•
Current page – prints the page you are currently working on.
•
Pages – prints a range of pages which you specify in the attached box. For example,
1,3,7-12 will print pages 1, 2 and all pages from 7 to 12. Remember to put commas
after each sub-range and to use hyphens to specify a continuous range between two
numbers.
78 Write
In the Copies group box, you can specify the number of copies you would like and how
the printed pages are to be ordered:
•
Scroll through the Number of copies box to select how many copies of the
document, page or range you want printing.
•
If you want more than one copy of a document, you can choose the order for the
pages when they are printed. The default setting will make the first page print till the
correct number of copies is printed, followed by the second page, and so on. If you
click on the Collate check box, the document will print as a whole consecutively,
followed by a second copy of the document, and so on.
The Print box allows you to choose to print only odd or even, or both odd and even,
pages from the print range selected in the Print range box.
Click on the Print to file check box if you want to send the document to a new file on a
disk, instead of to the printer. You will be prompted to give the file a name.
If you want to modify printer settings, select the Properties button. The different options
displayed in subsequent dialogs will depend on the current printer. (See your printer
documentation, or Windows help, for more details.)
When all is set, click on the OK button and the printing process will commence. There will
be a pause while the information is sent to the printer, and then the physical printing will
begin.
Printing to a PDF file
You can convert an Ability file to PDF format by selecting Print to PDF in the File menu.
A file browse box will be opened with the PDF file format set in the Save as type line.
Give your file a name (or retain the current name) and then use the Save in box at the
top to locate the folder in which you would like to store the PDF file. Click on Save to
save the file in PDF format.
Including fields in a document
You can insert fields into a document in order to perform calculations or to act as links to
spreadsheet cells, fields in a database or other Write documents.
The following sections show you how to insert various types of field, including database,
formula, page number, date and time fields.
Inserting a field
To insert a field into a document, follow these steps:
79 Write
1. Position the cursor where you would like the field to go.
2. Select the Field command from the Insert menu. The “Insert Field Wizard” is
displayed.
3. In the Field Name box, type a name for the field (or use the default name supplied by
Ability).
4. In the Field Type group box choose whether to insert a Formula field (see Inserting
a formula field on page 81) or a Database field (see Inserting a database field on
page 81) field. A formula field can be used to perform calculations - utilizing the full
range of Ability functions - or to link to other fields, whether in the same document or
other Write, Spreadsheet or Database documents. A database field is used to link to
a field in an existing database, hence making all the records that come under the
database field accessible in the current document.
5. On the next page you can set a Control Type for the field (see Control types on
page 416).
Inserting page numbers
1. To insert page numbers into a header or footer first go into the header or footer and
then click on the Page Number button in the Header and Footer toolbox (or select
the Page Number command from the Insert menu). The "Insert Page Number"
dialog is displayed.
2. In this dialog, you can choose the format for the page numbers. Click on the format
you require in the Page Number Formats box.
3. In the Start Number box, you can set the number at which you would like page
numbering to begin. This is useful, for instance, if you have selected a different
header or footer for the first page, which does not have a page number, and want
page numbering on the second page to begin at ‘2’.
4. Click on the OK button and the current page number will be inserted into the header
or footer. Write will alter the page numbers as the document changes, so you do not
need to update them yourself.
See Setting up headers and footers on page 75 for information on inserting page
numbers into every other page.
Inserting the date
1. To insert the date into a header or footer, put the cursor into the header or footer at
the position where you want the date to appear. Next, select the Insert Date button
from the Header and Footer toolbox (or select the Date and Time command from
the Insert menu). The “Date” dialog appears.
80 Write
2. In this dialog, you can choose the format for the date and set some other options.
3. Select the format you wish to use for the date in the Date Formats box.
4. Click on the Include Day of Week check box to include the day of the week in long
form (e.g. Tuesday); click again to include the day of the week in short form (e.g.
Tue). Clicking again will clear the check box and the day of the week won't then be
included.
5. Click on the Update Automatically check box to remove the check if you want the
current date to be printed, rather than the date at time of printing (this will be checked
already by default). With the box left checked, an automatically updateable field is
inserted.
Note: If you want to backdate or postdate a document, you should insert the current
date in the format you want, with the Update Automatically box left unchecked. You
can then edit the date as required. Alternatively, just type in the date as normal text.
Updating takes place in the background and the field is refreshed on the screen only
when it is redrawn. The field will be updated when you print the document.
6. Once you have chosen the date format and other options, click on OK to insert the
date.
Inserting the time
1. To insert the time into a header or footer, put the cursor into the header or footer at
the position where you want the time of printing to appear. Next, select the Time
button from the Header and Footer toolbox (or select the Date and Time command
from the Insert menu). The “Time” dialog appears.
2. In this dialog, you can choose the format for the time and choose whether to have the
time updated automatically.
3. Select the format you wish to use for the time in the Time Formats box.
4. Click on the Update Automatically check box to remove the check if you want the
current time to be printed, rather than the time at time of printing (this box will be
checked already by default). With the box left checked, an automatically updateable
field is inserted.
Note: If you want to insert a time of your own choosing, you should insert the current
time in the format you want, with the Update Automatically box left unchecked. You
can then edit the time as required. Alternatively, just type in the time as normal text.
Updating takes place in the background and the field is refreshed on the screen only
when it is redrawn. The field will be updated when you print the document.
81 Write
5. Once you have chosen a format for the time, click on OK to insert the time.
Inserting the title
To insert the title of the document:
1. Position the cursor where you want the title to appear in the header or footer
2. Click on the Insert Title button in the Header and Footer toolbox.
The title will be inserted at the chosen point. If you change the name of the document, the
title inserted into the header or footer will change too.
Inserting a formula field
You can insert a formula field into a document (see Inserting a field on page 78).
1. Once you have selected Formula, click on Next to go to the next page.
2. Click on the Functions button to the right of the Formula box to access all the Ability
functions (see Using built-in functions on page 480). Alternatively type in a formula
directly. You can also type in link expressions for one-way or two-way links. Leaving
the Formula box blank will still create a field in your document, although it will be
empty. You will still be able to enter text, formulas, etc. directly from the document.
3. Click on the Show Formula check box if you want the formula, rather than its result,
to be displayed in the field.
4. On the next page you can set a Control Type for the formula field (see Control types
on page 416).
Inserting a database field
You can insert a database field into a document (see Inserting a field on page 78).
1. Once you have selected Database, click on Next to go to the next page.
2. In the Database Name box, type in the database name and its directory (along with
the full path if it comes under a different directory from your current document).
Alternatively click on the button to the right of the Database Name box to display the
"Open" dialog. Here you can search for and select the required database.
3. Click on Open in the "Open" dialog to insert the database name and path into the
Database Name box.
4. In the Data Source box, click on the arrow to the right of the box to display the tables
contained in the database. Select one of these.
82 Write
5. In the Data Field box, click on the arrow at the right to display the fields in the
selected database table. Select the field whose contents you want to see in your
document.
6. The Enable Browsing box is checked by default, thereby enabling you to browse
through all the records from the field that has been inserted into your document. If
you don't want to browse through all the records and just want the first record to be
displayed, click on it to remove the check.
7. On the next page you can set a Control Type for the database field (see Control
types on page 416).
Example
To create a database field in a Write or Spreadsheet document, using the surname field
from an Employees table in a database called Company.adb, do the following:
1. Select the Field command from the Insert menu
2. Type "Surname" in the Field Name box
3. Click on Database in the Field Type box
4. Click on Next and then click on the button to the right of the Database Name box.
The "Open" dialog is displayed. Find and select Company.adb. Click on Open. The
database name and path is inserted into the Database Name box.
5. Click on the arrow in the Data Source box and select Employee.
6. Click on the arrow in the Data Field box and select Lastname.
7. Leave the Enable Browsing box checked.
8. At this point click on Finish (ignore for now the remaining pages of the "Insert Field"
Wizard).
9. The field will appear in your Write or Spreadsheet document, displaying the first
record under the Lastname field from the table. Use the arrows at the bottom left of
the window to scroll through all the records.
Editing a field
To edit a field you should first select it by double-clicking in the field. The Field menu
option is displayed along the top of the window. Clicking on any of the options in the
Field menu brings up the "Field Attributes" dialog. In here you can change or add to
attributes already set. The following options are available:
•
83 Write
General contains details of the field type - either formula or database - and field
name. You can change these here.
•
Color allows you to select a color for the field.
•
Font enables you to choose a font and special effects for text within the field.
•
Border contains various border types for the field.
•
There are also options for Alignment, Style, Control, Attributes, and Format.
Using templates
If you create similar documents time after time, you can save a lot of work by defining a
template. A template can be used as the basic design or prototype for any new
documents you open. Typically a template can include settings for margins, font styles,
pieces of text, and most other document features. The template can then act as a new
default design for the documents you wish to base on it. The Normal template is the
standard default template.
The following sections show you how to create, edit and manage templates.
Creating a template based on an existing document
You may have designed a document that you would like to use as the basis for other
documents. For example, you may have created a Fax sheet in Write and wish to use it
again. Follow these steps:
1. Select the Open command from the File menu and use the “Open” dialog to find and
open your existing Fax sheet.
2. Select the Save As command from the File menu. The “Save As” dialog is opened.
3. Click on the arrow to the right of the Save as type box and select Ability Write
Template (*.awp).
4. In the File name box, enter a name for the template.
5. Select the Template folder. This can be found in the folder into which Ability was
installed. By default, this is: C:\Program Files\Ability Office\Template.
Click Save to have the Fax sheet saved as a template. This will now appear in the
template list when you open a new document and can be used as the basic design for
that document.
84 Write
Creating a template based on an existing template
As an alternative to basing a template on an existing document (see Creating a template
based on an existing document on page 84), you can design a new template by using the
Normal template (or any other template) as a basis. To do this follow these steps:
1. Select the New command from the File menu. The "New" dialog is displayed.
2. In the Templates box select the template you want to base the new template on.
3. In the New box on the right select the Template radio button to indicate that you are
designing a new template.
4. Click on OK to close the dialog and open up the template.
5. Design your template by adding text, adjusting margins, setting font styles, and so
on, till you are satisfied.
6. When you have finished, select the Save button
. The “Save As” dialog will be
opened. Give the template a name in the File Name box and then click on Save.
The new template will appear in the template list that is displayed when you select New
from the File menu. It can now be used as a template for new documents.
Note: You can also create a new Normal template, based on the original one, by
following the above steps. You must remember though to name the new template
“Normal” in Step 6. The new “Normal” will replace the old one as the default template.
Creating a document based on a template
To base a new document on an existing template:
1. Select the New command from the File menu (don't use the New button on the
toolbar as this will automatically base the document on the Normal template – see
Normal template on page 85).
2. Click on the required template name, make sure Document is switched on (it should
be by default anyway), and click on the OK button.
A new document based on this template is opened.
A template can store the same information and formats as a standard document: text,
graphics, headers and footers, page set-up information and style lists. You can create a
variety of templates to cover every type of document your organization may use. By
having everyone make use of templates, you can ensure a consistency of style for
documents even when they are created by different people.
85 Write
Editing templates
You can edit a template in a similar way to editing a normal document:
1. Click the Open button
menu).
on the toolbar (or select the Open command from the File
2. Click on the arrow to the right of the Files of Type box and select Ability Write
Template (*.awp), so that it looks like this:
3. A list of templates is displayed. Click on the template you wish to edit and click on
Open. You can edit the template as you would any other Write document.
4. Once you have made the required changes click on the Save button to save the
edited template and then select Close from the File menu. The edited template is
now ready for you to use.
The normal template
Whenever you create a new document using the New button
, the document is
automatically based on the built-in Normal template. The built-in template has the
following properties:
•
Paper size as defined in the default printer settings under Windows
•
One inch left, right, top and bottom margins
•
A set of built-in styles – a normal style, some heading styles, and some indented text
styles
•
No text or graphics are included, though the document is formatted to take a
particular font style and size when you do begin to enter text
•
No other page or paragraph formatting
Although this is nearly always sufficient, you can override it by creating your own Normal
template - follow the steps in Creating a template based on an existing template on page
84, making sure you use the name “Normal” for the new template.
Since the Normal template is used by default whenever create a new document by
clicking on the New button on the toolbar, the new Normal template will be used instead.
86 Write
To return to the original Normal template all you have to do is delete Normal from the
Template folder. To do this select Open from the File menu, locate the template folder
i.e. Program Files\Ability Office\Template, and then delete Normal by right-clicking and
selecting Delete (make sure that Files of Type is set to Ability Template, otherwise the
templates won’t be displayed in the “Open” Dialog).
Once you have deleted the Normal template, Ability will automatically generate a new
default Normal template as before. Normal is always listed as a template when selecting
New from the File menu, whether or not you've created a Normal template yourself.
How Ability manages the template list
Templates are very similar to normal Ability documents, except that:
•
They are located in a special folder – by default this is called Templates and is placed
in the folder into which Ability was installed.
•
They have a different document extension (awp) to standard documents (aww).
When basing a document on a template by selecting New from the File menu, Ability lists
all the templates in the default template folder. Should you need to, you can change the
folder location (see General options on page 89).
The Normal template is a special case and may not exist as a real template in the
template folder.
Mail merge
You can send a standard letter to a number of different people whose names and
addresses are stored in a mailing list in a database. The process of combining
information from a database with a standard letter is often called mail merge.
Before you can mail merge your data, you need to have already created a database
containing the relevant information. The database that is to be used in the mail merge
may have been created in Ability or in any other database that is compatible with
Microsoft Access.
Creating a mail merge letter
You can turn a document into a mail merge letter simply by adding the appropriate fields.
Typically these are address and name fields from a database table. The process is the
same whether the document is new or the text has already been entered.
The first field you insert establishes a connection with a table within a database, as
follows:
87 Write
1. Position the cursor where you want the field to appear - for example, at the top of the
document if you're starting the address block.
2. Select the Mail Merge Field command from the Insert menu.
3. In the File Name box, enter the name of the database - or use the browse button
to find and enter it.
4. Select the table you want from the Data Source drop-down list.
5. Select the field you want to insert from the Data Item drop-down list.
6.
Click on the OK button.
The mail merge field will be inserted into your document and a series of toolbars will be
turned on. These allow you to browse, edit, filter and sort your data. See Controlling mail
merge on page 87 for more details.
Now insert an additional field for each of the other address lines and for the salutation
and name, as follows:
7. Position the cursor where you want the next field to go.
8. Select the field you want in the field list from the query toolbar (see Controlling mail
merge on page 87).
9. Click the Insert Field button
.
10. Repeat steps 6 through 8 for the rest of the fields.
As an alternative to steps 7 and 8, you can use the Mail Merge Field from the Insert
menu.
Note that you are free to include a field more than once. For example, the first line of an
address block may contain fields for title, first name and surname and you may want to
start your letter with "Dear Mr Jones". Just insert the title and surname fields a second
time.
Controlling mail merge
Use the Field List drop-
Use the Sort drop-down
list to select a named
Use the Filter dropdown list to select a
88 Write
down to select a field.
sort order for the table.
Use the Insert Field
button to insert the
current field into the
document.
Use the Sort button to
choose a sort order onthe-fly.
named filter for the
table.
Use the Filter button
to create a filter onthe-fly.
For more details on how to sort and filter database information, see Filtering a table on
page 217 and Sorting a table on page 215.
Browsing through the merge data
When you insert a mail merge field, a browse toolbar appears - you can use this to
browse through the records from the database.
- Display the first matching record from your table
- Display the previous record
- Display next record
- Display last matching record
The record number is displayed between the Previous and Next buttons. You can find
out how many merge letters will print by clicking the Last button and checking the record
number displayed.
Viewing and printing merge letters
When you first insert a mail merge field, "mail merge mode" is turned on. This has the
following effects:
•
You can browse through the data using the browse buttons - see Browsing through
the merge data on page 88.
•
Print (and print preview) will generate a new page for every record in the database.
Otherwise, the print process will be as normal - see Printing on page 76 for more
details.
to tun mail merge mode off (and on again). Alternatively,
Use the Mail Merge button
use the Mail Merge command from the Tools menu. This will freeze the document at the
current record - printing at this point will only print the current record.
89 Write
As an alternative to printing the document, a new document can be created, where a new
page is started for every record. Use the Mail Merge to New Document command from
the Tools menu to do this.
Changing Write options
There are various choices you can make about the way Write works for you. The
available options can be accessed through the Options command in the Tools menu.
The following sections show you how to set options for spelling, colors, zoom, and
others.
General options
Various general options are set on the General page of the “Options” dialog, reachable
through the Options command from the Tools menu.
•
Units
Select the units you would like to use for the rulers and measurements in dialog
boxes by choosing from Inches, Centimeters, Millimeters and Points (a point is a
typographical unit approximately equal to 1/72nd of an inch).
•
Assurance
If you want a backup copy to be made of every document you create, click on the
checkbox next to Create Backup. Every time a document is changed, the previous
version is stored as a backup with an (abk) document extension.
, set the Files of Type to Ability
To open a backup, select the Open button
Write Backup and then make your selection from the displayed list of backup
documents.
•
Editing
Whenever you do something in Write, you can usually undo it by clicking the Undo
button (or selecting the Undo command from the Edit menu). In the Undo Steps
box, type the number of actions you would like the program to remember.
Select the Smart Cut and Paste option if you'd like Ability to “intelligently” insert and
delete spaces when cutting and pasting words in paragraphs.
•
Mail merge
90 Write
Check the Close Blank Lines box (the default setting) if you'd like Ability to
automatically close blank lines in address blocks when mail merging. Note that blank
lines are not closed in the document itself – only in Print Preview or while printing.
•
Template
Choose the default location for the template folder. For more details, see How Ability
manages the template list on page 86.
Spell checker and thesaurus options
Change spell checker and thesaurus options on the Spelling page of the “Options”
dialog, reachable through the Options command from the Tools menu.
In the Spell Checker and Thesaurus group box, you can specify which dictionary and
thesaurus you wish the program to use.
Click on the arrow to the right of the Language box to choose a dictionary. The
languages shown here depend on the country from which Ability was purchased.
Click on the checkbox next to Always Suggest to ensure that the spell checker always
suggests alternative spellings for words it does not recognize.
Click on the checkbox next to User Dictionary to tell the program to add new words to
the specified user dictionary. Click on the arrow to the right of the box to choose the user
dictionary you wish to use.
Setting colors
Set color options on the Colors page of the “Options” dialog, reachable through the
Options command from the Tools menu.
You can select the colors that are to be used for the page, the fields, the workspace and
the guidelines.
Here’s what each of the buttons does:
Page
Change the color of the page under your text.
Workspace
Change the color of the area surrounding the
page.
Column
Change the color of guidelines showing column
boundaries.
Page Numbers
Change the color of all “Page Number” fields.
91 Write
Date and Time
Change the color of all “Date” and "Time" fields.
Bullets and Number
Change the color of all “Bullet and Number”
fields.
Formula
Change the color of all “Formula” fields.
Mail Merge
Change the color of all “Mail Merge” fields.
Print fields using on
screen color
Check this box to print "Mail Merge" fields in the
same color as they appear on screen.
Ability Defaults
Revert the entire color scheme back to that just
after installation.
Windows Defaults
Use Windows default color settings. These are
set in the Control Panel under the Windows
Program Manager.
Click on the button of the feature whose color you wish to change. The “Color” box is
displayed. You can select one of the standard colors by clicking on it, or you can define
your own custom color (the color mixing process is explained in your Windows
documentation). Click on the OK button to save any changes.
Setting the default Zoom
Change the default zoom for all new documents (the current window won’t be affected)
on the Zoom page of the “Options” dialog, reachable through the Options command
from the Tools menu.
Choose a default zoom from those listed.
92 Spreadsheet
Spreadsheet
A spreadsheet is a tool that is used to organize, track and calculate financial and
numerical information. You can use a spreadsheet to analyze figures, calculate totals or
averages, or project business trends. In addition, you can use spreadsheets to
experiment in “what if” scenarios, seeing what happens when you change the numbers.
You can use spreadsheets to solve complex problems (like calculating mortgage
repayments), as well as simpler problems (like calculating miles to the gallon). Here are
some more examples of how you can use a spreadsheet:
•
Create a yearly budget
•
Analyze quarterly sales figures
•
Set sales quotas
•
Analyze stock investments
•
Project loan repayment amounts
•
Compute interest payments at variable rates
•
Project income and profit figures
Starting Spreadsheet
To start Spreadsheet, follow these steps:
1. Click the Start button on the Windows Taskbar
2. Select Programs
3. Select Ability Office
4. Select Ability Spreadsheet
Spreadsheet will open with a new spreadsheet displayed, ready for entering data.
The spreadsheet window
The area in which you work on a spreadsheet is called the spreadsheet window. The
different areas of the spreadsheet window are shown on this diagram:
93 Spreadsheet
Clicking on a column letter on the column bar selects that column, while clicking on a row
number on the row bar selects that row. You can select multiple rows or columns by
dragging the cursor across several row or column bars, or you can select the entire sheet
by clicking the button at the intersection of the row and column bars.
A spreadsheet is organized into rows and columns, like a table. The rows are numbered
sequentially down the left edge of the spreadsheet window. The columns are labeled with
letters across the top of the spreadsheet window. (The column letters run sequentially
from A to Z, then from AA to AZ, then from BA to BZ, and so on, finally ending with IA to
IV).
The maximum size for a spreadsheet is 65,536 rows and 256 columns.
Each Ability spreadsheet has 15 associated worksheets. These allow you to work with
related information from different worksheets, which are then stored in the one
spreadsheet file.
The toolbars and formatting bar
Across the top of the window are the various toolbars for spreadsheet. These contain the
buttons and drop-down lists that enable you to format and manipulate the cells and
figures quickly and easily, without needing to open the menus.
Note: You can choose not to display the toolbar and/or the formatting bar. To do this,
click on the Toolbars option from the View menu. Click on the Standard checkbox to
turn the toolbar on or off, and on the Format checkbox to turn the formatting bar on or off.
When the feature is shown, a check is put next to it; when it is not shown, the check is
removed.
94 Spreadsheet
The formula bar
The formula bar is where you enter text, numbers and formulas into cells and fields.
The formula bar shows the name of the current cell and what type of information it
contains. You can click anywhere within the contents of the formula bar to edit the
spreadsheet cell.
There are three buttons to assist in editing the cell contents:
•
Confirm button
spreadsheet.
•
Cancel button
previous state.
•
. Calls on a list of over 200 built-in functions. For more
Functions button
information, see Function reference on page 480.
or Enter key. Saves the contents of the formula bar into the
or Esc key. Aborts the current edit and returns the cell to its
Coolbars mode and large buttons
You can choose how the toolbars will be displayed. Coolbars are normal toolbars but
with the borders around the buttons removed.
Large Buttons are merely larger versions of normal toolbar buttons and with descriptive
text added.
To switch to coolbars mode and/or large buttons, select Toolbars from the View menu.
Click on the Coolbars Mode and/or Large Buttons checkbox to turn these on or off.
Moving around a spreadsheet
To move around a spreadsheet, you would usually use the mouse and then click to put
the cursor where you want it. You can also use the scroll bars at the right and bottom of
the screen to move either vertically or horizontally through the spreadsheet.
However, you can also move the cursor with the cursor movement keys, and there are
times when this can be quicker. The following table shows all the ways you can move the
cursor.
Key
Description
95 Spreadsheet
Arrow keys
The arrow keys move the cursor one cell at a time in the
direction of the arrow (up, down, left, or right).
page up
Moves up one screen at a time.
page down
Moves down one screen at a time.
home
Moves to column A in the current row.
end
Moves to the last column that contains information in the
current row, or to the last column of the whole spreadsheet if
the current row contains no information.
tab
Moves one cell to the right.
shift + tab
Moves one cell to the left.
ctrl + home
Moves to the first cell (A1) in the spreadsheet.
ctrl + end
Moves to the intersection of the last column and the last row
that contains information.
ctrl + page up
Moves one screen to the left.
ctrl + page down
Moves one screen to the right.
ctrl + Î
Moves to the next cell on the right that contains information.
ctrl + Í
Moves to the next cell on the left that contains information.
ctrl + Ï
Moves to the next cell upwards that contains information.
ctrl + Ð
Moves to the next cell downwards that contains information.
Going to a particular cell
If you are working on a small spreadsheet, it is easy to find the cell you require (for
formatting, deleting, hiding, or whatever). However, if you have a very large spreadsheet,
it can be quicker to ask Spreadsheet to find the cell (or range of cells) you want.
Select the Go To command from the Edit menu. The “Go To” dialog is displayed.
In the Category box, click on the location type. The categories include typical
spreadsheet locations such as cells, named ranges, columns and rows. Next, enter the
location you wish to go to (you can choose most of these from the drop-down box). Then
click on the OK button and the spreadsheet will be redrawn, with the location you asked
for selected and active.
96 Spreadsheet
Spreadsheet definitions
There are certain terms that are used in virtually all spreadsheet programs. It is worth
becoming familiar with them, as it will make your spreadsheet work much simpler.
You can read about cells, cell addresses and cell ranges in the following sections.
Cells
The spot where a row and column intersect is called a cell. A cell is the place in a
spreadsheet where you enter text, numbers, or formulas. For example, in the following
illustration, January appears in the cell C4, where column C and row 4 intersect:
The active cell is shown by a heavy cell outline - in this example, B2.
Cells can also be called fields (the word cell is part of the special spreadsheet
vocabulary). You use fields throughout Ability – in Write, and Database – and they always
work in similar ways and can call on the same function list. You can apply what you learn
about fields (known here as cells) in Spreadsheet to the fields you work with in other
applications.
Cell addresses
Each cell in a spreadsheet has a unique identifier, called a cell address. The cell address
tells you the exact location of a piece of information, just as a home address such as 12
Maple Avenue pinpoints a specific house.
A cell address consists of a column letter and a row number. For example, the cell
located where column C and row 2 intersect has the cell address C2.
Cell ranges
A range is simply a group of cells. For example, the cells A1, A2, A3, A4, A5 can be
referred to individually when using them in a formula but it is quicker to use a range. The
following formulas, which give the same result, demonstrate this:
=SUM(A1, A2, A3, A4, A5)
97 Spreadsheet
=SUM(A1..A5)
You can give a cell range a unique name and refer to it in formulas using the name,
rather than specifying the first and last cells in the range. You can also treat fields in a
database table as ranges so that, for example, you can sum all the records in an invoice
database.
Creating a spreadsheet
To create a new spreadsheet, click on the New
button on the toolbar or select the
New command from the File menu. A new blank spreadsheet will be opened in the
Spreadsheet window.
When you first open a spreadsheet, it is given a default page set-up. This means that the
paper size and margins are already set for you. For the majority of spreadsheets, these
settings will probably be what you want, but you might want to change them, for instance
to give a large left margin on a document that is going to be bound (see Page set-up).
Opening an existing spreadsheet
To open an existing spreadsheet, first start Spreadsheet - see Starting Spreadsheet on
page 92.
Next click on the Open button
on the toolbar or select Open from the File menu.
The "Open" dialog is displayed. When you have located the required spreadsheet
document (you need to locate the appropriate folder in the Look In box and set the Files
of Type to Ability Spreadsheet, if it is not so set already), click on the Open button to
open it.
Worksheets
Worksheets are the pages, so to speak, of a particular spreadsheet and are where you
enter data and perform calculations. There can be up to 255 worksheets associated with
each spreadsheet. Whenever you create or open a spreadsheet you are immediately
taken to the first worksheet in that spreadsheet − called Sheet1 by default, though you
can rename the sheet if you like.
The worksheets are listed along the bottom of the spreadsheet window, with the current
sheet selected.
98 Spreadsheet
If not all of the sheet names are visible, move the mouse pointer over the left edge of the
bottom scroll bar (just to the right of the last visible sheet title). When the pointer turns to
a cross, drag the scroll arrow till the required number of sheet names are visible. To
select another sheet, just click on its name.
You can rename, delete, insert, copy and move worksheets, and also create links
between sheets in the same spreadsheet or sheets in different spreadsheets.
Note: The terms worksheet and sheet are used interchangeably in these help notes and
have the same meaning. Sometimes the term workbook is used for a spreadsheet file
and its associated worksheets, with Spreadsheet being reserved for the program (or
application) itself.
Renaming a worksheet
Rename a worksheet by right-clicking on the sheet name and selecting Rename from the
drop-down list. In the “Rename worksheet” dialog type the new name and then click on
OK.
The new sheet name immediately replaces the old one along the bottom of the
spreadsheet window.
Deleting a worksheet
Delete a worksheet by right-clicking on the sheet name and selecting Delete from the
drop-down list. You will be asked if you want to continue with the deletion − click on Yes.
The deleted sheet name immediately disappears from along the bottom of the
spreadsheet window.
Inserting a worksheet
Insert a new worksheet directly to the left of an existing sheet name by right-clicking on
the sheet name and selecting Insert from the drop-down list. In the “Insert worksheet”
dialog you should enter the name of the new worksheet and then click on OK.
99 Spreadsheet
The new sheet name is immediately inserted at the right place along the bottom of the
spreadsheet window.
Copying and moving worksheets
Copy or move a worksheet by right-clicking over the appropriate sheet name and
selecting Copy/Move from the drop-down list. In the “Copy or Move Worksheets” dialog
follow these steps:
1. Select the sheet to be copied or moved in the Copy/Move selected sheets box
(note that all the sheets are listed in order).
2. In the To workbook box the current spreadsheet is displayed. (If you would like to
copy or move a sheet to a different spreadsheet, make sure the spreadsheet is
already open and then select it in the To workbook box.)
3. All the sheets in the selected spreadsheet are listed in the Before sheet box. Select
the sheet before which you want to copy or move the sheet selected in Step 1.
4. Choose whether to copy (duplicate without deleting the original) or move (duplicate
and delete the original) by selecting either the Copy or the Move button. Copy or
move as many sheets as you want while you are in the dialog.
5. Click on OK to close the dialog.
Calculating across worksheets
The basic syntax for a formula that will work across worksheets is:
=sheetname!cell
For example,
=Sheet1!A1
entered in any cell in any sheet in the spreadsheet will access the data in cell A1 of
Sheet1.
The result can be mixed into a formula any way you like. For example, to take the
contents of cell D4 from a sheet called Sheet5 and multiply it by 2, use the following
formula:
=Sheet5!D4 * 2
To refer to a range from another sheet, just prefix the first part of the range with the sheet
name:
100 Spreadsheet
=SUM(Sheet1!A1..A10)
will add up the contents of cell A1 through to A10 in Sheet1.
Entering information
You can put two main types of information into a spreadsheet: text and numbers. Ability
will automatically sense which type of information you are entering and give it a default
justification within the cell. When you enter text, Ability will left justify your entry; when
you enter numbers, Ability will right justify them.
Here are some examples of the type of information you can enter and the way Ability
deals with them.
Enter this text
Spreadsheet displays
Type of information
Hello world!
Text
123
Number
$123,000.00
Currency
12/12/98
Date
In this example, Currency and Date are actually numbers with a format applied. There
are other types of number formats and you can change the way Ability displays the result.
See Formatting numbers using the toolbar on page 106.
Any information you type will be put into the cell that has the dark border around it. This is
the active cell. To activate a cell, click on it, or move the dark border to it by using the
arrow keys.
Entering text
When you start typing text, you will notice that it does not immediately appear in the
active cell. Instead, it is shown in the formula bar. This means that you can make
changes to it more easily, as it is slightly larger and easier to see.
When you have finished typing the text, do one of the following:
•
Click on the Confirm button
active cell.
•
Press one of the arrow keys. Your text will be entered and the active cell will move
according to which arrow key you pressed. This saves having to use a keystroke if
you’re entering a long column or row of information.
on the formula bar. The text will be inserted into the
•
101 Spreadsheet
Press the Enter key - the text will be entered and the active cell will move down one
row.
•
Click the Cancel button
on the formula bar to abandon the text entry.
Ability will display the word “Text” in the Cell Type box on the formula bar.
The following section shows you how to enter text that is wider than the cell.
Entering a long text item
When you create a new spreadsheet, each column is 80 points wide by default.
A point in this case is 1/96 of an inch or 0.026cm and is not the same as the
typographical measure (where a point is 1/72 of an inch and used to measure font size).
If the text you want in the cell is longer than the default width, you can enter the text and
let it overflow into the next cell. If there is no information in the cell to the right, the whole
text is displayed, otherwise Ability ‘clips’ the text at the cell boundary.
An alternative is to allow the text to be wrapped within the cell (see Cell alignment on
page 105).
Entering values
You enter values in the same way as you enter text: point to the cell where you want the
value to appear, then type it in. Finish the entry in the same way as you would finish a
text item (see Entering text on page 100).
Ability will display the word “Number” in the Cell Type box on the formula bar.
Note: Values are automatically put to the right of cells – this is to make sure that columns
of figures line up neatly. You can change this alignment if you prefer (see Cell alignment
on page 105).
Entering currency values
You can include a currency symbol when entering numbers. Ability will understand that
you want a currency format. All these are valid currency entries:
$12
$123,456
$123,456.00
Note: The currency symbol you use must match the setting in the Windows Control
Panel. For example, this will be the dollar symbol ($) if you are in the US and the pound
102 Spreadsheet
symbol (£) in the UK. If not, Ability will treat the cell content as text and you won’t be able
to perform arithmetical calculations on it.
Entering a time
Use a colon to separate hours from minutes. Here are some examples of entries that
Ability will recognize as time values:
23:45
11:45 AM
11:45 PM
For a description of how Ability deals with dates and time, see Date and time functions on
page 486.
Entering dates
You should use the shorthand method to enter dates (if you prefer the long display for
dates, change the format – see Formatting a date on page 108).
These are all OK to enter:
3-6-64
12/2/1995
01.01.95
September 12, 1995
But these will be treated as text only:
3rd June 1964
September 12th, 1995
If you don’t use the shorthand method, Ability could treat your entry as text and you won’t
be able to change the format or perform date arithmetic.
You can enter the year as two or four digits. Two digit years below 30 will default to the
21st century (see Year 2000 on page 487). For example:
Enter
1/1/20
1/1/29
1/1/30
Date stored as
1/1/2020
1/1/2029
1/1/1930
For a description of how Ability deals with dates and time, see Date and time functions on
page 486.
103 Spreadsheet
Entering numbers you don't want to calculate
Whenever you enter a number, Spreadsheet assumes that it is a value and that you
might want to use it in a calculation.
If you enter a number that is obviously not meant to be used in calculations, such as a
phone number like 6684123, Spreadsheet can't automatically tell that it is supposed to be
text. So, to enter numbers like phone or invoice numbers, you need to tell Spreadsheet
not to calculate them.
To do this, type a single quote (‘) before you enter the actual number. This is necessary if
you want a formula expression, such as =26 - 11, to appear as text rather than returning
the result of a calculation. In this case, type '=26 - 11.
The single quote doesn’t show up in the spreadsheet. It simply indicates that the number
should be treated as text rather than as a value.
Formatting the spreadsheet
Whether you enter text or a number into a cell, you can specify how you want the cell
contents to appear. You can format a single cell or range of cells in the same way.
Most formatting options are available through the “Format” dialog box and some can also
be implemented using the Format toolbar.
Access the “Format” dialog box by selecting Cells from the Format menu (alternatively,
right-click and select Format Cells from the drop-down menu).
The Format box contains six main sections, all of which have their own page. These can
be accessed by clicking on the appropriate tab along the top of the box. In addition, there
is a button at the bottom right of the box that gives you access to the Styles page for
designing, naming and saving format combinations.
The formatting options available through the “Format” dialog box are:
•
Number (see Formatting a number on page 106)
•
Alignment (see Cell alignment on page 105)
•
Font, font style, size and color (see Cell font and style on page 104)
•
Borders (see Adding Borders on page 112)
•
Background colors (see Selecting the background color on page 111)
•
Locking and hiding cells (see Locking and hiding cells on page 114)
104 Spreadsheet
• Styles: formats saved for future use (see Styles on page 129)
Some of the above can also be implemented through the Format toolbar. For instance, if
you are formatting numbers, take a look at the formats you can apply by just clicking a
button on the toolbar (see Formatting numbers using the toolbar on page 106).
Note: When you format a cell and then copy it, the formatting is also copied and is
therefore pasted to a new cell.
Cell font and style
Use any or all of the following methods to select cell font and style using the toolbars:
•
Click on the arrow to the right of the Font box
font.
•
Click on the arrow to the right of the Size box
directly into the Size box).
•
Click on the Bold, Italic, Underline and Strikethrough buttons
apply styling.
to choose a
to choose a size (or type a size
to
The Bold, Italic, Underline and Strikethrough buttons have two states: up and down. If
the active cell shows a button down, the effect has been selected; up and the effect is
turned off.
You can also choose fonts and font styles by using the menus.
Using the menus to select cell font and style
To choose a font, select Cells from the Format menu, which opens the “Format” dialog
box, and then select the Font tab. (The “Format” dialog box can also be accessed by
right-clicking your mouse and then selecting Format Cells).
•
Choose a font for the text in the Font box, and select a style in the Font Style box.
•
Choose a size for the text in the Size box.
•
Choose to strikeout and/or underline text in the Effects box: click on the checkbox
next to the effect(s) you require.
•
Select a text color in the Color box.
A sample of the options you have chosen is given in the Sample box. When you have
finished, click on the OK button and the text will be formatted to your specification.
105 Spreadsheet
Cell alignment
By default, Ability will align text to the left and numbers to the right of a cell. Both will be
aligned to the bottom of the cell and each cell is formatted to sit on a single line (i.e. cell
wrapping is off).
You can override the default alignment by using either the formatting bar or the
Alignment command.
Using the formatting bar you can:
•
Click on the Left, Right or Center buttons
alignment.
•
to choose vertical
Click on the Top, Middle or Bottom buttons
alignment. Depending on the size of the cell, this might not make much difference to
the appearance of the text.
•
Click on the Wrap button
to wrap the text within the cell. This switches the cell
from a single line to as many lines as it needs to fit all the text within the cell.
to specify horizontal
Alternatively, you can use the Alignment tab in the “Format” dialog box (select Cells in
the Format menu or right-click and select Format Cells):
To set the horizontal alignment of the text, click on the button next to Left, Center or
Right.
To set the vertical alignment of the text, click on the button next to Top, Center or
Bottom.
If you want text that is too long for the cell to wrap round onto a line below within the cell
(rather than writing on into adjacent cells), click on the checkbox next to Wrap Text. The
cell will look something like this:
106 Spreadsheet
A sample of the options you have chosen is given in the Preview box. When you have
finished, click on the OK button and the text will be formatted to your specification.
Formatting numbers using the toolbar
Various formats can be applied to cells. However, the most important in Spreadsheet are
the number formats. These will be effective if the cell contains any form of numeric value
(including plain numbers, dates, formulas, currencies).
The quickest way to apply number formats is to use the number format buttons on the
toolbar, as follows:
- Add currency format to cell.
- Add percentage format to cell.
- Format thousands with comma separator.
- Increase number of decimal places by one.
- Decrease number of decimal places by one - the numbers will be rounded to the
nearest decimal place.
These buttons can be used together - for example, a cell may contain the number 32.
Click on the Currency button, then twice on the Increment precision button, to display
$32.00.
For more detailed number formatting, select the Number tab in the “Format” dialog box
(select Cells in the Format menu or right-click and select Format Cells).
Formatting a number
To format a number:
1. Select Cells in the Format menu (or right-click and select Format Cells).
2. Select the Number tab in the “Format” dialog box.
3. Select (for example) Number from the type list. The “Number” group box will appear.
4. In the Decimal Places box, specify the precision of the number. You can have a
minimum of none and a maximum of fourteen. (You can also use the increment
precision button on the formatting toolbar − see Formatting numbers using the toolbar
on page 106).
107 Spreadsheet
5. Auto Precision automatically sets the precision of the number at the maximum of
fifteen i.e. any number that has greater than fifteen digits (or fourteen decimal places
in scientific form) will be rounded to fifteen significant digits.
6. Select the Thousands With Commas checkbox for comma formatted numbers, i.e.
whether to have 1,345,622 or 1345622. (You can also use the commas button on the
formatting toolbar − see Formatting numbers using the toolbar on page 106).
7. Select the Negatives In Brackets checkbox to enclose negative numbers in
brackets, i.e. whether to have (123456) or -123456. (Surrounding negative numbers
with brackets is a common practice in accountancy.)
8. Select the Negatives In Red checkbox to display negative numbers in a red font.
9. In the Trail/Lead String option you can choose to have either trailing or leading
characters. Enter your text in the text box or choose from one of the existing group.
You can create your own number formats, including alternative currency formats.
Here are some examples:
2 lb.
2.2 Kg
1.2 $bn
FFr 23.56
DM 23.56
Note: Trailing and Leading text is managed in the Options dialog. You can add and
delete entries here. See General options on page 89 for more details.
A sample of the options you have chosen is given in the Preview box. When all is set,
click on the OK button and the number will be formatted to your specification.
You can use a variety of number types, all of which are displayed in the list at the left. To
format the appropriate type of number (e.g. Number, Currency, Fraction, etc.) click on it
in the list. The settings displayed to the right of the list change according to your
selection. The following sections give details on how to modify these settings for each
type of number.
Note that the General option applies no special number formats.
Formatting a currency
To format a number as currency:
1. Select the Cells command from the Format menu (or right-click and select Format
Cells).
2. Select the Number tab in the “Format” dialog box.
108 Spreadsheet
3. Select Currency from the number list. The “Currency” group box will appear.
4. The currency symbol will automatically be attached to the number. The rest of the
currency options are the same as for the Number format - see Formatting a number
on page 106 for details on how to set these.
You can also use the Currency button
to add a currency symbol directly.
Note: The currency symbol used by Ability is taken from the Regional settings in the
Windows Control Panel.
Formatting a time
To format a time:
1. Select the Cells command from the Format menu (or right-click and select Format
Cells).
2. Select the Number tab in the “Format” dialog box.
3. Select Time from the numbers list. The “Time” options box will be displayed.
4. Click on the checkbox next to Seconds to display seconds as well as hours and
minutes.
5. Click on the checkbox next to 0..12 to use the 12-hour clock and thereby display a
trailing AM/PM. Leave the checkbox blank to use the 24-hour clock.
Formatting a date
To format a date:
1. Select the Cells command from the Format menu (or right-click and select Format
Cells).
2. Select the Number tab in the “Format” dialog box.
3. Select Date from the numbers list. The “Date” group box will display.
4. In the Month group box, specify how you would like the month represented:
Digits:
Short Name:
Long Name:
1
Jan
January
5. Choose the separator you wish to appear between the different elements of the date
in the Separator group box (e.g. 15/7/97 or 15-7-97).
109 Spreadsheet
6. In the Year group box, choose between None, Short Form (e.g. 97), or Long Form
(e.g. 1997).
7. In the Order group box, choose whether you would like the day or the month to come
first.
You can also choose to display the time alongside the date: click on the checkbox next to
Add Time and then choose a time format.
A sample of the options you have chosen is given in the Preview box. When you have
finished, click on the OK button and the date will be formatted to your specification.
Formatting a percentage
To format a number to be displayed as a percentage:
1. Select the Cells command from the Format menu (or right-click and select Format
Cells).
2. Select the Number tab in the “Format” dialog box.
3. Select Percent from the numbers list. The “Percent” group box will be displayed.
4. The percentage symbol will be attached to the number. The rest of the percentage
options are the same as for the Number format - see Formatting a number on page
106 for details on how to set these.
Note: You can also use the Percentage button
percentage formatting.
on the formatting toolbar to apply
Formatting a fraction
To format a real number as a fraction:
1. Select the Cells command from the Format menu (or right-click and select Format
Cells).
2. Select the Number tab in the “Format” dialog box.
3. Select Fraction from the numbers list. The “Fraction” group box will be displayed.
4. In the Display As box, you can select Auto (the nearest representation of the
number as a fraction) or round the fraction to the nearest 100th, 10th, 16th, 8th or
4th.
110 Spreadsheet
You can also choose to have the integer part of fractional numbers displayed with
commas, negatives in brackets or in red, as with other numbers - see Formatting a
number on page 106.
A sample of the options you have chosen is given in the Preview box. When you have
finished, click on the OK button and the fraction will be formatted to your specification.
Formatting a scientific number
To format a number to display in scientific notation:
1. Select the Cells command from the Format menu (or right-click and select Format
Cells).
2. Select the Number tab in the “Format” dialog box.
3. Select Scientific from the numbers list and then set the decimal places as described
in Formatting a number on page 106.
Ability defaults to Scientific format if the number is too big (or small) to display with
significant precision in the width of the current cell.
Note: Scientific format coverts the original number into a base number, between 1 and
10, multiplied by a power of 10. This is useful for working with very large or very small
numbers. For example, 1 meter is defined as the distance light travels in
0.000000003335640952 seconds. Entering such a value is hard on the eye. Selecting
scientific format gives you a simplified display of 3.34E-09 (which is 3.34 x 10-9).
Formatting a boolean value
To format a number as boolean:
1. Select the Cells command from the Format menu (or right-click and select Format
Cells).
2. Select the Number tab in the “Format” dialog box.
3. Select Boolean to display either TRUE, for all numbers that are non-zero, or FALSE,
for cells containing zero.
Note that there are no options to choose from here – just selecting Boolean will ensure
the above result.
Clearing a format
You can clear a format from a cell (or range of cells) without deleting the contents.
111 Spreadsheet
1. Select the cell (or range) and then right-click your mouse.
2. Select Clear and then select the Format option from the drop-down menu.
Alternatively, select the Clear command from the Edit menu and then select Format.
Selecting the background color
To change the background color of a cell, or range of cells, first select the cell, or range,
and then do the following:
1. Select the Cells command from the Format menu (or right-click and select Format
Cells).
2. Select the Color tab in the “Format” dialog box. The “Color” dialog is displayed.
3. Select a color from the Basic colors box.
4. Click OK to apply the color to the selected cell or range.
In addition to the basic colors you can “design” your own custom color:
1. Enter the “Color” dialog box as above.
2. Click on the Define Custom Colors button. This expands the right side of the box to
display a color chart.
3. Use your mouse to pick a color from the chart. Once you’ve done this you can refine
your choice in the color bar at the side of the chart. The result will be previewed in the
Color/Solid box below.
4. Click on Add Custom Color to add the color to the Custom colors section at the left
of the box.
5. Click on OK to apply the custom color.
In future you can enter the box and choose any of the custom colors you have designed
and saved.
Note that there are boxes for Hue, Saturation and Luminosity, as well as Red, Green
and Blue. The values in these boxes change with the color selections you make. You can
type in values directly that will find and display the matching color.
Also, note that a background color can be applied to the whole of a worksheet in a
spreadsheet. To do this follow these steps:
1. Select Sheets from the Format menu.
112 Spreadsheet
2. Select Background from the drop-down list.
3. The “Color” dialog box is displayed.
4. Follow the same procedures as above.
The applied color will affect all of the current worksheet, rather than just selected cells.
Adding borders
There are two ways - a simple way using a button and a more complex way using the
menus - of adding borders to a cell or a range of cells in your spreadsheet.
To add a border to a cell or a range of cells using the button:
1. Select the cell or range of cells around which you wish to put the border.
2. Click on the arrow attached to the Format Border button
A small “Borders” box is opened.
on the formatting bar.
3. Click on the borders you would like to be placed around the selection: All Borders
puts a border around the whole selection; Left, Right, Top and Bottom can be used
to place individual borders; Clear Borders clears all borders from the selection.
Note that in using the Format Border button the borders are placed around the boundary
of the selection. If you want to put borders around individual cells within a larger
selection, then you need to use the menu, as shown below (although you could, of
course, select the cells one by one and repeat the above procedure).
To add borders to a cell or range of cells using the menu:
1. Select a cell or range of cells.
2. Select Cells from the Format menu (or right-click and select Format Cells).
3. In the “Format” dialog box, select the Border tab to open up the “Border” box.
4. The general procedure for creating a border is first to choose a border color, followed
by a line-style, and then to click on the appropriate border or borders to apply the
selected color and line-style. Of course, you may want to give different borders
different colors and/or line-styles. In this case, you have to repeat the process in each
case. The following sections explain how to select borders, line-styles and colors.
5. In the Borders group box at the left, you can specify which edges of the selection
you want to put borders around. Outline puts a box around the whole of the selected
area; Left, Right, Top and Bottom act on each of the cells. If you switched on all of
113 Spreadsheet
these at once, you would get a selection surrounded by a border, with all the cells
within the selection also surrounded by borders. This allows you to have, for
example, a thick-lined box of one color that contains broken-lined cells of another
color.
6. You can also have double borders, once again choosing these individually or as a
whole in the Borders box at the left.
7. Choose a color for the border in the Color box. Clicking on the arrow displays a
range of colors. Note that all of the line-styles take on the color that is selected, until
you choose another.
8. In the Style box at the bottom, you can choose the line-style you would like a border
to have. The easiest way to set your borders is to pick a line-style first and then click
on each of the border edges in turn. Often you’ll want a different outline style, so click
on the outline box and then click on a different line-style to finish.
For example, to set a border style that looks like this:
go through the following steps:
(i)
Click the Border button on the toolbar.
(ii)
Select a thin line style.
(iii)
Click on Left, Right, Top and Bottom border boxes.
(iv)
Click on the Outline box.
(v)
Select a heavier line style.
(vi)
Click OK to finish.
9. Remove a border by clicking on it in the Border box. This will cancel the line-style.
Alternatively, select the blank line-style in the Style box and then click on the
appropriate border.
10. Any line-styles, colors or borders you set will be displayed in the Preview box.
11. Once you are satisfied with your settings, click on OK.
114 Spreadsheet
The “Format” dialog box will close and your settings will be applied to the currently
selected cells in the spreadsheet.
Protecting a spreadsheet
To “protect” a spreadsheet, that is to say, to prevent unauthorized changes to the
contents and formats of locked cells and to ensure that the contents of hidden cells are
not displayed, follow these steps:
1. First, lock and hide the relevant cells (see Locking and hiding cells on page 114).
2. Next, select the Protect command from the Tools menu. The “Protect” dialog box is
displayed.
3. Type in a password of your choosing. You will not see the letters; they are
represented by asterisks to prevent anyone seeing your password accidentally.
4. Click on the OK button. You will be asked to re-enter your password.
5. The box will close and any locked or hidden cells will be unalterable until the Protect
command is cancelled.
6. Unprotect the spreadsheet by selecting Unprotect from the Tools menu and
entering the same password in the box. Locked and hidden cells will now be
accessible again.
Note: You can protect a spreadsheet without entering a password. To do this, just click
on the OK button of the “Protect” dialog box without entering a password. Obviously this
is not a safe method, although it is an easy way to stop yourself altering cells you don’t
want changed.
Write your password down in a safe place. If you forget your password, you will never be
able to unprotect your spreadsheet!
Locking and hiding cells
You can lock and hide cells to help protect information you don’t want to be altered or
seen. For this to be effective you also need to protect your spreadsheet (see Protecting a
spreadsheet on page 114). When you protect a spreadsheet, it is only the locked and
hidden cells that are affected.
•
Locking a cell prevents the cell from being changed when the spreadsheet is
protected.
•
Hiding a cell means that its value will not be displayed, either in the cell itself or on
the status bar, when the spreadsheet is protected.
115 Spreadsheet
Since it is possible to alter a cell that is hidden, even though it is protected and the
changes would not be visible on screen, it is a good idea to lock any hidden cells.
These features can be useful, for instance, if someone else uses your spreadsheet and
you do not want them to accidentally alter values or formulas in certain fields or to view
sensitive information.
To lock or hide cells:
1. Select the cell or range of cells you want to lock or hide.
2. Click on either or both of the Lock and Hide buttons
on the formatting bar.
Alternatively, select Cells from the Format menu and then click on the Cell Attributes
tab in the “Format” dialog box.
1. Click on the checkbox next to Lock to lock the cells, and on the one next to Hide to
hide the cells. You can choose both to lock and hide cells.
2. Click on the OK button to close the “Format” dialog box.
3. The cells will be redrawn with hatching over them (forward slashes for Hide,
backward slashes for Lock) to help you remember which cells have been locked or
hidden, or both, while you are designing your spreadsheet.
Once you have locked or hidden cells, you should protect the spreadsheet. The Lock and
Hide commands are then activated (see Protecting a spreadsheet on page 114) and the
hatching disappears.
You can unlock and unhide cells again by selecting them and clicking on the Lock and
Hide buttons on the formatting bar or by going into the Cell Attributes page of the
“Format” dialog box to cancel the selections. First, though, you need to unprotect your
spreadsheet.
Note: Once a document is protected you cannot lock and hide cells, and so the Lock and
Hide buttons and their equivalents in the “Format” dialog box are made inactive.
Changing column width
Letting text overflow into the adjacent cell is fine as long as you don’t put information into
that adjacent cell. However, in the body of most spreadsheets you’ll want columns of
information side by side, and if you do put information into the adjacent cell the end of the
long text is ‘clipped’.
To avoid this, you can alter the widths of the columns so that the texts will fit in them
without leaking over into adjacent cells. You can change the width of a single column or
several columns at once.
116 Spreadsheet
To change the width of a single column, position the mouse pointer over the right edge of
the column bar. The mouse pointer will change to a movement indicator:
Drag the mouse (keep the mouse button pressed while moving) to resize the column.
To change several columns at once, first select them and resize any of the selected cells.
Alternatively, you can select the Column Width command from the Format menu. The
“Column Width” dialog box is displayed.
Do one of the following:
•
In the Column Width box, type the width you require in points. A point is 1/96 of an
inch, or 0.026cm, so type 96 if you want the column to be 1 inch.
•
You can ask Spreadsheet to find the best width, given the texts you have entered. To
do this, click on the Best Fit button. Spreadsheet will then look at the longest text in
the chosen column and adjust the width so that the text will be displayed in its
entirety. If you have highlighted several columns, Spreadsheet will find the
appropriate best width for each of the columns.
•
If you want to go back to the default width of 80 points, click on the checkbox next to
Standard.
When you have altered the column width to suit, click on the OK button and the
spreadsheet will be redrawn to your specification.
Note: You can tell Spreadsheet to keep the width of a column, and instead of writing
across into adjacent cells, move extra text down onto a new line within the same cell. To
do this, select the cell in question and choose the Alignment command from the Format
menu. Then click on the checkbox next to Wrap Text in the “Alignment” dialog box.
Changing row height
Ability will automatically adjust the height of a row to match the largest font you’ve used,
so you won’t normally need to change row height.
To change the height of a single row, position the mouse pointer over the top edge of the
row bar. The mouse pointer will change to a movement indicator. Drag the mouse (keep
the mouse button pressed while moving) to resize the row.
To change several rows at once, first select them and resize any of the selected rows.
117 Spreadsheet
Alternatively, you can select the Row Height command from the Format menu. The
“Row Height” dialog box is displayed.
Do one of the following:
•
In the Row Height box, type the height you require in points. A point is 1/96 of an
inch, or 0.026cm, so type 48 if you want the row to be a half-inch tall.
•
You can use Spreadsheet to find the best height, given the texts you have entered.
To do this, click on the Best Fit button. Spreadsheet will then look at the highest text
in the chosen row, and adjust the height so that the text will be displayed in its
entirety. If you have highlighted several rows, Spreadsheet will find the appropriate
best height for each of the rows.
•
Select the Standard checkbox to return to the default height.
When you have altered the row height to suit, click on the OK button and the spreadsheet
will be redrawn to your specification.
Copying and moving information
In a spreadsheet you can copy or move information:
•
From one cell to another
•
From one range of cells to another range of cells
When you copy information, Spreadsheet creates duplicate information in the destination
cells you specify and the information also remains in the original cells.
Any formulas in the copy range are propagated in the destination range. For example, a
reference to the cell A1 in a formula in cell A2 will become a reference to cell B1 if the
formula is copied to cell B2. You can override propagation (see Absolute addresses on
page 132).
When you move information, Spreadsheet removes it from the original cells and displays
it at the destination cells instead. When you move formulas, any cell references within the
range are adjusted so they work in their new location. References made to cells outside
the range are preserved.
In either case, if there is already information in the destination cells, Spreadsheet
replaces it with the new information.
The most effective way of copying and moving information is to use drag and drop (see
Drag and drop on page 25).
118 Spreadsheet
You can also use cut and paste in a number of ways, as explained in the following
sections.
Note: As Spreadsheet is a Windows program, anything you copy or cut is placed in the
Clipboard. This means that you can paste it into another spreadsheet or another type of
document entirely, such as a database.
Copying and moving from one cell to another cell
To copy or move a single cell’s contents to a new location:
1. Click on the “source cell” - the cell you want to copy.
2. Select the Copy
button or the Copy command from the Edit menu. If you wish
to move the information, use the Cut
button instead.
3. Click on the “destination cell”.
4. Select the Paste
button or the Paste command from the Edit menu.
Copying and moving from one range to another range
You can also copy or move the contents of a range of cells from one place to another.
1. Select the range of source cells.
2. Select Copy
from either the toolbar or the Edit menu, or by right clicking your
mouse. If you wish to move the information, select Cut
3. Select the range of destination cells, and then select Paste
Edit menu, or by right clicking your mouse.
instead of Copy.
from the toolbar or
Provided the copy range can fit exactly into the paste range (i.e. the paste range is an
exact multiple of the copy range), you can copy information to a much larger area than
the copy range. To do this, select the paste range before pasting. The paste range will
contain an exact multiple of the copy range. This is extremely important when building
spreadsheets. For example, you can make a formula work for one column and then copy
it, in one operation, to many columns.
Copying one cell to many other cells
You can copy one cell and paste it into any number of destination cells. In the example
below, a formula has been entered in cell C4, =C3*$A4, to convert January’s figure from
£ to $:
119 Spreadsheet
You can copy the formula to make it work for February, March and April:
1. Click on cell C4 to make it the active cell.
2. Click the Copy button
on the toolbar.
3. Select cells D4 through to F4 to mark the destination range.
4. Click the Paste button
on the toolbar.
Note the use of the absolute reference in the formula – as you copy it to February, March
and April, the reference to C3 changes to D3, E3, F3 respectively, but they all still refer to
A4 to get the exchange rate (see Absolute addresses on page 132 for more details).
The above operations can also be used to move the contents of one cell to many other
cells, if Cut is used instead of Copy.
Copying many cells to one
This saves you from having to select an area the same size as the copy range when
pasting: just point to the top left-most cell in the destination range and Ability will fill in the
rest. In the following example, a new line for DM has been added:
You can copy the formulas in row 4 and make them work for row 5:
120 Spreadsheet
1. Select cells C4 through to F4.
2. Click the Copy button
on the toolbar.
3. Click on cell C5 to mark the top left corner of the destination range.
4. Click the Paste button
on the toolbar to fill row 5 with formulas.
The above operations can also be used to move the contents of many cells to one cell, if
Cut is used instead of Copy.
Copying many cells to many other cells
The number of cells in the copy range must divide exactly into the paste range. In the
following example, cells C4 and C5 have the correct formulas, which need copying to D4
through to F4 and D5 through to F5.
1. Select cells C4 through to C5.
2. Click the Copy button
on the toolbar.
3. Select cells D4 through to F5 to mark the destination range.
4. Click the Paste button
on the toolbar to copy the formulas.
The above operations can also be used to move the contents of many cells to many other
cells, if Cut is used instead of Copy.
Drag and drop
"Drag and drop" is a technique, using your mouse, for moving, copying, filling in and
deleting spreadsheet data. "Drag and drop" in Ability is supplementary to the more
traditional copy, cut, paste, delete and fill commands, although easier to use once learnt.
121 Spreadsheet
The following sections show you how to drag and move, copy, fill or delete.
Drag and move
To move the contents of a cell (or selected range):
1. Click on the cell whose contents you want to move.
2. Point anywhere along the cell's border.
3. When the mouse pointer changes to an arrow, hold down the left mouse button.
4. Drag the cell outline to the target cell. Release the mouse button.
The contents of the cell will be moved to the target cell. This has the same effect as cut
and paste.
Drag and copy
To copy the contents of a cell (or selected range):
1. Click on the cell whose contents you want to copy.
2. Point anywhere along the cell's border.
3. When the mouse pointer changes to an arrow, hold down the left mouse button and
the Ctrl key.
4. Drag the cell outline, while keeping the Ctrl key depressed, to the target cell. Release
the mouse button and Ctrl key.
The contents of the cell will be copied to the target cell. This has the same effect as copy
and paste.
Drag and fill
You can drag and fill the contents of a single cell, or range of cells, to another range of
cells. Certain types of ordered data, such as numbers, days and months, are
incremented automatically. Follow these steps:
1. Click into the source cell.
2. Move the mouse pointer over the cell handle in the bottom right corner of the cell:
122 Spreadsheet
3. When the mouse pointer turns to a cross, hold down the left mouse button and drag
the cell outline till it covers the area you want to fill.
The contents of the source cell will fill the selected cells. Note that only cells adjacent to
the source cell -either up, down, left or right - can be filled. To fill an area, rather than just
a column or row range, follow steps 1 to 3 above then drag the range you've just created
to fill the remaining area.
If the source cell contains a number or a text string with a number at its end, the selected
cells will be filled incrementally. Here are some examples:
Source cell
1998
Product1
Jan
Monday
Target range after drag and fill
1999, 2000, 2001
Product2, Product3, Product4
Feb, Mar, Apr
Tuesday, Wednesday, Thursday
The last two examples show how the built-in ordered lists can be used (see Custom lists
on page 150 for more information).
Sometimes, when the source cell contains a number or member of a custom list, you may
not want a range to be filled with incremental values. In these cases, you should first
select the required range and then select the Fill command from the Edit menu or click
on the Fill button on the toolbar. In the "Fill” dialog make sure you leave the Series box
unselected and then click on OK. The contents of the source cell will be copied exactly
(without incrementation) to each of the cells in the selected range.
Filling cells automatically
You can automatically fill a whole range of cells with values. You might use this, for
example, when you set up a spreadsheet in which you want a column for every year from
1984 to the present. Column A would be 1984, column B would be 1985, and so on.
There are two types of fill: Normal and Series. In normal fill, the same value is put in
each selected cell. In series fill, a different value (calculated in a specified increment from
the starting value) is put in each cell.
To automatically fill in a range with a particular value, using Normal Fill, follow these
steps:
1. First enter the value in a cell.
2. Next, select the range you want to fill (click and drag the mouse across and/or down
the spreadsheet to select a range, making sure the first cell in the selected range is
the cell containing the value).
123 Spreadsheet
3. Click on the Fill button
dialog is displayed.
or select the Fill command from the Edit menu. The “Fill”
4. Click on OK (note that the fact that the Series box is left unselected indicates that
this is a normal fill).
5. The range will be filled with the value of the active cell. With normal fill, the fill is
performed in one direction at a time. If the range spreads over an area greater than a
single row or column, then you need to repeat the operation, specifying a different fill
direction, to fill the whole area. For instance, you might first fill an area down and then
right. (See below for details)
To automatically fill in a range with an incremented value, using Series Fill, follow these
steps:
1. First select the range you want to fill.
2. Next, select the Fill command from the Edit menu or click on the Fill button on the
toolbar.
3. In the “Fill” dialog select the Series checkbox by clicking on it. This activates the
Series box.
4. In the Start box enter the value from which you want to start.
5. In the Step box enter the step-size by which you want the value to be incremented.
(Note that Ability recognizes various incremental lists, including numbers, text that
ends with a number, and the lists, such as days of the week, contained in Custom
Lists (under Options from the Tools menu)). If you leave the Step box empty,
Spreadsheet will automatically use an increment of 1.
6. The range will be filled incrementally according to the direction selected in the
Direction box. If the range stretches over rows and columns the fill will proceed in
the same direction throughout the range. (See below for details)
7. When all is set, click on the OK button. The selected cells will be filled.
Direction of Fill
With either fill type, if the selected range spreads over an area greater than a single row
or column, then you can choose in which direction you would like the fill to work.
Left
Fills the cells to the left of the active cell with
its value
Right
Fills the cells to the right of the active cell with
its value
124 Spreadsheet
Up
Down
Fills the cells above the active cell with its
value
Fills the cells below the active cell with its
value
•
Series Fill automatically fills the whole of an area, according to the selected
direction.
•
Normal Fill fills in only one direction at a time. So, for instance, to normal fill a
selected area with a particular value, you might select Down first and then select Fill
again and select Right.
Note: Fill will work with formulas as well as values. Filling with a formula works in the
same way as copying a formula: each formula is propagated throughout the range. The
formula should be entered in the active cell, as for normal fill, before selecting the range
to be filled (see Copying a formula on page 132 for more details).
Example 1
To fill the area A1..D10 with a particular value, say the number 1, do the following:
Enter 1 in A1 and then select the range A1..D10. Select Fill from the Edit menu or click
on it on the toolbar. The "Fill" dialog will be displayed. Leave the Down button switched
on and then select OK. The first column in the range will be filled. Next, select Fill again
and this time switch on the Right option by clicking on it. The rest of the range will be
filled.
Example 2
To fill the range A1..D10 with an incremented series of invoice numbers, where the first
one is ABC45, the step is 2 and the range is to be filled along the rows, do the following:
Select the range to be filled. Select Fill from the Edit menu or by clicking on the toolbar.
The "Fill" dialog will be displayed. Click on the Series checkbox to activate it. In the Start
box put ABC45. In the Step box put 2. Select the Right option. Select OK. The range will
be filled along the rows in increments of 2, from ABC45 to ABC123.
Inserting and deleting cells, rows and columns
The following sections show you how to delete and insert cells, rows and columns in your
spreadsheet.
Drag and delete
To delete the contents of a range of cells:
125 Spreadsheet
1. Select the range.
2. Move the mouse pointer over the cell handle:
3. When the pointer changes, press on the left-hand mouse button and drag back
across the range. The range will be grayed out as you drag.
4. Release the mouse button when the range is totally gray. The contents of the range
will be deleted.
Erasing the contents of a cell
You can erase the contents of a cell. To do this, activate the cell you wish to delete
(usually by clicking on it), and then press the del key. This will delete everything in the
cell, including contents and format.
If you wish to delete particular features of the cell while leaving others intact, select the
Clear command from the Edit menu. The “Clear” dialog will appear.
In this dialog, you are given five choices:
All
Erases everything from the cell.
Values
Erases the value from the cell, leaving
formulas and formats intact.
Formulas
Erases only a formula from the cell - the result
of the formula will be left intact.
Contents
Erases only the contents of the cell, that is
values and formulas; anything else you put in
this cell will take on the existing formatting.
Format
Erases only the formatting of the cell – the
contents will be left intact.
You can also access Clear by right-clicking your mouse, although the options to clear
formulas and values are not available in this way.
Select the option you require, and click on the OK button.
Inserting cells, rows and columns
When you are building a spreadsheet, you may discover that you need to insert new
cells, columns or rows.
126 Spreadsheet
To insert cells, select the cells where you want the new cells to go. Next, select Cells
from the Insert menu (or by right clicking your mouse). The "Insert Cells" dialog will
appear. Choose whether you want the selected cells and their contents to be shifted
down or right. Click on OK to insert the new cells.
To insert a row, click on the row bar to select where you want the inserted row to appear.
The whole of the row is selected, rather than a range of cells. Select Cells from the
Insert menu (or by right clicking your mouse). The new row will be inserted, and the
selected row and all rows beneath the selected row will be shifted one row down. Note
that the "Insert Cells" dialog does not appear when inserting rows.
To insert a column, click on the column bar to select where you want the inserted column
to appear. The whole of the column is selected, rather than a range of cells. Select Cells
from the Insert menu (or by right clicking your mouse). The new column will be inserted,
and the selected column and all columns to the right of the selected column will be
shifted one column to the right. Note that the "Insert Cells" dialog does not appear when
inserting columns.
It is possible to insert several rows or columns at once by selecting the required number
of row or column bars.
Note: Spreadsheet readjusts formulas and range references to compensate for inserted
rows and columns.
Deleting cells, rows and columns
Note: When you delete cells, rows or columns, any information they contain is also
deleted.
To delete a cell (or cells), select the cell(s) you want to delete. Next, select Delete from
the Edit menu (or by right clicking your mouse). The "Delete Cells" dialog will appear.
Choose whether you want the deleted cells to be replaced with cells from the same
column(s) or row(s). Click on OK to delete the selected cells and shift cells from the same
column (up) or row (left).
To delete a row, click on the row bar to select the row you want to delete. The whole of
the row is selected, rather than a range. Select Delete from the Edit menu (or by right
clicking your mouse). The selected row will be deleted, and all the rows beneath the
deleted row will be shifted one row up. Note that the "Delete Cells" dialog does not
appear when deleting rows.
To delete a column, click on the column bar to select the column you want to delete. The
whole of the column is selected, rather than a range. Select Delete from the Edit menu
(or by right clicking your mouse). The selected column will be deleted, and all columns to
the right of the deleted column will be shifted one column to the left. Note that the "Delete
Cells" dialog does not appear when deleting columns.
127 Spreadsheet
It is possible to delete several rows or columns at once by selecting the required number
of row or column bars.
Note: Spreadsheet readjusts formulas and range references to compensate for deleted
rows and columns.
Comments
It is possible to attach comments to cells in a spreadsheet. When you need to remind
yourself what sort of information the cell contains e.g. a formula whose purpose you have
forgotten, it is easy to bring up the comment box with your previous note.
To create a comment box, do the following:
1. Click on the cell to which you want to add the comment.
2. Right-click your mouse and select Insert Comment (alternatively, select Insert
Comment from the Insert menu).
3. A box is displayed next to the selected cell. Type your comment directly into the
comment box.
4. To close the comment box, click anywhere outside it.
5. A red mark will appear in the top right-hand corner of any cell that has an attached
comment. While you are working in a spreadsheet, you can display the comment
boxes attached to the cells by running your mouse pointer over this mark. The box
will remain visible till you move the mouse away (see Editing comments on page 127
for details on how to edit a comment).
Note that a comment box will accept only text. If you attempt, for instance, to insert a
function into a comment box, it will be inserted into the cell itself. Likewise, any attempt to
change the font characteristics of the comment text will affect the cell contents instead.
Editing comments
You may decide that you would like to change the text in a comment box. To do this,
follow these steps:
1. Click on the appropriate cell.
2. Right-click and select Edit Comment from the drop-down menu (alternatively, select
Edit Comment from the Insert menu).
3. The comment box is displayed with its text. The box will remain visible on screen till
you click outside it.
128 Spreadsheet
4. Click in the box and edit the text as you would with any other text (with the proviso
that you can’t apply any font effect).
5. Once you are satisfied, click outside the box to close it.
You can edit the comment at any time and as many times as you like.
Deleting comments
You can delete a comment box attached to a cell by following these steps:
1. Click on the appropriate cell.
2. Right-click and select Delete Comment from the drop-down menu.
The comments box will be deleted, this being indicated by the disappearance of the red
mark in the top right-hand corner of the cell.
Merging and splitting cells
You can merge a range of cells to form one cell and split an already merged cell back
into its component cells. In this way it is possible to have a large cell and its contents
stand out among otherwise normal cells.
Merge a selected range of cells as follows:
1. Select the cells you want to merge.
2. Select Merge Cells from the Format menu.
The cells will be merged to form one big cell. Note that the individual cell borders
disappear and that when you click anywhere within the merged cell the whole cell is
selected, as you would expect.
If you would like to convert a merged cell back into its component cells, follow these
steps:
1. Select the merged cell you wish to split.
2. Select Split Cells from the Format menu.
The cell will be split into normal cells.
Note: The merge and split options are useful as aids to designing your spreadsheet’s
appearance. Once this is settled, you can then enter the required data. However, if a
range of cells that are to be merged already contain data, it is only the data in the top lefthand cell that is displayed in the new merged cell. To retain all of the data in the cells that
129 Spreadsheet
comprise the range, you should use copy or cut and then paste into the top left cell of the
range before merging. When you split a merge cell the data is displayed in the top left cell
after the split has been performed.
Styles
The styles option allows you to design and save for future use formats and combinations
of formats that you may want to apply to certain cells in your spreadsheets. Styles can
save you a lot of time, especially when the combinations of formats are complicated.
Design a new style as follows:
1. Open up the “Format” dialog box by either selecting Cells from the Format menu or
right-clicking and selecting Format Cells from the drop-down menu.
2. In the box, click on the Styles button at the bottom left corner to open up the Styles
Design box.
3. You can now use any, some or all of the six format options (accessible through the
six tabs along the top of the box) to help design the new style. Set the required
formats and then click in the top line of the Styles Design box.
4. Type the name of the style. This will activate the Add button, which you should now
click on to place the new style in the box below, in which styles are listed and saved
for future use. (Note that the add button will only be activated if the new style has a
different name from those already listed.)
5. Once this is done you can do one of three things: continue to design new styles, as
described above, and add them to the list; exit the dialog box altogether without
applying a style; or apply a style there and then.
6. Apply a style by selecting it from the list and clicking on Apply. When you click on
OK the style will be applied to the currently selected cell or range of cells. (If you
choose not to apply a style, clicking on OK will close the box without affecting the
spreadsheet.)
You can go back to the “Format” dialog box at any time to design new styles or apply old
ones. Also, you can delete a style by selecting it and clicking on the Remove button.
Using formulas
This is the real heart of the spreadsheet. You can use formulas to add, subtract, multiply,
and divide the numbers in your spreadsheet. For example, you can:
•
Add up a column of numbers
130 Spreadsheet
• Automatically compute averages
•
Solve mathematical problems like 3456.87 x (345.2498 + 1224.1 + 45.3)
•
Use any of Ability's built-in functions
With formulas, you can design spreadsheets that help you to explore “what if”
possibilities. What happens to your profits if expenses creep up 9%? What if the
payments on a new car stretch over 48 months instead of over 24? This “what if” analysis
is a vital component of business and financial planning.
The following sections show you how to work with formulas in Ability. You will also need
to refer to the sections under Function reference on page 480.
What is a formula?
A formula is like a set of instructions for calculating or retrieving values. Here are some
examples of formulas:
=341 * .065
Multiplies 341 by .065.
=A9 - C14
Subtracts the value in C14 from the
value in A9.
=(A3 + A4)/.125
Adds the values in A3 and A4, then
divides by .125.
=SALES - B5
Subtracts the value in B5 from the value
in a field named SALES (you’ll read
about naming fields later in this chapter).
=TOTAL (D8..D11)
Using one of Ability’s built-in functions,
(TOTAL), adds the values in fields D8 to
D11.
=Sheet1!A1 * 2
Multiplies the contents of cell A1, in the
worksheet called Sheet1, by 2.
Arithmetical operators
You can use formulas to add, subtract, multiply and divide numbers. You should use the
following standard arithmetic operators in your formulas:
/
division
*
multiplication
+
addition
131 Spreadsheet
-
subtraction
Note: These arithmetic operators are listed in the natural order of priority, from highest
(calculated first) to lowest (calculated last). You can use parentheses to group
information and to control the order of calculation.
In addition, you can use these logical operators:
%
The percentage sign simply divides a number by 100.
For example, 25% means 0.25.
( )
Parentheses group parts of a formula and also control
the order in which calculations are performed. For
example, A2 * (B3 + C4) tells Spreadsheet to add B3
and C4 first, and then multiply the result by A2.
Without the brackets, Ability would multiply A2 by B3
before adding C4.
^
The caret raises a number to a power (exponentiation).
For example, 3^2 raises 3 to the power of 2, or
squares it. You can also raise numbers to fractional
and negative values. For example, 3^0.5 or 3^(1/2)
finds the square root of 3 and 10^-2 gives the result of
1/(10*10), which is 0.01.
Ability will automatically strip excess brackets from a formula to display it in its simplest
form.
How to enter a formula
You build a formula by making reference to other cells. For instance, to display the total
of two cell values in a third cell, you would put the formula (location of cell 1) + (location
of cell 2) in the third cell. When the contents of cell 1 or cell 2 change, cell 3 is updated
to reflect the change.
Formulas are entered in the active cell just as you enter text or values. However, you
always start a formula with an equals sign (=).
Note: You can begin a formula with other operators if you like, for example “+” or "-".
Now you’re ready to build the formula. Lets use an example of adding cell A1 and A2
together and putting the result in cell A3. First, click on A3 and type “=”. Next, click on cell
A1, type “+” and then click on cell A2. Note that the formula bar will read:
=A1+A2
132 Spreadsheet
You can type the entire formula directly if you want. Often though, you’ll find it easier to
refer to a cell in a formula by simply clicking on it.
When you have finished the formula, click on the Confirm button
on the status bar,
or press enter, and the results of the calculation will be inserted into the active cell.
If you make mistakes while you’re building a formula and you want to start over again,
on the formula bar. Spreadsheet erases the
press esc or click on the Cancel button
formula and you can start again by entering an equals sign.
If you want cells to show their formulas instead of the results, open the View menu and
click on the Formulas command. When formulas are showing, this command has a
check next to it. To show results again, click on the command to remove the check.
Copying a formula
You can often save time by copying a formula from one cell to another.
To do this, activate the cell whose formula you wish to copy. Then select Copy either
from the toolbar
or the Edit menu, or by right clicking your mouse.
Next, click on the cell to which you wish to copy the formula, and select Paste either from
or the Edit menu, or by right clicking your mouse. The formula is copied
the toolbar
into the destination cell.
However, you may notice that the formula has been altered slightly. This is because
Spreadsheet automatically adjusts the cell addresses in the formula so that they work
logically in the new location.
To give an example, let’s say you entered the formula B8*C8 in cell D8. If you then
copied it to cell D9, Spreadsheet would turn it into B9*C9, and in cell D10 it would
become B10*C10.
If you do not want the cell addresses to be adjusted in this way, you need to specify them
as absolute addresses.
Absolute addresses
As described in Copying a formula on page 132, Spreadsheet normally adjusts the cell
addresses so that the formula works in the new locations. Occasionally, though, you
might not want the cell addresses to change. For example, when you copy a formula like
B8*C8 to a new location in a spreadsheet and still want the formula to multiply the value
in B8 by the value in C8.
133 Spreadsheet
In this case you don’t want the formula to adjust the field addresses for the new location.
In other words, you want B8 and C8 to be absolute field addresses in the formula.
To include absolute field addresses (as opposed to adjustable addresses) in a formula,
precede the field address with a dollar sign ($). The dollar sign tells Spreadsheet to copy
the formula exactly, and to leave the field addresses unchanged.
You can use a dollar sign to make:
•
absolute row addresses, e.g. B$8
•
absolute column addresses, e.g. $B8
•
absolute row and column addresses, e.g. $B$8
Clearing formulas
Once you have entered a formula, you might decide that you no longer want the cell to
contain the formula, but simply to display its result. Consequently the current contents of
the cell will be protected from change (when, for instance, one of the other cells referred
to in the formula changes).
To turn a current formula result into a static cell value, select the cell whose formula you
wish to clear. Then choose the Clear command from the Edit menu and select
Formulas. This indicates to Spreadsheet that you want to clear the formula from the cell
but without deleting the result. Click on the OK button.
You can clear the formulas in a range by first selecting the range and then repeating the
above operation.
This procedure is irreversible (i.e. you cannot later turn the values back into the formulas
which created them), so use it with care.
Note: Clearing formulas also clears any links, turning them into static values.
Automatic totals
Auto-sum is a quick method of summing values in a column, row or range.
To use auto-sum, do one of the following:
•
Click into a cell below the column or to the right of the row that you want to sum and
. Ability will show you the range about to be summed select the Sum button
accept this with the Confirm button, or press the Enter key. The SUM function will be
pasted in the cell.
134 Spreadsheet
• Select a range of cells and click the Sum button - Ability will fill in row and/or column
totals in the appropriate place.
Example 1 - totaling a column of figures
Say the range A1 though A10 contains numbers you want to total. Click into cell A11 (or
A12 if you prefer to leave a gap) and click the Sum button. Ability will outline the range
and wait for you to press Enter or click the Confirm button.
Example 2 - totaling a column of figures
As an alternative to Example 1, again say the range A1 though A10 contains numbers
you want to total. This time select A1 through A10. Click the Sum button - Ability will put
the total in cell A11. If instead you select cells A1 through A12, the total will be placed in
A12 (that is to say the total will always be placed in the last, or last+1, cell of the selected
range).
Example 3 - including row and column totals in one go
Suppose the range A1 through D5 contains values and you want row and column totals
and a grand total. First select the cells A1 through D5. Next, click the Sum button. All the
totals will appear below and to the right of the range with a grand total in cell E6.
Calculating current selection
Sometimes it is useful to see the results of calculations as you work in a spreadsheet but
without having these results inserted into the spreadsheet itself. To this end Ability
provides a status bar box called Autocalc, in which calculations can be performed
automatically on any range of values that is currently selected.
To activate Autocalc right-click on the right most box on the status bar. A menu will
appear with functions for Count, Sum, Average, Max and Min. Click on the function you
require. This function will be active until you choose another one. Select the range of
cells to which you want to apply the function. The result of the calculation will appear in
the Autocalc box. To apply another function right click on the box again and click on
another function to make it the active one. To switch off Autocalc click on None.
For example, to perform the full set of automatic calculations on values in the range
A1..D10, you should first select the range and then activate Autocalc. Selecting the
available functions one by one will tell you how many non-empty cells there are in the
range and the sum, average, maximum and minimum of the values. To apply the
currently selected function to another range, just select that range.
135 Spreadsheet
Turning recalculation on and off
Spreadsheet has an auto-calculation feature. This feature is turned on by default, so
Spreadsheet automatically calculates the results of all formulas after each entry you
make that affects a formula.
To turn off auto-calculation, select the Auto Calculate command from the Tools menu:
the check next to the command in the menu will be removed. Select the Auto Calculate
command again to turn it back on.
When auto-calculation is disabled, you need to select the Calculate Now command from
the Tools menu to calculate the results of formulas. Manual calculation of this sort is
useful if you have many formulas, or are putting in a lot of data, and you do not want to
wait for Spreadsheet to recalculate after every entry that affects a formula.
Auto Calculate and Calculate Now operate on the current spreadsheet as a whole and
not just on a selected cell or range.
Linking
You can link a field in a Spreadsheet to another field in:
•
the same spreadsheet
•
a different spreadsheet
•
a Write document or Database
Linking is a way to tie information in one field to information contained in another. When
you link fields, if you change the value in one field, the value in the other field
automatically changes too.
Links can be either one-way or two-way:
•
A one-way link, at its simplest, is just a cell reference; for example, =A1 entered in
cell A5 creates a one way link. You can make changes to A1 that will be reflected in
A5, but not the other way round.
•
A two-way link is similar but the data can be changed at either end. A logical
consequence of this is that two-way links cannot be used in building a formula (unlike
one-way links).
One-way and two-way links can work between documents: a spreadsheet can have a
one-way or two-way link to another spreadsheet or a Write document (see Linking
through fields on page 400).
136 Spreadsheet
One-way links
The easiest way to set up a one-way link is to type it directly into the destination cell. For
example, if A1 contains 123, type the formula
=A1
in any other cell, say E10. The contents of E10 will always be the same as A1. This is
identical to a standard spreadsheet formula, so =A1 + 10 is also valid.
As an alternative, you can use a paste special operation to achieve the same result. For
example:
1. Click in cell A1
2. Select Copy by right-clicking your mouse
3. Click in cell E10, which is to contain the linking expression
4. Select Paste Special by right-clicking your mouse
5. Select Paste Link from the "Paste Special" dialog
Two-way or hot links
The easiest way to create a two-way link is to type it directly. For example, if A1 contains
123, type the formula
! A1
in any other cell, say E10. The contents of E10 will always be the same as A1 and you
can edit data at either end of the link. For example, entering 456 in E10 or A1 will cause
both E10 and A1 to display the same result - 456.
As an alternative, you can use a paste special operation to achieve the same result. For
example:
1. Click in cell A1
2. Select Copy by right-clicking your mouse
3. Click in cell E10, which is to contain the linking expression
4. Select Paste Special by right-clicking your mouse
5. Select Paste Hot Link from the "Paste Special" dialog
137 Spreadsheet
To convert a one-way link into a two-way link, select the Edit Source button
or
select the Attributes command from the Format menu, and then check Edit Formula
Source. Selecting the Edit Source button again will convert the two-way link back into a
one-way link.
Naming cells and ranges
Cells and ranges of cells can be assigned names. After a cell is named, you can use the
name instead of the cell address in formulas and other references to that cell.
For example, supplies might be one expense category and utilities another. By giving
names to the grand total cells for both supplies and utilities, you can build a formula that
looks like this:
=SUPPLIES+UTILITIES
In addition, you might find it easier to remember SUPPLIES than a precise cell address.
So, if you want to use the Go To command from the Edit menu to move the cursor to that
cell, you can simply enter the name SUPPLIES rather than a cell address.
Assigning names to cells and ranges
To name a cell, activate it (usually by clicking on it), and then select the Range Name
command from the Insert menu. The “Range Name” dialog is displayed.
The cell you have selected is displayed in the Range box. Type in a name for the cell in
the Name box. The existing cell and range names are listed below in the Ranges box.
Click on the Add button and the cell name will be added to this list. Notice how the
addresses of named cells and ranges are given in square brackets after the names.
Select Close to save the new name.
If you want to name a range, the steps are the same as for a cell, only make sure you
select the range before selecting the Range Name command (although it is possible to
type in the range directly).
The name you have chosen will appear in the Cell Index box on the formula bar.
To refer to named cells or ranges in formulas, just use the name wherever you would
otherwise use the cell address. For example, if you name the range A1 to A10 as
MYLIST, these two formulae are equivalent:
=TOTAL(MYLIST)
=TOTAL(A1..A10)
138 Spreadsheet
Changing or removing names
You can easily change or remove a name assigned to a cell or range. Click on the cell to
activate it or select the range, then choose the Range Name command from the Insert
menu. In the “Range Name” dialog, use the Delete and Delete All buttons to delete as
required. You can select and delete the named cells and ranges at will.
To rename a cell or range, click on it in the Ranges box in the Range Name dialog, and
then click on the Name box. Delete the name by selecting it and then either using Del on
the keyboard or right-clicking on your mouse and selecting Cut. Type in the new name
and select the Add button. The new cell or range name will appear in the Ranges box.
Note that the old name, which is now inactive, is still there. To erase this, select it and
click on the Delete button.
Sorting
You can sort the fields of your spreadsheet. Sorting is a way of re-arranging items in a
specific order, according to the contents of a key row or column within the selection.
To sort rows and columns in a spreadsheet, first shade the range to be sorted. Then
select the Sort command from the Tools menu. The “Sort” dialog box is displayed.
In the Sort box, you can choose between sorting by Rows and sorting by Columns.
In the three boxes below the Sort box, you can specify up to three sort levels. For each
sort you should specify which column to sort by when sorting rows, or which row to sort
by when sorting columns.
For each sort you can also choose between Ascending order (where normal ascending
numerical or alphabetical order is applied) and Descending order (where normal
descending order is applied). Normal sort order can be overridden by selecting a Custom
List from the Order box. This enables you to sort columns or rows that contain, for
example, days of the week or months, or any lists that you may have added to Custom
List yourself.
If you apply more than one sort, columns or rows with duplicates in the first sort level are
sorted according to the second and third sort levels. If you have not specified second and
third sort levels, rows or columns with duplicates in the first sort are left in the order in
which they are found.
To sort on more than three levels, use the Sort command several times using the least
significant keys first.
Note that when a sort is applied using Normal order, the following criteria apply:
•
numbers are sorted according to their numerical order, words according to their
alphabetical order;
139 Spreadsheet
•
numbers come before letters (3 before a; 3a before a3);
•
a lower case letter comes before its upper case equivalent (if you want letters to be
ordered without regard for case, then check the Ignore Case box by clicking on it).
Searching
You can search a spreadsheet for a cell that contains a particular text string, value, or
on the toolbar or select
result of a formula. To begin a search, click the Find button
the Find command from the Edit menu. The “Find” dialog box is displayed.
In the Find what box, type the text, value or result of a formula you wish to find, or paste
it in from the clipboard.
In the Where box select Values if you only want to find text or a value; select Formulas if
you only want to find the result of a formula; select Both if you want to find either
text/value or a result of a formula. For instance, if you enter 53 in the Find what box, and
if cell A10 contains the value 53, while cell A11 contains 53 as the result of a formula, say
=21 + 33, then setting Values will find A10 but not A11, setting Formulas will find A11
but not A10, and setting Both will find both A10 and A11.
In the Direction and Scope boxes, choose where you would like to look for the item:
All
Search from the beginning of the
spreadsheet or selection
Down
Search from the active cell to the end of the
spreadsheet or selection
Up
Search from active cell to the beginning of
the spreadsheet or selection
Whole document
Search the whole document
Selection
Search only the selected cells. Use this
option to search a specific row or column by
first selecting a row or column, or to search a
selected area
Select the Match Case checkbox to find only those occurrences with the combination of
uppercase and lowercase letters specified in the Find what box.
Select the Match whole words only checkbox to find occurrences that are words by
themselves, and not part of a larger word.
When everything is set, click on the Find Next button and Ability will find the next
occurrence of the text, value or result of formula, as specified. If no matches are found, a
message will tell you that the search was unsuccessful.
140 Spreadsheet
Finding next occurrence
You can repeat the last performed search by selecting the Find Next command from the
Edit menu. Since Ability remembers what you last searched for, you do not have to go
back into the Find dialog to set up a search.
Finding a formula
If you want to find a formula, select Formulas from the View menu first. The spreadsheet
will display formulas rather than their results. You can then use Find to search for
formulas directly. Note that when formulas are displayed they are treated as values for
the purposes of Find, so the Where box should be set to Values.
Replacing
To replace a particular text string, value or result of formula with another one, click on the
Replace button
on the toolbar or select the Replace command from the Edit menu.
The “Replace” dialog box is displayed.
This is very similar to the “Find” dialog box. However, it has some additional sections.
In the Find what box, type the text, value or result of a formula you wish to find, or paste
it in from the clipboard.
In the Where box select Values if you only want to find and replace text or values; select
Formulas if you only want to find and replace the result of a formula; select Both if you
want to find and replace either text/values or the result of a formula. For instance, if you
enter 53 in the Find what box, and if cell A10 contains the value 53, while cell A11
contains 53 as the result of a formula, say =21 + 33, then setting Values will find A10 but
not A11, setting Formulas will find A11 but not A10, and setting Both will find both A10
and A11.
In the Replace with box, type the text, value or formula you want to replace the found
item (or paste it in from the clipboard). Note that you can replace a value or text with a
formula, or an existing formula with another, and vice versa.
In the Direction and Scope boxes, choose where you would like to look for and replace
the text, value or result of a formula:
All
Search from the beginning of the
spreadsheet or selection
Down
Search from the active cell to the end
of the spreadsheet or selection
Up
Search from active cell to the
beginning of the spreadsheet or
selection
141 Spreadsheet
Whole
document
Search the whole document
Selection
Search only the selected cells. Use
this option to search a specific row or
column by first selecting a row or
column, or to search a selected area
Select the Match Case checkbox to find only those occurrences with the combination of
uppercase and lowercase letters specified in the Find what box.
Select the Match whole words only checkbox to find occurrences that are words by
themselves, and not part of a larger word.
When everything is set, click on the Find Next button and Ability will find the next
occurrence of the text, value or result of formula as specified. If no matches are found, a
message will tell you that the search was unsuccessful.
Since Find Next finds values one by one you can choose to replace these as you go
along by clicking on the Replace button. Ability will then automatically replace the
present occurrence and proceed to search for the next one. If you choose not to replace
a particular occurrence, click on Find Next instead. Alternatively, click on the Replace
All button to replace all occurrences of the find item with the replace item.
Replace next occurrence
You can repeat the last performed replacement by selecting the Replace Next command
from the Edit menu. Since Ability remembers what you last entered in the Replace
dialog, you do not have to go back into the dialog to set up a new search and replace.
Transposing ranges
You can transpose selected cells in a spreadsheet. Transposing is a way of rotating the
cells in a spreadsheet, from horizontal to vertical, with the top row becoming the first
column; the second row, the second column; and so on.
Transposing cells in a spreadsheet can be useful when you are including data in a
document. For instance, what appears in rows of a spreadsheet might be more
appropriately displayed as columns in a report.
To transpose an area of the spreadsheet, select the range of cells you wish to transpose.
Then select Cut from the toolbar or the Edit menu, or by right clicking your mouse. You
can use the Copy command instead if you wish to keep the original.
Select the range in which you wish to put the transposed values, and then select the
Paste Special command from the Edit menu. In the “Paste Special” dialog, click on the
checkbox next to Transpose. Click on the Paste button and the spreadsheet will be
redrawn with the data transposed.
142 Spreadsheet
Transforming ranges
You can transform selected cells in a spreadsheet. Transforming is a way of adding,
subtracting, multiplying or dividing two ranges.
To transform an area of the spreadsheet - the target range- first type in and select the
range of cells you wish to use to effect the transformation. Then select Copy from the
toolbar (or the Edit menu, or by right clicking your mouse).
Next, select the target range and then select the Paste Special command from the Edit
menu (or by right clicking your mouse). In the Operation group box, click on the Add,
Subtract, Multiply or Divide button. Click on the Paste button and the spreadsheet will
be redrawn with the data transformed.
Example 1
The target range contains 1, 2, 3, 4, 5, which you want to multiply by 2. Enter 2 into a
spreadsheet cell and Copy this cell. Select the target range and then select Paste
Special. Select Multiply and then click on the Paste button. Each of the target cells will
be multiplied by 2 to give 2, 4, 6, 8, 10.
Example 2
The target range contains 25, 20, 15, 10, 5, which you want to divide by 5, 4, 3, 2, 1, the
transformation range. Type in and select the transformation range. Copy this range and
then select the target range. Select Paste Special and click on Divide. Click on the
Paste button. The values in the target range will be divided by the corresponding values
in the transformation range to give 5, 5, 5, 5, 5.
Page set-up
Whenever you open a new file in Spreadsheet, it is given a default set of margins. To
change these defaults for the current spreadsheet, select the Page Setup command from
the File menu. The “Page Setup” dialog box is displayed.
Here’s how the different Margin and settings affect your page:
143 Spreadsheet
As the diagram above shows, all the measurements are from the edge of the page.
The header and footer sit within the top and bottom margins respectively. So if your top
margin is too small, you won't see all your header text. To control the margins for header
and footer, select Header & Footer from the Format menu. Enter a value in the From
edge box in the header and footer tabs.
If you want to set new default margins for all subsequent spreadsheets then select
Options from the Tools menu and click on the Page Margins, Header and Footer tabs.
The new default settings will not affect existing spreadsheets or the current one if its
settings have already been altered.
Note: To change the units of measurement used, select the Options command from the
Tools menu and click on General. You have a choice between S.I. and Imperial units.
Headers and footers
You can add information, such as a spreadsheet title and page number, that will appear
at the top and bottom of every page when you print the spreadsheet. Text that appears at
the top of every page is called a header; text at the bottom is called a footer.
To print the header, you need to leave enough space between the top of the spreadsheet
and the top of the page so that the header text can fit into it, bearing in mind the fonts you
have used. The same applies to footers. The defaults Ability uses will fit most header and
footer definitions. You can fine-tune these dimensions in the "Header and Footer" dialog.
144 Spreadsheet
Adding a header and footer
To add a header and/or footer, select the Header & Footer command from the Format
menu. The “Header & Footer” dialog appears. To create a header click, on the Header
button in the dialog; to create a footer, click on the Footer button.
The “Header & Footer” dialog contains three boxes to set up the header and footer
information. You can type any text you like into these boxes. Text in the Left box will start
printing at the left margin, text in the Right box will end at the right margin, and text in the
Center box will appear in the middle.
Use the Font button to set the font for each individual header or footer area.
You can have Ability insert information automatically. Position the cursor in the box where
you want the text to appear and then:
Click on this button...
To...
Using this code...
Page Number
Insert the current page
number at print time.
&P
File
Insert the name of the
spreadsheet file.
&F
Time
Insert the time the
spreadsheet was printed.
&T
Date
Insert the date the
spreadsheet was printed.
&D
When you select one of these buttons, Ability inserts a code in the dialog box instead of
the actual text (since the text changes depending on the current time and date and the
number of pages and name of the spreadsheet).
You can delete the codes (or add them by typing them directly) in the same way as you
can edit any other text.
If you want to change the default margin between the top and bottom edges of the paper
and the header and footer respectively, then click on the From edge box, delete the
default setting and type in the new margin in each case as required. This will change the
settings for the current spreadsheet.
If you want to set a new default for all spreadsheets then select Options from the Tools
menu. Click on the Headers or Footers button in the "Options" dialog. Change the
default From Edge setting as required. Note that this changes the setting for all
subsequent spreadsheets but not for existing spreadsheets or the current one if it has
already been altered in the Headers & Footers dialog under the Format menu.
145 Spreadsheet
The First Page box tells Spreadsheet from which page it should begin printing the
headers and footers. The default is 1, which you should replace as required.
If you want to create a footer as well as a header, then click on the Footer button and
create the footer in the same way as you created the header, before selecting OK to save
the new settings.
Freezing sections of a spreadsheet
As you fill more and more rows of a spreadsheet, the top rows move up and out of view.
Therefore, if you've put titles in a row, they move up out of view too. Similarly if you've put
titles in a column, they move out of view as you fill more and more columns to the right.
You can use the Freeze command to freeze particular rows, columns and ranges. When
you freeze a spreadsheet, the frozen part remains visible on the screen as the rest of the
spreadsheet moves out of view.
To freeze a row or several rows:
1. Select the rows using the row bars to the left of the row.
2. Select the Freeze command from the Window menu.
The frozen rows will move to the top of the screen and stay visible no matter where you
are in the spreadsheet. You can freeze columns in the same way by first selecting the
columns you want to freeze.
To freeze rows and columns in one go, first select the intersection of the rows and
columns to be frozen. For example, suppose you want to freeze the first three rows and
columns A and B, follow these steps:
1. Select the range A1..B3.
2. Select the Freeze command from the Window menu.
Note that you can exclude rows and/or columns from those that are displayed by
excluding them from the selection. In the above example, if the range A2..B3 were
selected instead, row 1 would not be visible.
Also note that the effects of freeze will go through to print time as well - you can use it to
make sure each page has the same row and/or column repeated at the top or left side.
To turn off the freeze, select the Unfreeze command from the Window menu.
146 Spreadsheet
Splitting a spreadsheet
It is possible to split the spreadsheet screen into vertical or horizontal sections. These
sections are different views of the same spreadsheet and not separate spreadsheets.
The advantage of this is that when a spreadsheet contains a large amount of data, you
can view data that would normally be off-screen in one section, while working with the
data of your choice in another section.
To split the screen horizontally, depress and hold down the left mouse button over the
bar attached to the vertical scrollbar. A horizontal axis will be displayed. Move this to
where you want the screen to be split and release the mouse button.
To split the screen vertically, depress and hold down the left mouse button over the bar
attached to the horizontal scrollbar. A vertical axis will be displayed. Move this to where
you want the screen to be split and release the mouse button.
Both horizontal and vertical splits can be applied at the same time to the one
spreadsheet.
Scroll through the views as required, till you have located the data you want to remain
visible on screen while you are working. You can choose to work in any or all of the
sections, since anything you add, edit or delete in a particular section applies to the
whole spreadsheet.
To clear a horizontal or vertical split, just double-click on one or both of the axes as
appropriate.
You can also use the Split command from the Window menu to split the screen.
Printing
You can print the whole of the document you are working on, or only certain pages. You
can also print to a file rather than to paper (perhaps for taking to a professional print
bureau).
The following sections explain print set-up, print preview, and how to print a spreadsheet.
Print preview
Before starting to print, you might like to see how your document is going to look on
paper. To do this, click on the Print Preview button
the File menu.
on the toolbar or select it from
The display switches to print preview mode, in which the document is shown at a reduced
size to give you an overall view.
147 Spreadsheet
Print set-up
To choose which printer, paper size and orientation you want to use and which bin you
want the paper to feed from, select the Print Setup command from the File menu. The
“Print Setup” dialog box is displayed for you to select the relevant settings.
In addition, there are scaling and print-to-fit options available. These help you to control
the appearance of your spreadsheets when they are printed. Set up the scaling options in
the Scaling section as follows:
•
Select the Adjust to button to reduce or enlarge the printed spreadsheet by
percentage of the normal size. Set the percentage in the % normal size box by
either typing it directly or using the scroller.
•
Select the Fit to button to make the printed spreadsheet fit onto a specified number
of pages. Enter the required pages, by width and height, in the accompanying boxes
(or use the scrollers). Typically, if you want to fit the spreadsheet onto 1 page, leave
the boxes set at 1 for both width and height.
Click on OK once you have selected your print settings.
Printing the spreadsheet
To print the spreadsheet, click on the Print button
on the toolbar or select the Print
command from the File menu. The “Print” dialog box is displayed.
The active printer is displayed at the top of the dialog box. To change this, click on the
arrow at the right of the Name box and scroll through till you find the printer you want.
In the Print range group box, you can specify how much of the spreadsheet you want to
print:
All
Prints the entire spreadsheet.
Pages
Prints the range of pages you specify in the from and to boxes.
Selection
Prints the selected cells only.
Check the Print To file box to create a new file on disk, instead of sending the document
to the printer. You will be prompted to give the file a name.
Type the number of copies you require in the Number of copies box and leave the
Collate box checked if you want the pages to be printed in sequence (rather than all
page 1s, then all page 2s, and so on).
If you want to select further properties click on the Properties button. The properties are
printer dependent and therefore vary from printer to printer.
148 Spreadsheet
When all is set, click on the OK button and the printing process will commence. There will
be a pause while the information is sent to the printer, and then the physical printing will
begin. Ability will divide your spreadsheet into pages, left to right and top to bottom. If you
find, for example, that page 2 and 4 print out with a single column, and you really wanted
to fit the entire spreadsheet onto two pages, either reduce the width of one or more
columns or reduce the left and right margins (and then check with print preview).
Note: If you don’t want the grid to print out, select the Grid command from the View
menu to turn the grid off prior to printing.
Spell-checker and thesaurus
The Spell-checker and Thesaurus are both available from the Tools menu. They operate
in Spreadsheet in the same way as they do in Write. See Spell-checker and thesaurus in
Write on page 53 for more details.
To change the way spell-checker and thesaurus work, select the Options command from
the Tools menu and then select Spelling & Thesaurus.
Click on the checkbox next to Always suggest to ensure that the spell-checker always
suggests alternative spellings for words it does not recognize.
Click on the checkbox next to Use only main dictionary if you do not want the spellchecker to take account of any words that you might have previously added to the
dictionary yourself. You will usually want to leave this box unchecked. The main
dictionary is the original dictionary that is supplied with Ability.
The User Dictionary contains any words you might have added and is kept separate
from the main dictionary. This can be edited by clicking on the button to the right of the
box and then opening up the file from the Open dialog that appears.
Language is the form of English used in the dictionary i.e. American or British English.
You can choose to have automatic spell checking by clicking on the Auto recognize
spell errors box. This works as you type and immediately tells you if the dictionary does
not recognize a word, by showing the word in the color you have chosen from the Spell
error text color box.
Autospell
Autospell is a quick way of automatically checking a spreadsheet document for spelling
mistakes, as you work, and correcting these on the spot.
To activate Autospell right click on the box second from the right on the status bar.
Clicking on Auto Recognize will cause Ability to display in red any words that it does not
recognize. To add an unrecognized word to the User Dictionary or to examine suggested
corrections, you should first select the cell containing the word and then right click on the
149 Spreadsheet
Autospell box again. The Add option adds the word to the dictionary. If Ability can find
any suggestions, these will be displayed at the top of the Autospell menu. Click on one
of these if you want it to replace the word in red. Auto Recognize will stay switched on
until you switch it off.
You can also check for spelling mistakes by using the Spelling option. This goes through
your document searching for errors and brings up a dialog whenever an error is found.
Here you are able to change or ignore the word or add it to the dictionary. Spelling
operates only when you select it and is closed down when you exit the dialog.
Default settings
Whenever a new spreadsheet is created, certain defaults are applied. For example, the
font might be 9pt Arial and the background color white. Although you can always change
these for individual spreadsheets, it's useful to be able to set them for all new
spreadsheets as well.
Select the Options command from the Tools menu. The “Options” dialog box is
displayed. In most cases, each tab of this dialog works in a similar way to the equivalent
command from the Format menu - but as well as changing the current spreadsheet, the
global defaults for all new spreadsheets are set.
You can read about the available options and how to set them in the following sections.
•
General − spreadsheet size, units of measurement, trailing/leading formats (see
General options on page 89)
•
Font − fonts and styles (see Using the menus to select cell font and style on page
104)
•
Color (see Selecting the background color on page 111)
•
Header & Footer (see Adding a header and footer on page 144)
•
Page Margins (see Page setup on page 72)
•
Spelling & Thesaurus (see Spell checker and thesaurus on page 53)
•
Custom Lists (see Custom lists on page 150)
General options
To modify the General page of the Options tab, select the Options command from the
Tools menu and then select General.
Set any of the following as defaults for all new spreadsheets (as well as the current one):
150 Spreadsheet
• Spreadsheet size (the maximum setting is 256 columns and 65536 rows)
•
Column width and row height
•
The list of leading and trailing characters e.g. currency symbols
•
Zoom, view grid and view page breaks
•
Unit of measurement, Autocalc and Undo
Custom lists
To modify the Custom Lists page of the Options tab, select the Options command from
the Tools menu and then select Custom Lists.
Ordered lists are, typically, days of the week or months, and are automatically filled in on
drag-copy of a cell containing a member item. For example, enter "Jan" in cell A1 and
use drag-copy to fill A2 to A12 with the remaining months.
•
In the Custom Lists box, select an ordered list for editing or removal. Use NEW LIST
to create new custom lists.
•
The List Entries box displays individual items from the current ordered list. You can
edit the items in this list, or add new ones (use Ctrl-Enter to create new line). To save
the modifications, click the Modify button.
•
To create a new list, make sure NEW LIST is selected in custom lists, add some
items in List Entries and click the Add button.
•
To remove a list select it in the Custom Lists box and click on the Remove button.
151 Chart
Chart
Chart lets you plot a series of numbers from a spreadsheet. There is a wide range of
chart styles to choose from; multiple series can be plotted and 3D views created.
The resulting chart can be saved in a separate window, attached to the spreadsheet, or
inserted into the middle of a spreadsheet. A single spreadsheet can contain, or have
attached, many different charts.
You can insert charts into Write documents and, since Spreadsheet can display
information from database tables, chart information from databases.
Creating a chart
To see how to create a chart, look at the following example. The data shows the output of
raw materials over four months and includes both row and column titles.
To create a chart from this data:
1. Select the range A1..E4.
2. Select Chart from the Insert menu.
3. Choose On This View to insert the chart into the current spreadsheet or As New
View to create a new window that is attached to the spreadsheet (see Attached
charts on page 157 for more details).
4. Follow the steps in the chart wizard.
The chart wizard will prompt you for the following:
•
Data − in this case, A1..E4 - does the series run down with the data points across, or
vice versa? (see Data range on page 155)
•
Style − choose from bar chart, pie, x/y plot, and so on. (see Style on page 152)
•
Titles – what title text to display
•
Legend – for multiple series, display a legend or not
152 Chart
•
Series – series attributes
Once these options are created, you can modify any of them using the Chart toolbar and
Chart dialog, and further modify the way the axes are drawn and how the background of
the chart is drawn.
Style
To change the style of chart, whether you want to display a pie, bar, or other type of
chart, right-click over a chart and select the Style command from the menu.
•
Category. Select a chart category - for a brief description of each chart type, see
Gallery of chart styles on page 152.
•
Style. Pick from the styles offered for a particular category.
•
Border and Shadow. Choose from a range of border styles – none, single line, with
or without shadow effects. Note that the border applies to the chart and not the
background, which can be set separately.
•
Fill style – color and gradient fill for the body of the chart.
•
Font – used for drawing the values on the axis.
Gallery of chart styles
The different chart styles are arranged under these categories:
Column
Plots a column for each data point in a series.
Bar
Plots a horizontal bar for each data point in a series.
Line
Plots a point for each data point in a series and connects the
series with a line.
Pie
Plots the percentage values for the data points in a series, using
a pie chart. If there is more than one series, only the first series
is charted.
XY (Scatter)
Plots a set of points using a column (or row) of values as the Xvalues and the values from another column (or row) as the Yvalues. See More on scatter charts on page 153 .
Area
Joins the data points in a series with a line and shades the area
under this line.
153 Chart
Stock
Plots the extent of the range of values in a series, where the
values plotted are the highest, the lowest and the closing value
and opening values. See More on stock charts on page 154 .
Strata
Cumulative bar charts
Radar
Plots a point for each data point in a series along an edge
terminating at a pole, where each data point in the series has its
own edge.
Bubble
Plots points similar to XY (Scatter) charts. Bubble charts take a
third column that plots the size (by area or radius). To create a
Bubble chart, you'll need three columns of data.
Vector
Plots points similar to XY (Scatter) charts. Takes two further,
relative, points and plots a line showing scale and direction. To
create a vector chart, you’ll need four columns of data.
Scatter charts: example
The following is an example of a scatter chart.
You wish to chart the performance over 2 hours of two backup systems you have been
testing, where the results are as they appear in this table:
Time
(Mins)
Backup 1 (%)
Backup 2 (%)
0
0
0
30
23
15
60
59
34
90
84
59
120
98
74
Scatter can be used to plot the backup performance for both systems, measured against
the Y-axis, against the time, measured against the X-axis.
154 Chart
Hi-Low-Open-Close charts: example
Hi-Low-Open-Close charts are very similar to Candle charts. Both take four points for a
data series a high, low, opening and closing value. The difference is that a Candle chart
displays the open and close values as a rectangle and the High-Low-Open-Close as a
step.
The following is an example of a Candle chart.
Assume a record of the temperature in central London, between 12 a.m. and 3 p.m., on
July 31st, over a period of 5 years can be tabulated as follows:
Date
High
Low
Open
Close
31/7/93
29
26
28
26
31/7/94
33
30
31
32
31/7/95
29
26
27
29
31/7/96
35
31
34
33
31/7/97
33
24
30
30
The vertical lines in the chart show the extent of the High-Low difference; the horizontal
bars show the extent of the Open-Close difference:
155 Chart
Note that if the Close value is less than the Open value, the Open-Close difference is
shown in dark blue. If they are equal, a line is drawn.
Hi-Low-Close charts are especially useful for charting the highs and lows of daily share
prices, as well as showing their closing value.
Note that in the above example, Chart assumes that the date column contains data, since
dates are ultimately represented as numbers by Ability. Therefore make sure you switch
First Column (or First Row where appropriate) to Labels. See Vertical and horizontal
series on page 156 for more details.
Data range
To change the data range Chart is to plot, or to alter the way the series will run, right-click
over a chart and select Data Range from the menu. Set any of the following:
•
Data. This is the range, including series and data point titles. Usually this will be done
by first selecting the data before entering the chart wizard. Suppose instead that you
need to exclude certain series. For example, in the sheet below, you want only to plot
the results for Cobalt. In Data, separate the ranges using commas as follows:
A1..E1, A3..E3
In a similar way, you can plot discontinuous data by entering a series of values like:
B2, D3, E3, E4
•
Series run in. Treat each data column (when set to Columns) or data row (when set
to Rows) as a series of values of a variable. See Vertical and horizontal series on
page 156 for more details.
•
First Column contains. In the example below, the first column of the data range
(A1..E4) obviously contains labels rather than data. If the first column had contained
numbers that you wanted treated as labels rather than as data, this option would
need to be set to Labels.
156 Chart
•
First Row contains. Determine whether the first row contains labels or data in the
same way as for First Column.
Vertical and horizontal series
Using the following example data:
with Series Run In set at Rows, there are three series, namely Iron, Cobalt and Copper,
each of which has a set of associated measurements or data points. The data points are
the measurements for April, May, June and July. The different series are assigned
different colors, which are maintained for each data point that is plotted throughout the
chart. The data points are plotted measured against the scale along the left-hand axis
(the Y-axis):
To plot the chart with the months as series and the values for the metals as the data
points, switch the Series Run In setting to Columns. There will now be four series,
namely April, May, June and July, each with three associated data points:
157 Chart
Editing a chart
Use the Chart toolbar to edit your chart. The toolbar becomes visible whenever you
select a chart (i.e. click on it).
Use the toolbar to arrange the elements (legends, titles, chart area) within the chart.
Select the element you want to resize or reposition from the chart drop-down box and
drag and drop the element anywhere on the chart or resize using the handles.
You can go to any of the pages on the Chart dialog directly – right-click over the chart
and select any of the menu options to open the dialog at the appropriate page.
Attached charts
When creating a chart, you are given the choice whether to insert the chart into the
current spreadsheet window (On This View) or into another window that is connected to
the current spreadsheet (As New View) - see Creating a chart on page 151.
If you choose On This View, the chart will be embedded in the current spreadsheet and
will remain visible in the spreadsheet as you work. You can resize and move an
embedded chart (see Resizing and moving an embedded chart on page 158).
If you choose As New View, the chart will be occupy a new worksheet.
158 Chart
Resizing and moving an embedded chart
Once a chart is embedded in a spreadsheet you can edit, resize or move it.
Move the chart by holding down the left-hand mouse button when the cross cursor is
showing over the body of the chart. A chart outline will be displayed. Drag this to where
you want the chart to appear and release the mouse button. The chart will be displayed in
its new position.
Resize the chart by clicking on it, pointing at one of the handles and holding down the
left-hand mouse button when the cursor changes to a double-headed arrow. An up-down
arrow is displayed along the top and bottom borders; a left-right arrow along the left and
right borders; and a diagonal arrow at the corners. You can use these to increase or
decrease the height, width, or height and width together of the chart. Drag the border till it
is the size you require and then release the mouse button. The chart will be displayed
with its new dimensions.
Deleting a chart from a spreadsheet
To delete an embedded chart from a spreadsheet, click on the chart once to select it and
then press the Del key.
To delete a separate chart sheet, right-click over the chart name (on the worksheet
selector at the bottom of the screen) and select Delete.
Printing a chart
Printing is simply a case of printing the worksheet containing the chart. Select the Print
button
from the toolbar or the Print command from the File menu.
159 Database
Database
A database is a collection of information or data. At its simplest, a database can be a list
of names and phone numbers, forming a personal phone book. Ability stores such lists in
tables.
Tables can be:
•
combined to form relations
•
arranged in various ways to create queries
Queries are themselves formed from query components:
•
Sort Orders
•
Column Views
•
Filters
In turn, you can view a table, relation or query in one of three ways:
•
Grid view
•
Form view
•
Report view
A single database then, is a collection of one or more tables and all the associated
queries and relations, which can be viewed in grids, forms, and reports. The Ability
database provides an easy environment to manage all your data requirements.
The following sections explain the meaning of basic database terminology in greater
depth.
What is a table?
Tables are the fundamental database objects. It is here that your data is stored.
A table is arranged in rows and columns.
A table may be used, for instance, to store the names and associated phone numbers
from your personal phone book. Each row will contain all the data for one entry in your
phone book, and is called a record. Each column will contain one item of data for all
entries in your phone book, and is called a field.
Since tables are the fundamental database objects, deciding what tables you need is
always the first step in designing a database.
160 Database
Tables are used to contain information and data that can be structured according to a
similar format. Typical examples of tables are:
•
mailing lists
•
inventory lists
•
customer lists
•
product lists
•
medical records
•
league tables
For more information on tables, see Creating fields in a database on page 189.
What is a relation?
Tables may be related to one another - an invoice table naturally combines information
from a customer table and a product table. In this case, the invoice table is called a
relation. You can create a relation from selected fields from related tables. The relation
then becomes a table in its own right, albeit dependent on the tables from which it is
formed.
For more information on relations, see Creating a relation on page 229.
What is a query component?
You can arrange the data from a table in a number of ways:
• Sort Orders - sort the table by one or more columns
• Column Views - choose the columns to display and their display order
• Filters - define conditions to include only specified records
Ability calls these different arrangements of your data query components. You can use
the query components individually or collectively in queries.
For more information on query components, see Query components on page 164.
What is a query?
A query is a table that has been constructed out of one or more query components when
these have been applied to an underlying table. Queries enable you to combine various
sort orders, column views and filters, which can all be applied at once to a specified table.
For more information on queries, see Queries on page 224.
161 Database
What is a table view?
Whether you’re working with a table or query or relation, you can choose between three
different on-screen views:
•
grid view - displays the table in a grid with rows and columns
•
form view - each record occupies the entire window for easy editing and allows for
custom layout of the screen
•
report view - the data is arranged in a format suitable for printing, and also allows for
a custom layout.
Grid view can be regarded as the natural way to view a table, since we usually think of
tables as being arranged into rows and columns. Accordingly the term table will often be
used to refer to a table when in it is in grid view. Nevertheless the table itself is distinct
from any of the ways of viewing it.
For more information on the different ways of viewing your tables, see
Grid view on page 197
Form view on page 232
Reporting on page 250
Starting Database
To start Database, do one of the following:
• Click on the Start button, select Programs, Ability Office and then Ability Database.
• Click on the Database button on the toolbar of any open Ability application.
• Click on Database in the Ability Launcher. For further details, see The Ability
Launcher on page 30.
The Ability Database window is opened.
Opening a database
To open a database, follow these steps:
1. Click the Open button
menu).
on the toolbar (or select Open Database from the File
2. Make sure Files of type shows Ability Database Files (*.adb)
162 Database
3. Use the Look in box to locate the folder in which the database is contained. Once
the folder has appeared in the main box, open it by double clicking (or clicking on
Open).
4. Open the database itself by double clicking on the database name (or clicking on
Open).
5. Ability will open the database and display the Database Manager.
Database Manager
Whenever you open a database, the database is displayed in Database Manager.
Database Manager is where you manage all the objects in your database, that is to say,
all the tables, relations, queries, forms and reports that make up the database. You can
use it to create, delete, restructure and open all of these database objects.
In addition, you can import (see Importing tables on page 266) and export tables (see
Exporting tables on page 266) while in Database Manager.
To view the Database Manager, should some other window obscure it, select Database
Manager from the View menu.
Database Manager lists all the database objects in a tree structure - individual branches
can be opened and closed, revealing more detail as required.
163 Database
To open a branch, click on the ‘+’ sign before the database object name. ‘+’ will change
to ‘-‘, and back again with a further click. Here’s an expanded view of a sample database:
Closing a database
To close a database you should first close any tables you are working in. This will return
you to Database Manager. Close the database by selecting Close Database from the
File menu. Once the database is closed the command will be grayed out.
Some commands require you to close a database before they will work, for instance,
Repair Database.
You can close the Database Manager screen by clicking on the button at the top left of
the Database Manager and selecting Close from the menu. This merely closes the
Database Manager, not the database itself. To display the Database Manager again,
select Database Manager from the View menu.
164 Database
Query components
A query component is a particular arrangement that you apply to a table. The query
components are of the following type:
•
sort order
•
column view
•
filter
They are always attached to a table and are listed beneath each table in Database
Manager. Using the query toolbar, you can always choose combinations of query
components wherever you make use of the table - this could be in a form or report, or in
Write and Spreadsheet.
Relations can have associated query components in the same way.
Imagine a Wineshop database that contains several tables. Each table can have several
named entries underneath - the query components. These are grouped according to
whether they are Column Views, Sort Orders or Filters. For example, an Employee
table might show a Column View - “Name & Address”, two Sort Orders - “By Age” and
“By Name”, and a Filter - “UK Employees”. These are all different ways of viewing the
data contained in the Employee table.
You can use combinations of these query components to view only certain columns from
selected records of a table, and in a particular order. For example, you can filter the
Employee table using "UK Employees", viewing only the columns defined by "Name &
Address", in an order determined by "By Name". You can also save combinations of
query components as a named Query, which can then be applied whenever you like (see
Queries on page 224).
See the following sections:
Rearranging columns using a columns selection on page 212
Hiding and showing columns using a columns selection on page 214
Sorting using a sort order on page 216
Filtering using a named filter on page 219
165 Database
Opening a table
To open a table, do one of the following in Database Manager:
• Double-click the table name to make all rows and columns available
• Double-click a named query component belonging to a table to open the table and
apply the selected sort order, column view or filter
• Right click on the table name or named query component belonging to the table and
select Open.
Moving around a table
There are four ways to move around the table:
• Use the mouse to click into any visible field directly.
• Use the horizontal and vertical scrollbars - with them you can reveal any part of the
table, but the cursor won’t reposition until you click into a field.
• Use the Record toolbar above the top of the table window. There are buttons for
, last
, next
and previous
moving to the first
options are available from the Record menu.
records. The same
• Use the Record scroll bar at the bottom left of the table window.
• Use the keyboard as follows:
Key
Description
up, down, left &
right arrow keys
The arrow keys move the cursor one field at a time in
the direction of the arrow
home
Edit the current field and move to the beginning of the
field.
end
Edit the current field and move to the end of the field.
ctrl + left
Moves the cursor to the first field in the current record.
ctrl + right
Moves the cursor to the last field in the current record.
ctrl + up
Moves the cursor to the first record in the current field.
ctrl + down
Moves the cursor to the last record in the current field.
ctrl + home
Moves the cursor to the first record and field.
ctrl + end
Moves the cursor to the last record and field.
tab
Moves the cursor one field to the right.
166 Database
shift + tab
Moves the cursor one field to the left.
Creating a new database
To create a new database:
1. Select New Database from the File menu or click on the New button
toolbar.
on the
2. The "Create a new database" dialog is displayed. The Save as type box should
automatically be set at Ability Database Files (*.adb). In the File name box, type
the name of the new database. Don’t worry about a file extension − this will
automatically be added by Ability.
3. Before clicking the Save button, select the folder you want to save to in the Save in
box.
After saving, the dialog is closed and the Database Manager (see page 162) window is
displayed. A database tree is created for the new database and you are now free to
create the tables, queries, relations, reports and forms that are to go into it.
Designing a new table
To create a new table, do one of the following:
•
Right-click anywhere in the Database Manager window (see Database Manager on
page 162) and select New and then Table from the displayed menu.
•
Select New and then Table from the File menu.
The "New Table" dialog is displayed. This contains a Table Wizard option and a Blank
Table option. The Table Wizard enables you to choose pre-designed fields from a
selection of tables that come as part of the Ability system (the system database is called
abdata.adb and is the equivalent of a database template). See Creating fields in a
database using Table Wizard on page 190 for more information on using Table Wizard.
•
Click on the Blank Table button. The “New table” design window is displayed. The
design window is where you create the structure of your table. This is the framework
in which you will store your data, so it is worth spending time at this stage planning
how you will use the table and deciding what fields you will need (see Planning field
details on page 167).
•
Each table will contain one or more fields. For each field you need to assign a name
in Name (see Field names on page 168) and a data type in Type (see Field data
types on page 169), these being compulsory.
•
167 Database
In addition, each field can be given an optional summary description in Description.
After setting these you can format a field to give it a caption (see Captions on page 64)
and a default value, these being optional. The fields can also be formatted for such
properties as width, validation, justification, number type, etc. depending on the data type
of the field.
For full details of how to create the fields for a new table, see Creating fields in a
database on page 189.
Planning field details
• It is very important that you plan your table design in accordance with the table’s
intended purpose. This sounds too obvious – and it is, which is why it is so often
overlooked. Think in terms of the information you will want to be able to extract from
the table in a week's time, a month's time, and a year's time.
• If it is likely that you will not be the only user of the table, talk to others who may be
expected to produce useful, efficient work with your design. They may operate in
slightly different ways to you and their experience will be a useful supplement to your
own. Basically, a clear idea of the potential functions of your database should guide
you in its design.
• It is recommended that you sketch out the design for your table on paper, in row and
column layout, with field names at the head of each column. Pencil in a few rows of
data to confirm that you have made allowance for all the relevant data items you
need. If not, just add some more columns and field names in a second sketch, and
repeat the process until you have established fields for all required data items.
• Consider also, at this point, the order of the columns. If you have a large number of
fields, it is usually better to keep all the most commonly accessed columns to the left
of the layout. In this way you will minimize the need to scroll the table window left and
right to enter, edit or view your most important data. You will however be using Query
files to see many different views of your data, each with only the columns you want,
arranged in the order you require for a particular purpose.
• Once you are satisfied with the overall layout of your table, and have allocated
meaningful field names to your columns, you need to determine the properties of
each field. Typically these will include the type of data that a field is to contain, such
as text or numbers; whether the records in your table are to contain any default data;
the width of the fields; and so on.
See Creating fields in a database on page 189.
168 Database
Field names
Each item of information or data you wish to store, manipulate or extract using Ability,
must be uniquely accessible by the entire Ability system. Ability does this by calling on
the address of the data, whose location is identified by the database title, table name,
field name and record number.
You specify the field name in the Name cell. It is usually helpful if it is easily identifiable
by you as well, a year or two after you created the table, so make the name relatively
descriptive. For example:
first_name
last_name
The underscore character is often used as a link between words. These examples could
be reduced in length without losing any clarity. For example:
FirstName and LastName
or
fname and lname
This will save typing effort if later on you use these field names in computed fields or in
links with other Ability applications.
Note: The following rules should be observed with regard to field names. They can be
up to 64 characters long, and contain any mixture of letters, numbers and underscores.
They cannot contain spaces, periods, commas, colons, brackets, slashes or other
punctuation marks, nor can they contain hyphens, dashes or ASCII characters. The
names of pre-existing functions, such as “Sum” or “Title”, are also inadmissible. The
following are all legitimate field names:
bank_account
BankAccount
bankaccount
bank_acc
bank_acc_1
BankAcc1
For more details of how to create fields in a database, see Creating fields in a database
on page 189.
169 Database
Data types
Ability understands many types of information:
• textual
• numeric
• date
• time
In addition to these basic data types, Ability can also work with:
• Large blocks of text: comments and memorandums
• Automatically incremented numbers: invoice numbering, membership registration.
• Automatically calculated formulas: cost equals unit_price multiplied by quantity.
• Predetermined lists of valid entries: {yes | no | pass}, {Green | Blue | Brown}
• Predetermined logical entries: {yes | no}, {true | false}, {1 | 0}
• OLE objects: pictures, graphics files, other file formats
Ability recognizes that all of these different types of information have unique requirements
for data entry, storage and formatting. When you create a field in the design window, you
must choose one of the ten standard data types, and appropriate formatting for the type
of field (see step 3 of Creating fields in a database on page 189). As the most common
type of field, the Character data type is the default.
The following sections explain the various field data types (Character, Numeric,
Date/Time, Memo, Incremental, Calculated, Logical, Enumerated, OLE) and their
associated formatting properties.
Character data type
A field with Character data type (see Data types on page 169) can contain any characters
– letters, numerals or symbols. You can enter up to 255 characters, which includes
multiple sentences, but only one paragraph. If, during data entry or when editing, the
amount of text you type into a character field exceeds the column width of the display
column, Ability scrolls the field box to show the text as you type it. You then need to
adjust the width of the field by dragging the right edge of the bar at the top of the column
(hold down the left-hand mouse button to do this).
170 Database
The formatting properties available on the General page in the Format dialog are:
• Width (this is the number of characters allowed in the field, not the column width, up
to a maximum of 255 characters - the default is 50) – see Character field size on page
170
• Initial Value (enter a default value that will automatically appear in this field every
time a new record is created, unless another value is entered instead of it − see Initial
value on page 189)
• Caption (enter a caption to replace the field name above the column in Table View −
see Captions on page 64)
• Validation Rule (set a rule to validate possible data entries − see Validation rule on
page 186)
• Validation Text (write a display message for cases of invalid data − see Validation
text on page 187)
• Required (when checked a value is required in field − see Required property on page
188)
• Allow Zero Length (allows zero-length string in field − see Allow zero-length property
on page 188)
• Index (choose from Primary Key, Indexed, No Index & Indexed (Unique) − see
Indexes and primary keys on page 191)
The formatting properties available on the Format page are:
• Case (Mixed, Upper & Lower - the default is Mixed)
• Mask (various options that control the pattern for certain types of data, such as
telephone numbers and zip (post-) codes). See Masks in database fields on page
171.
Character field size
If you examine any initial paper sketch of the design of your table, produced in the
planning stage, you will notice how some columns have plenty of white space and others
are densely packed. Real data rarely conforms to an idealized table with evenly sized
columns. Those densely packed columns are probably text fields. It is a good design
principle to decide, for each separate text field, the number of characters required to
accommodate the largest individual item of information likely to be entered. Write this
figure down for each of the text fields. The maximum size of a standard text field is 255
characters. For larger quantities of textual information you may need to use a memo. See
Memo on page 177.
171 Database
The other non-character data items in your table design will not require a specific field
size to be entered when you create the table. Ability has built-in defaults to make table
creation as easy as possible for you.
Masks in database fields
A mask is a field formatting property that determines the pattern of data entered into a
field and controls the type of data allowed. A typical example is an invoice number, which
is usually a combination of letters and numbers in a set order. An appropriate mask helps
data in-putters follow the convention defined by the mask. Masks are used in conjunction
with the Character field type (see Character on page 169).
There are three default masks provided with Ability. These are:
•
###-##-#### (Social Security Number) e.g. 456-23-9847
•
(###) ###-#### [####] (Phone) e.g. (447) 756-1252 [4589]
•
#####-#### (Zip Code) e.g. 67845-6564
To choose one of these when formatting the field (see step 3 of Creating fields in a
database on page 189), click on the arrow at the side of the Mask box on the Format
page of the “Format Field” dialog.
You can, however, create your own masks, using the following codes to determine
whether to allow numbers, letters, other characters, or combinations of any of these:
•
# (number)
•
& (all standard keyboard characters)
•
A (numbers and upper and lower case letters)
•
? (lower or upper case letter)
•
U (upper case letter)
•
L (lower case letter)
All of these can be left blank when filling in the mask. The mask can be formatted to
contain, between the codes, any characters that are not in the above list, for example, . ,
; : ( ) [ ] { } / \ < > a b c 1 2 3 and all the other characters on your keyboard except for #,
&, A, ?, U, L.
Example
You can create a mask that will take invoice numbers of this form:
172 Database
(ABC)-[12345 a]
Type the following in the Mask box of the “Format Field” dialog when formatting the field
(see step 3 of Creating fields in a database on page 189):
(UUU)-[##### L]
Note that the two types of bracket, the hyphen, and the space, constitute the basic
structure of the mask. U will accept upper case letters, # numbers, and L lower case
letters. If you try to enter data not allowed by the mask you will not be allowed to proceed.
Numeric data type
A field with Numeric data type (see Data types on page 169) can contain a variety of
numbers, including ones with decimal places.
The formatting properties available on the General page are:
• Width (choose from Byte, Integer, Long, Currency, Single, Double − the default is
Long − see Width properties in numeric fields on page 175)
• Initial Value (enter a default value that will automatically appear in this field every
time a new record is created, unless another value is entered instead of it − Initial
value on page 189)
• Caption (enter a caption to replace the field name above the column in Table View −
see Captions on page 64)
• Validation Rule (set a rule to validate possible data entries − see Validation rule on
page 186)
• Validation Text (write a display message for cases of invalid data − see Validation
text on page 187)
• Required (when checked a value is required in field − see Required property on page
188)
• Index (choose from Primary Key, Indexed, No Index & Indexed (Unique) − see
Indexes and primary keys on page 191)
The formatting properties available on the Format page are specifically connected with
the various types of number − see Number formats in database on page 173.
173 Database
Number formats in database
Whenever you set a numeric data type for a field in a table, you will need to select which
number format to use. Number formats are set on the Format page of the “Format field”
dialog (see − Numeric on page 172).
There are five number types: Number, Currency, Percent, Fraction, and Scientific.
Each of these has an associated set of options, which are displayed and can be set when
you click on the relevant number type.
For information on the each of the number types and their associated options, see the
following:
Number format on page 173
Currency format on page 174
Percentage format on page 174
Fraction format on page 174
Scientific format on page 175
Number format
1. Select Number from the list.
2. In the Decimal Places box, specify the precision of the number. You can have a
minimum of 0 and a maximum of 15.
3. Select the Thousands with Commas checkbox for comma formatted numbers i.e.
1,345,622 rather than 1345622.
4. Select the Negatives in Brackets checkbox to enclose negative numbers in brackets
i.e. (123456) rather than -123456.
5. Select the Negative in Red checkbox to display negative numbers in red font.
6. In the Trail/Lead String option you can choose to have either trailing or leading
characters. Enter your text in the text box or choose from the existing group ($, £,
DM, cm, kg, etc.). You can create your own number formats, including alternative
currency formats. Here are some examples:
1.2 $bn
FFr 23.56
174 Database
DMarks 2.36
7. Check that the options you have chosen are correct by glancing at the Preview box
and then click on OK.
Currency format
1. Select Currency from the list. This will prefix the number with the currency symbol.
2. In the Decimal Places box, specify the precision of the number. You can have a
minimum of 0 and a maximum of 15.
3. Select the Thousands with Commas checkbox for comma formatted numbers i.e.
$1,345,622 rather than $1345622.
4. Select the Negatives in Brackets checkbox to enclose negative numbers in brackets
i.e. ($123456) rather than -$123456.
5. Select the Negative in Red checkbox to display negative numbers in red font.
Note: The currency symbol used by Ability is taken from the Regional settings in the
Windows Control Panel.
Percentage format
1. Select Percent from the list to display numbers as percentages e.g. 1 as 100%, 0.3
as 30%.
2. In the Decimal Places box, specify the precision of the number. You can have a
minimum of 0 and a maximum of 15.
3. Select the Thousands with Commas checkbox for comma formatted numbers i.e.
1,345,622% rather than 1345622%.
4. Select the Negatives in Brackets checkbox to enclose negative numbers in brackets
i.e. (123456) rather than -123456.
5. Select the Negatives in Red checkbox to display negative numbers in red font.
Fraction format
1. Select Fraction from the list to display numbers as fractions e.g. 0.5 as ½, 2.5 as 2½.
2. In the Display as box, specify the precision of the fraction. You can choose from
Auto, which will display the most accurate fraction possible in Ability, to 4ths, that is
the number will be rounded to the nearest ¼ fraction.
175 Database
3. Select the Thousands with Commas checkbox for comma formatted numbers i.e.
1,345,622 rather than 1345622.
4. Select the Negatives in Brackets checkbox to enclose negative numbers in brackets
i.e. (2½) rather than -2½.
5. Select the Negatives in Red checkbox to display negative numbers in red font.
Note that with the Fraction format you should set the width to either Single, Double or
Currency to take account of the fractional part of a number i.e. the digits to the right of
the decimal point. Fractions cannot be expressed in a field with Long width, since this
can only contain numbers without a decimal part.
Scientific format
1. Select Scientific from the list to display numbers in scientific form e.g. 2.5E+003
rather than 2500.
2. In the Decimal Places box specify the precision of the number. You can have a
minimum of 0 and a maximum of 15.
Width properties in numeric fields
The Width formatting option for numeric fields (see Numeric data type on page 172)
determines how large a number the field will accept. The options are as follows:
Byte
The field will accept numbers from 0 to 255
Integer
The field will accept numbers from -32,768 to 32,767
Long
The field will accept numbers from -2,147,483,648 to 2,147,483,647
Currency
The field will accept standard currency formats, including decimal places
and currency symbols
Single
The field will accept negative numbers from -3.402823E38 to -1.401298E45 and positive numbers from 1.401298E-45 to 3.402823E38
Double
The field will accept negative numbers from -1.79769313486231E308 to
-4.94065645841247E-324 and positive numbers from
1.79769313486231E308 to 4.94065645841247E-324
Note that Double is the default width for all new Numeric fields. If you wish to enter
numbers that that refer to another table's primary key where the primary key is an
Incremental field, use the Long format.
176 Database
Date/Time data type
A field with Date/Time data type (see Data types on page 169) can only contain valid
dates.
The formatting properties available on the General page are:
•
Initial Value (enter a default value that will automatically appear in this field every
time a new record is created, unless another value is entered instead of it − Initial
value on page 189)
•
Caption (enter a caption to replace the field name above the column in Table View −
see Captions on page 64)
•
Validation Rule (set a rule to validate possible data entries − see Validation rule on
page 186)
•
Validation Text (write a display message for cases of invalid data − see Validation
text on page 187)
•
Required (when checked a value is required in field − see Required property on
page 188)
•
Index (choose from Primary Key, Indexed, No Index & Indexed (Unique) − see
Indexes and primary keys on page 191)
The formatting properties available on the Format page are:
•
Year (choose from Long Form e.g. 1999, Short Form e.g. 99, & None)
•
Month (choose from Long Name e.g. January, Short Name e.g. Jan, & Digits e.g. 01)
•
Order (choose from Month/Day e.g. Jan/12, & Day/Month e.g. 12/Jan)
•
Separator (choose from \ - . / or blank e.g. 12-05-99, 12.05.99, 12/05/99, 12 05 99,
etc.)
•
Add Time (click on the check box to add time to the date: select 0..12 to display
AM/PM rather than the 24-hour clock e.g. 03:45 PM rather than15:45, and Seconds
to display seconds e.g. 15:45:34)
If you only want to display the time, select Time rather than Date in the left-hand box and
proceed as shown above.
177 Database
Date/Time format
Fields that contain dates or times can be formatted to control their appearance. Although
dates and times are usually displayed in fields that have the Date/Time data type (see
Date/Time data type on page 176), they can also be the result of calculations in fields
with the Calculated data type (see Calculated data type on page 182). Dates and times
are formatted in a similar way in any field that can contain them.
To format the Date:
1. Select the Year format by choosing from Long Form e.g. 1999, Short Form e.g. 99, &
None.
2. Select the Month format by choosing from Long Name e.g. January, Short Name e.g.
Jan, & Digits e.g. 01.
3. Select the Order by choosing from Month/Day e.g. Jan/12, & Day/Month e.g. 12/Jan.
4. Select the Separator type by choosing from \ - . / or blank e.g. 12-05-99, 12.05.99,
12/05/99, 12 05 99, etc.
To format the Time:
1. Select the Add Time checkbox to add time to the date.
2. Select 0..12 to display AM/PM rather than the 24-hour clock e.g. 03:45 PM rather
than15:45.
3. Select Seconds to display seconds as well as hours and minutes e.g. 15:45:34.
If you only want to display the time, select Time rather than Date in the left-hand box and
proceed as shown above.
Memo data type
A memo field is similar to a character field, only much larger and can contain multiple
paragraphs.
The formatting properties available on the General page are:
•
Initial Value (enter a default value that will automatically appear in this field every
time a new record is created, unless another value is entered instead of it − Initial
value on page 189)
•
Caption (enter a caption to replace the field name above the column in Table View −
see Captions on page 64)
178 Database
•
Validation Rule (set a rule to validate possible data entries − see Validation rule on
page 186)
•
Validation Text (write a display message for cases of invalid data − see Validation
text on page 187)
•
Allow Zero Length (allows zero-length string in field − see Allow zero-length
property on page 188)
•
Required (when checked a value is required in field − see Required property on
page 188)
The formatting properties available on the Format page are:
•
Memo Type (Plain or Rich Text: Rich text allows formatting of individual portions of
text in bold, italics, etc., whereas Plain text only allows formatting for all the text in a
field)
•
Append in New Record: (click on the check boxes to have the date and/or time
appear automatically in the Memo)
Note that when you go to the table view and enter data in a particular record, the date
and/or time will not appear in the memo field for that record until you go to the next row.
Incremental data type
An incremental field assigns a unique sequential number for each record added to a
table. The starting value is 1 and the step value is also 1. When you add the first record
to the table, the incremental field is set to the start value. When you add additional
records, the incremental field will automatically be filled in with the value from the last
entered record plus the step value. Even if you subsequently delete records from the
table, old values are not re-used. This makes an incremental field ideal for use as a
primary key field.
The formatting properties available on the General page are:
•
Caption (enter a caption to replace the field name above the column in Table View −
see Captions on page 64)
•
Index (choose from Primary Key, Indexed, Indexed (Unique), No Index). See Indexes
and primary keys on page 191.
The formatting properties available on the Format page are the same as for Numeric
fields (see the Format page in Numeric on page 172)
179 Database
Logical data type
The logical type enables a field to have one of two logical values. Ability has four ways of
expressing logical values: True/False, Yes/No, On/Off, 1/0.
The formatting properties available on the General page are:
•
Initial Value (enter a default value that will automatically appear in this field every
time a new record is created, unless you overwrite it with another logical value −
Initial value on page 189)
•
Caption (enter a caption to replace the field name above the column in Table View −
see Captions on page 64)
•
Validation Rule (set a rule to validate possible data entries − see Validation rule on
page 186)
•
Validation Text (write a display message for cases of invalid data − see Validation
text on page 187)
•
Required (when checked a value is required in field − see Required property on
page 188)
•
Index (choose from Primary Key, Indexed, No Index & Indexed (Unique) − see
Indexes and primary keys on page 191)
You can choose the type of logical value on the Format page:
•
In the Values box choose from Yes/No, True/False, On/Off, 1/0
Once you go to Table View each new record will display the negative logical value by
default i.e. False or No or Off or 0. To select a positive logical value, click on the arrow in
the field and select it. Alternatively, at the formatting stage, you can choose the positive
value as the default in the Initial Value box.
Boolean calculated field: example
A calculated field (see Calculated on page 182) can be formatted to return Boolean
values i.e. TRUE or FALSE. An example of the usefulness of such a field is the following.
Imagine you have two sets of data, for which you want to make a direct comparison item
by item e.g. yearly income and expenditure over a five-year period. The Success column
is a calculated field and contains this formula:
=IF(Income>Expenditure, True, False)
180 Database
Income
30,000
28,000
33,000
100,000
Expenditure
39,000
27,000
33,000
40,000
Success
FALSE
TRUE
FALSE
TRUE
Enumerated data type
A field with the enumerated data type allows you to choose from a list of values that have
been chosen by you.
The available formatting properties on the General page are:
•
Initial Value (enter a default value that will automatically appear in this field every
time a new record is created, unless you overwrite it with another value from the
enumerated list − Initial value on page 189)
•
Caption (enter a caption to replace the field name above the column in Table View −
see Captions on page 64)
•
Validation Rule (set a rule to validate possible data entries − see Validation rule on
page 186)
•
Validation Text (write a display message for cases of invalid data − see Validation
text on page 187)
•
Required (when checked a value is required in field − see Required property on
page 188)
•
Index (choose from Primary Key, Indexed, No Index & Indexed (Unique) − see
Indexes and primary keys on page 191)
You can enter your values for the enumerated list on the Format page:
•
In the Values box type the entries one per line (e.g. Brown, Blue, Red), using CtrlEnter to go to the next line in each case.
See Adding enumerated field types on page 180 for more information on enumerated
fields and an example.
Adding enumerated field types
You can add your own enumerated field types to a database table. An enumerated field
is one that limits the values that can be put into the field to a pre-defined set, these being
defined by you. This is useful where a field would naturally contain one of a limited set of
values. For example, if you create a patient identification table, and it includes fields for
181 Database
height, weight and eye color, you can make the eye color field an enumerated field and
permit only the values blue, green, brown and hazel.
To create an enumerated field for eye color, do the following:
1. Type a name for the field in Name, for example, EYECOLOR; set the field type at
Enumerated in Type; and click on the Format button to display the "Format Field"
dialog (See Creating fields in a database on page 189 for information on creating
table fields).
2. In the "Format Field" dialog click go to the Format page. In the Values box type the
members of the enumerated set: BLUE, GREEN, BROWN, HAZEL. The values
should be entered one per line, using Ctrl-Enter on the keyboard to proceed to the
next line each time.
3. Click on OK to save the new information and close the "Format Field" dialog, and
click OK again to close the "Format Table" dialog.
4. The table grid is displayed. Select the EYECOLOR field to display a drop-down menu
arrow. When you click on the arrow all the valid values for that field are displayed.
These are the only values allowable in this particular column. Click on one of these to
insert it into the table cell.
5. When you are adding records to the table and you type a value into the enumerated
field and press Tab to move on, one of three things will happen:
(a) If you have put in one of the acceptable values, Ability will accept it.
(b) If the value you enter is not in the enumerated set, Ability will not accept the
value and the cell will remain blank.
(c) If you type the first letter (or several letters) of a valid value, Ability will display the
first alphabetical entry from the list that matches this letter (or letters).
OLE data type
The OLE data type allows you to link to or embed various OLE-compatible objects, such
as pictures, graphics, sound, spreadsheets and other files.
The only formatting you need to decide on at this stage is what caption (see Captions on
page 64) you will have, if any, and whether or not to make it obligatory that each record
contain an OLE object in this field (see Required property on page 188).
Once you have set up the OLE field and gone to the Table Grid View, you need to insert
the OLE object.
1. Double-click on an OLE data type cell. This displays a box into which an object can
be inserted.
182 Database
2. Select File from the Insert menu to insert an existing object, or select New Object if
you wish to create a new object.
For example, to insert a new Ability Spreadsheet into a Database cell, select New Object
from the File menu and then select Ability Spreadsheet from the Object Type box in the
"Insert Object" dialog.
Once you have inserted a new or an existing OLE-compatible object, you can resize the
object window and edit the object's contents in the usual way. To edit the object, a
spreadsheet say, double-click inside the object to put it in edit mode. All the familiar
editing and formatting menus become available across the top of the window. To resize
the object window, click once outside the window and then use the borders and handles
of the window to move and resize the object.
Calculated data type
The calculated data type enables you to resolve simple arithmetic formulae based on
single or multiple field values within the current record. The current record may belong to
a Relation, thereby enabling you to use fields from different tables in a calculation.
The formatting properties available on the General page are:
•
Caption (enter a caption to replace the field name above the column in Table View −
see Captions on page 64)
•
Index (choose from Primary Key, Indexed, No Index & Indexed (Unique) − see
Indexes and primary keys on page 191)
The formatting properties available on the Format page are for various types of number,
date and time, and the Boolean operator. These determine the format of the answer
yielded by the calculated field:
•
General (the general number format)
•
Number (see Number format on page 173)
•
Currency (see Currency format on page 174)
•
Percent (see Percentage format on page 174)
•
Fraction (see Fraction format on page 174)
•
Scientific (see Scientific format on page 175)
•
Date and Time (see Date/Time format on page 177)
•
183 Database
Boolean (use for calculations that return either TRUE or FALSE − see Boolean
calculated field on page 179)
On the Formula page you can either type in a formula yourself or click on the Function
button to display the “Insert Function” dialog, in which you can choose from the standard
Ability functions (see Using built-in functions on page 480 and Using the function dialog
box to build formulas on page 481 for general information on creating functions). Once
the formula has been inserted into the Formula box, type in the field names you want to
act as arguments for the formula)
Using the calculated data type in a table
You can use the calculated data type to perform calculations with values from fields in the
same table. You can also perform calculations using fields from different tables by joining
these fields in a relation (see Using the calculated data type in a relation on page 184).
The following example should make it clear to you how to perform calculations in a
single table.
Imagine you have a table that contains fields for the product ID, the quantity in stock of
each product, and the cost of each product:
Product _ID
A001
A002
A003
A004
Quantity
5
7
4
6
Cost
27.99
45.50
20.00
8.99
StockValue
139.95
318.50
80.00
53.94
You want to add the extra column to calculate the total value of each product in stock.
Follow these steps:
1. If you are already in your table, select Table from the Format menu to display the
“Format table” dialog.
2. In “Format table” go to the next empty line. Type “StockValue” in the Name column
and select Calculated in the Type column.
3. Click on the Format button to display the “Format Field” dialog.
4. On the Format page select either Number or Currency and make sure Decimal
Places is set at 2.
5. On the Formula page type the following in the Formula line:
=Quantity * Cost
6. Click on OK to return to “Format table”.
184 Database
7. Click on OK to return to your table.
The table will be redrawn to show the result of the calculation, for each record, in the
StockValue column.
Using the calculated data type in a relation
You can use the calculated data type to perform calculations using fields from different
tables by joining these fields in a relation. You can also perform calculations with values
from fields in the same table (see Using the calculated data type in a table on page 183).
The following example should make it clear to you how to perform calculations in a
relation.
Example
Imagine you have two tables: one called Orders, which records the product and quantity
for each order, and one called Products, which records the price of each product and
gives a description of the product. Each order and product is given an ID and both tables
have the Product ID field in common. It is your aim to calculate the total value for each of
the orders.
Orders
Order_ID
ORD1
ORD2
ORD3
ORD4
ORD5
ORD6
Product_ID
A003
A001
A003
A002
A002
A004
Quantity
5
7
4
3
2
6
Value
Products
Product_ID
A001
A002
A003
A004
Description
Cost
File
Lamp
Pen
Fan
2.99
25.50
1.20
18.99
The total value for each order can be calculated from multiplying the values from Quantity
(in Orders) by the values from Cost (in Products) for each Product ID. Since Quantity and
Cost are in different tables, you need to join the tables to create a relation. Before doing
this you also need to add to one of the tables a field that will contain the total value. In
this case I have added the field to Orders and called it Value. This field will be given the
185 Database
Calculated data type and formatted to return the result of multiplying the values in the
Quantity and Cost fields.
1. Create a table, Orders, with the four fields: Order_ID, Product_ID, Quantity, and
Value. Order_ID and Product_ID should be given the Character data type; Quantity
the Numeric data type; and Value the Calculated data type (make sure Value is
either Number or Currency). See Creating fields in a database on page 189.
2. Use the “Format Field” dialog to format the fields as follows (most of the formats are
OK as they stand):
(a) Make Order_ID a Primary Key (this will prevent duplicates)
(b) Make Product_ID a non-unique index i.e. Indexed (this will make sort and search
operations more efficient when you have many records)
(c) Reduce Decimal Places in Quantity to 0 (all quantities will be whole numbers)
(d) Increase Decimal Places in Value to 2 (to display cents or pennies properly)
(e) Type the formula =Quantity * Cost into the Formula line on the Formula page
for Value (see Calculated on page 182 and Using the calculated data type in a
table on page 183 for an example of how to enter a function)
For more information on formatting, see Formatting database fields on page 206.
3. Next, create a table, Products, with the three fields: Product_ID, Description, and
Cost. Product_ID and Description should be given the Character data type, and Cost
the Numeric data type.
4. Use the “Format Field” dialog to format the Product_ID field as a Primary Key (to
prevent duplicates).
5. Next, create a new relation based on these two tables (see Creating a relation on
page 229). The Join Field in both tables should be Product_ID and the Join Type
should be Inner (so that only the products which are listed in both tables will be
displayed)
The Relation table will look like this:
Orders.
Order_ID
ORD2
Orders.
Product_ID
A001
Orders.
Quantity
7
Orders.
Value
20.93
Products.
Product_ID
A001
Products.
Description
File
Products.
Cost
2.99
186 Database
ORD4
A002
3
76.50
A002
Lamp
25.50
ORD5
A002
2
51.00
A002
Lamp
25.50
ORD1
A003
5
6.00
A003
Pen
1.20
ORD3
A003
4
4.80
A003
Pen
1.20
ORD6
A004
6
113.94
A004
Fan
18.99
You would undoubtedly want to sort the first column into ascending order and hide either
the second or fifth column. Note that you can rearrange and hide columns, sort and filter
records, just as in any other table. See Query components on page 164 for more
information.
Captions
In addition to the name of the field, you can also give the field a caption. The caption is
the name that will appear above the field when the table is open. It is entered in the
Caption box when you format the table. If it is left empty the name above the field will be
the same as that in Name. Captions are different from names in that they are usually
more descriptive and do not have any of the restrictions on the types of character that
can be used in a name.
Note: Although a caption will appear above a column in a table when the table is open,
you must refer to the field name, as defined in Name, when you are trying to make a link
to the database from another Ability (or non-Ability) application. The field name is the
official name, so to speak, and is obligatory, unlike the caption.
Validation of data
Ability will automatically check that any data you try to enter into a database field is of the
right type (as set when you designed the table). As you would expect, a field set to take
numeric values will not be allowed to accept text.
However, there is another level of validation available to you when you are formatting
fields. This allows you to exclude data that is of the right data type for the field but is
perhaps outside the range of data you want to appear in this field. You can specify a
validation rule (see Validation rule on page 186) for what is acceptable or unacceptable
within the data type you set. Furthermore, you can write your own error message or
validation text (see Validation text on page 187), which will be displayed whenever you
attempt to enter data that breaks the validation rule.
Validation rule
A typical validation rule is a formula that determines what is to be included or excluded in
a field. You can use standard Ability expressions to design the validation rule. The rule
187 Database
will then be compared with any data you attempt to enter into the field. If the data is
allowed by the validation rule it will be accepted by the field; if not then the data will be
refused and a validation text displayed (see Validation text on page 187).
Typical examples of validation rules are:
•
>= “20” AND <= “40” for a numeric field (allows any numbers from 20 to 40
inclusive)
•
= “Smith” OR “Jones” for a character or enumerated field (allows only “Smith” or
“Jones” but no other names)
Note that the data elements in each of the formulas should be surrounded individually by
quotes.
Since a validation rule determines what can be put into a field and will cause an
appropriate message to be displayed if the rule is broken, it turns out that a blank field
governed by a validation rule will be illegitimate and the validation text displayed as if the
rule had been broken. Obviously there are cases where you will want fields to be left
empty. To overcome this problem you should do the following:
•
Add the expression Is Null to the end of the Validation Rule.
•
Make sure that the Required box is unchecked (this indicates that data is not
required)
For example, a validation rule might read:
= “Smith” OR “Jones” OR Is Null
which will allow “Smith”, “Jones” or a blank field.
Validation text
Validation text always accompanies a validation rule (see Validation rule on page 186) for
a database field and is displayed when that rule is broken. You will not be allowed to go
to the next line of a table until you have entered data that is allowed by the validation rule.
Only then will the validation text not be displayed. If you decide not to create your own
validation text, Ability will generate a default message to tell the user what rule has been
broken.
Note that in any line there may be several fields that have an attached validation rule and
its accompanying validation text. In this case only one validation text at a time will be
displayed. Once you have dealt with this by entering legitimate data into the appropriate
field, it may still be the case that one or more of the other fields contains illegitimate data.
Validation text will continue to be displayed, in turn, for each of the fields still containing
illegitimate data, until you have dealt with all these fields.
188 Database
Typical examples of validation text are:
•
Must be either Smith or Jones when the validation rule =“Smith” OR “Jones” is
broken.
•
Must be either Smith or Jones or Blank when the validation rule =“Smith” OR
“Jones” OR Is Null is broken
•
Number must be between 20 and 40 inclusive when the validation rule >=“20”
AND <= “40” is broken.
Required property
The Required property should be switched on if you do not want blank fields to be
allowable, that is if you require that a field contain a value. Any attempt to leave a field
blank when it has been formatted with the Required property switched on, will return an
error message.
For details of how the Required property relates to Validation Rules and the Zero-length
property, see Validation rule on page 186 and Allow Zero-Length Property on page 188.
Allow zero-length property
The Allow Zero Length property, when switched on, permits a field to contain a zerolength string (“”) as value. This should be distinguished from the Null value, which allows
fields to be blank and is permitted when the Required option is switched off.
The basic difference between a field that has a null value and one that contains a zerolength string, is that the former field contains − and has contained − absolutely nothing,
that is no spaces have been entered, no deletions taken place, etc., whereas the latter
may be empty to the eye but in fact has at one time contained data, even though it has
since been deleted.
Hence, as you would expect, the two types of formatting cause fields to behave in
different ways. Likewise, the various format combinations, using both the Required
property and the Allow Zero Length property, also have different effects, as shown
below:
•
Allow Zero Length and Required both set to No: Null value stored when Enter or
Spacebar is pressed, but zero-length string is not allowed (i.e. you will not be
allowed to delete a existing value, although you will be able to replace it)
•
Allow Zero Length and Required both set to Yes: Null value not allowed (i.e. when
you press Enter), but zero-length string stored when you press Spacebar or enter a
zero-length string (i.e. as when you delete an existing value)
•
•
189 Database
Allow Zero Length set to Yes and Required set to No: Null value stored when
Enter or Spacebar pressed, and a zero-length string stored when it is entered (i.e.
as when you delete an existing value)
Allow Zero Length set to No and Required set to Yes: Null value not allowed (i.e.
when you press Enter or Spacebar), and a zero-length string not accepted (i.e. as
when you try to delete existing value)
Initial value
You can set an initial or default value for a field, depending on its data type. This is set
when you are formatting the field (see Data types on page 169). Later on you can
reformat the field to change the initial value. To do this just type the new default in the
Initial Value box in the “Format Table” dialog for the relevant field.
Every time a new record is added to a table, all the fields that are formatted to have initial
values will automatically be updated. You can of course replace an initial value in Table
Grid View by entering an alternative value.
Note: Initial values must be compatible with the data type of the field e.g. characters for a
Character field, numbers of the right format for a Numeric field, dates of the right format
for a Date field, and so on. When you change the default value of a field, only new
records receive this value; existing records retain their old values, which may be there
through the old default or because they were directly entered by you.
Creating fields in a database
You can create fields for a new table or add to and modify them in an existing one.
•
Create a new table by right-clicking your mouse anywhere in the Database Manager
window and selecting New. Select either the Table Wizard or the Blank Table
button. The following notes assume you have selected Blank Table (see Creating
fields in a database using Table Wizard on page 190 for more information on using
Table Wizard). The "New Table" design dialog is displayed.
•
If you want to add fields to an existing table, select the table in Database Manager
and right-click your mouse. Click on Format from the displayed menu to go to the
"Format Table" dialog.
"Format table" and "New Table" work in exactly the same way, so follow these steps for
each of the fields that is to be created:
1. Click in the Name box to enter a name for the field. This must be unique for that
particular table. See Field names on page 168.
Note: It is good practice to use standard field names in your table designs. Since
Ability uses field name references when calling data from other applications, standard
190 Database
field names will give you greater freedom to switch Forms, mailing labels and mail
merge documents from one table to another. See Creating fields in a database using
Table Wizard on page 190 for more information on standard field names.
2. Press Tab to move into the Type box. Ability automatically displays the Character
field type. If you need to change the field type, click the arrow next to the Type box to
display a list of all field types. Select the required type with a single click. For more
information, see Field data types on page 169.
3. Once you have set the field type, it becomes possible to format the field. The format
properties differ according to the type selected. It is a good idea to set the format
properties immediately after setting the type. To format a field, click once on the
Format button at the bottom right of the window. The "Format Field" dialog is
displayed, in which the various properties can be set, depending on the type. See
Field data types on page 169 for an explanation of the various data types and their
associated formatting properties.
4. Press Tab to move to the Description box. Here you can type an optional
description that will help remind you or others what the field is supposed to contain.
5. Once you have reached the end of the line, that is, defined one field, press Return or
Tab to go to the next line and define another field in the same way.
6. When you have defined all the fields that you will need, you can give the table a
general description in the Table Description box.
7. Next click on the Index button to check (or set up) your indexes. See Indexes and
primary keys on page 191.
When all is set, click on OK to create a table based on your design.
Creating fields in a database using Table Wizard
You can design a database table using Table Wizard. This is a quick and easy way of
creating a table based on standard table and field designs. These are meant to reflect the
requirements of the average database user and should be adequate for most purposes.
To use the Table Wizard follow these steps:
1. Right-click your mouse when in the Database Manager window and select New
followed by Table.
2. Click on the Table Wizard button in the "New Table" dialog. The "New Table Wizard"
dialog is displayed.
3. In the Available Tables box the set of standard tables is listed, for example,
Customer, Product and Employee. Click on one of these, say Customer, to select it
and then click on Next.
191 Database
4. The Available Fields box displays the standard fields that come with the table you
have selected. For the Customer table these include name and address fields etc.
Select the field that you want to be the first in your table and then click on the Add
button (the topmost). The selected field is moved from the Available Fields box and
placed in the Selected Fields box. Repeat this operation for the rest of the fields that
you require.
5. If you decide that you don't want to use a field after you have moved it to the
Selected Fields box, then select the field and click on the Remove button (the
second) to return it to the Available Fields box. Likewise, if you want to change the
order of fields, you can move selected fields back and forth - including groups of
selected fields - by using the Add and Remove buttons. To move all the fields in the
Available Fields box over to the Selected Fields box, use the Add All button (the
third). The Remove All button (the fourth) moves everything in Selected Fields back
to Available Fields.
6. Once you have chosen all the fields you want, click on Finish. This takes you to the
"New Table" dialog, where you can format the fields, create captions and
descriptions, define initial values, and even add extra fields that are not available
through Table Wizard. See Creating fields in a database on page 189.
Indexes and primary keys
Indexes are used by Ability to speed up sort and search operations on table fields. They
are also used to determine the type of link that can be made from one table to another in
a relation (See Joining tables on page 228).
Each record in the field is given its own index position, so to speak, by which it can be
ordered. You should set an index for a field if you think you may need to search or sort on
that field frequently. Indexes can also be used to prevent certain fields holding duplicate
data.
The only disadvantage in using indexes is that they may sometimes slow down various
table operations, such as query operations, especially when there are many records in
the table.
You set an index for a field when you set the data type. The fields that can be indexed
are those that are capable of being ordered, either numerically or alphabetically, such as
numeric, character, date and time fields (See Creating indexes and primary keys on page
192).
There are three types of index: primary keys, unique indexes, and non-unique indexes. In
addition, you can create multiple-field indexes.
192 Database
Primary key
A primary key is an index that uniquely identifies each record in a table. It can be set for
one and only one field, which is known as the primary key field. This field will not accept
duplicate or blank values. If you have entered a duplicate value or left the field blank, you
will not be able to move to the next or previous record until you change or delete the
duplicate value or replace the blank with a unique value. Primary keys are useful when
you use Ability Database to set up relations between tables.
In addition, the Primary Key field in a table automatically sorts the table into ascending
order according to the values in the field. If you add extra records, they will be
automatically ordered according to the Primary Key field when you close and re-enter the
table.
Note: If you haven't set a primary key while designing a table, you can set it after
records have been entered. However, if the field already contains duplicate values or if it
contains blanks, then Ability will display an error message asking you to remove
duplicates or to replace blanks with a unique value before it accepts the field as the
primary key field. The primary key will not be set for a field with duplicate values or
blanks and will format the field so that it has no index. If you can't edit the field to rid it of
duplicate values, you can create an extra field and give it the Incremental data type.
This will number all the records and ensure their uniqueness. Even when you delete
records and add new ones, the new records will not be given numbers that have already
been used. This is obviously useful as the basis of an invoice table, where invoices are
required to be unique.
Unique indexes
A unique index is similar to a primary key in that it will not allow duplicate values in the
field for which it has been set. However, it is unlike a primary key in that you can set as
many unique indexes as you wish for a table, and you are allowed to leave a unique
index field blank for any record. This is obviously useful in that you may not want
duplicate data to be allowable in a particular field, though you do want to allow certain
records to be blank in this field. A unique index field, unlike a primary key field, will not
count two or more blanks as duplicates.
Non-unique indexes
A non-unique index enables a field to have duplicate values and blanks, thereby enabling
you to search and sort faster on fields that will contain repeat information as well as some
blanks. You can set as many non-unique indexes as you wish for a table.
Creating indexes and primary keys
To create an index or a primary key for a field in a database table, you first need to
choose a type for the field in the Type box (see Field data types on page 169). At this
193 Database
stage, you may be designing a new table or editing/formatting an existing table design
(see Creating fields in a database on page 189).
Once you have set the type for the field, click on the Format button in the dialog (either
"New Table" or "Format Table").
In the "Format Field" dialog, click in the Value box to the right of Index. Click on the
arrow to display all of the Index formatting options. The full set comprises:
• No Index (no index applied to this field)
• Primary Key (primary key applied to this field) See Primary key on page 192.
• Indexed (a non-unique index applied to this field) See Non-unique indexes on page
192.
• Indexed (Unique) (a unique index applied to this field) See Unique indexes on page
192.
Click on one of these to select it. Note that only one field can be formatted as a Primary
Key field. If you afterwards choose another field as the Primary Key, the first field will
automatically become Indexed (Unique) instead.
Not all of the available data types can be index formatted. Obviously it makes no sense to
index Memo or OLE fields, therefore no indexing options are provided for these.
Moreover, though you could set a Primary Key for a Logical field, this would only make
sense if you intended your table to contain a maximum of two records. The Incremental
data type, if it is set for a field, is automatically the best choice to made the Primary Key.
Here is a list of index options and the data types that can be used with them:
Primary Key
Indexed
Indexed (Unique)
Character
Numeric
Date
Time
Enumerated
Incremental
Logical
Calculated
Character
Numeric
Date
Time
Enumerated
Character
Numeric
Date
Time
Enumerated
Incremental
Logical
Calculated
Logical
Calculated
You can check which fields have indexes set for them at any time. In addition, you can
create multiple-field indexes.
194 Database
See Multiple-field indexes on page 195.
Checking indexes and primary keys
Once you have set the indexes and primary key for a table, you can check them by
clicking on the Index button in the "New Table" or "Format Table" dialog. In the Table
Indexes box all the indexes set for a particular table are listed:
• Under Index Name the name of the index is displayed. By default this is the same as
the name of the field, in Field Name, for which the index was set (although you can
rename the index here, if you wish).
• Sort Order is Ascending by default - click in the box to change this to Descending.
The sort order determines how certain fields are displayed when you go into Table
Grid View. If you have set a Primary Key this will take precedence over any of the
other indexes and the records will be sorted into ascending or descending order
according to the values in the primary key field. If you have not set a primary key, then
the records will be sorted according to the first index listed in the Table Indexes box.
Every time you go into a table, the sort index will take account of any new records
previously added and will make sure that the table is correctly sorted.
To check what kind of index has been set for a field, click anywhere in that field's row in
the Table Indexes box. The two check boxes at the bottom of the dialog - Primary Key
and Unique - will be activated. Together these enable you to determine the kind of index
set for each field:
• If Primary Key and Unique are both checked, then the index is the Primary Key
(remember that only one primary key is allowed per table and that it is called unique
because it does not permit duplicates)
• If Primary Key is not checked and Unique is checked, then the index is Indexed
(Unique) (you can have many of these in a table, but duplicate values, except for
blanks, are not permitted)
• If Primary Key and Unique are both not checked, then the index is Indexed (you can
have many of these in a table and duplicate values are permitted)
For information on how to set indexes in the Table Indexes box, see Editing and setting
indexes and primary keys on page 194.
Editing and setting indexes and primary keys
Although you will usually set the indexes for your table by using the Format button when
you set the data types for the fields, you can also set or edit them in the Table Indexes
box of the “Format Table” (or “New Table”) dialog. You first need to click on the Index
button to access the Table Indexes box.
195 Database
To set a new index:
1. Click in an empty row in the Field Name column.
2. Click on the arrow to display all the available fields and then click on a field.
3. Give the index a name in the Index Name column (it's best to use the same name as
for the field).
4. Once you have given the index a name, click anywhere else in the row to activate the
Primary Key and Unique checkboxes. You can now set the index type by checking
the appropriate boxes:
•
Check Primary Key to set a Primary Key index (note that the Unique box is
automatically checked)
•
Check Unique to set a unique index i.e. Indexed (Unique)
•
Leave Primary Key and Unique unchecked to set a non-unique index i.e.
Indexed
You can edit indexes in the Table Indexes box. Click in the row that contains the index to
be edited and then check or uncheck Primary Key and Unique checkboxes, as
appropriate. For more details on editing indexes, see Checking indexes and primary keys
on page 194.
Multiple-field indexes
It is possible in Ability Database to create multiple-field indexes. These are combinations
of two or more table fields that together are unique. This is useful when you want each
field in the multiple-field index to be able to hold duplicate data, though you don't want all
the fields together to hold duplicate combinations of data.
For example, think of a field that contains orders and one that contains products. You
want to be able to duplicate the order number, for there may be several products on any
one order. Likewise one product may be attached to more than one order. What you don't
want is that a particular product and order number together occur more than once, that is,
that more than one record contains a duplicate combination on these fields.
To create a multiple-field index you need to be in the "Format Table" dialog (for an
existing table) or the "New table" dialog (when creating a new table). See Creating fields
in a database on page 189.
To create a multiple-field index for an existing table, follow these steps:
196 Database
1. Open the table and select the Table command from the Format menu (alternatively,
right- click on the table name in Database Manager and select Format). The
"Format Table" dialog is opened.
2. Click on the Index button to go to the index page.
3. Click in the first empty row in the Table Indexes box.
4. A multiple-field index for two fields is defined by two rows of the Table Indexes box:
•
To set the first row, click in the Field Name column for that row. Choose the
appropriate field from the drop-down list. Give the index a name in the Index
Name column. This name will be the name for the multiple-field index as a whole.
•
To set the next row, click in the Field Name column for that row. Choose the
second field from the drop-down list. Do not enter a name in Index Name for this
row. Ability recognizes this combination - one row with an Index Name, the next
without - as a multiple-field index.
5. Next, click again anywhere in the first row. This will activate the Primary Key and
Unique checkboxes. You can set the multiple-field index as either a primary key in its
own right (check Primary Key) or as a unique index (check Unique). Whichever you
choose, you can have duplicate values in each of the fields but not a duplicate
combination of values. With Primary Key you are not allowed to have blanks in any
of the fields of the Multiple-field Index. With Unique you are allowed to have
duplicate blanks for either field or both in any row.
Although it is unlikely that you will need to create a multiple-field index with more than two
fields, it is possible to add more fields as required. Again, with a three-field or higher
multiple-field index, it is only the first field that is given a name in Index name.
Saving a new table
Once you have designed a new table and entered all the fields you require, click on the
OK button at the bottom of the "New table" dialog. If this is the first time you have saved
the table, the "Save As" dialog will be displayed. Enter a name for the table in the Table
box.
The new table name will appear in the list of tables, for the current database, in
Database Manager.
Opening a table using database manager
To open a table, double click on the table name in Database Manager. Alternatively,
select the table and right click your mouse. Click Open in the displayed menu. The table
is opened in Grid View. There are three types of table view: Grid, Form and Report.
197 Database
Grid view
When you open a table in Grid View (also known as browse mode), you can add and
delete records and generally edit the table's contents.
In Grid View your data is displayed in a standard table, where every row is a record and
every column is a field.
Note: You will notice that the menu bar changes when you enter Grid View. This allows
you easy access to the various commands you will need.
Table record indicators
When you are in a table, in Grid View (see Table views on page 161), you will notice
several indicators in the left-hand row bar. Here’s what they mean:
•
the new record is always indicated by a star
•
the current record is indicated by a pointer
•
the record that is being edited or into which new data is being entered, but which has
not yet been saved (i.e. you haven’t yet gone to the next line), is indicated by a
pencil.
Modifying records
Once you’ve created your table, you’ll probably spend most of your time working with the
data in the records. There are various ways of working with records when in Grid or Form
View, including adding, editing, deleting, copying and finding records.
Adding records
Whenever you open a table, the last row of the table is always a new record (i.e. blank)
and is referred to as the new row. Adding a new record is therefore just a matter of typing
data into the new row. The same applies to the forms based on the table.
To add a record, do any one of the following:
•
Use the scroll bars to move to the bottom of the table and click on the new row.
•
in the
Select New Record from the Record menu, or click on Add Record
Record toolbar. The active cell will become the first position of the new row.
You can now enter data in the fields of the new record. Whenever you begin to enter data
in the New Record, another blank New Record is automatically created.
198 Database
Rather than entering fresh data into the new record, you may want to duplicate an
existing record.
Duplicating records
You can create a new record, in a table, based on the contents of the current record. This
may be useful if, for example, you are adding several contacts from the same company to
your database.
Rather than re-type address details, select the Duplicate Record command from the
Record menu (in Grid View you must select the whole record first by clicking in the left
row bar, but in Form View it is sufficient to have the form on screen).
This will create a new record with the details of the current record copied to it. You can
then edit the new record as you like.
Entering data and editing records
To fill in a blank field, first click on it or go to it using the Enter key. This will make it the
active cell. Next, just type in or select the appropriate data for that field, according to the
data type you set for the field.
To change the contents of a field, first go to it either by clicking in the field or using the
Enter key. There are three possible operations you might want to perform on the cell:
•
delete the contents
•
replace the contents
•
edit or add to the contents.
With most types of field you can click at the position in the field where you want to edit, or
append new text to, the current contents. To replace or delete the current contents,
double-click in the field to select the field contents and then type replacement text or
press Del (if you entered the field using the Enter key, you can delete or replace text
without clicking).
The method of editing fields depends to some extent on the data type of the field:
•
Character, Memo and Numeric fields are straightforward and their contents can be
edited, deleted or replaced, as outlined in the previous paragraph.
With other fields the procedure is slightly different but just as obvious:
•
Enumerated: delete the contents by double-clicking in the field to select the contents
and then press Del. Enter one of the members of the enumerated list by clicking on
the arrow and selecting the appropriate one from the drop-down list, or alternatively
type it yourself directly (what you type will only be entered if it is in the enumerated
list).
•
199 Database
Logical: you can't delete the contents of a logical field but only change the field’s
value. If you try to delete the contents, they will be restored to the default value (No,
False, Off or 0) as soon as you move to another record.
•
Date: delete the contents by double-clicking in the field to select the contents and
then press Del. Type the date according to the format you set when creating the field.
The field will only accept dates that match the chosen format.
•
Time: delete the contents by pressing Del. Type the time according to the format you
set when creating the field. The field will only accept times that match the chosen
format.
•
Incremental: the contents of this field can't be edited or deleted. Incremental values
are set when you format the field and are one way of uniquely identifying a record. If
you delete an incremental value you won't be able to move out of the current record.
To restore the value, press Esc. An incremental value can only be deleted by
deleting the row in which it occurs.
•
Calculated: the contents of this field are determined by the formula you set and
therefore can’t be edited or deleted. The only way to change the contents is to
change the contents of the fields that are referred to in the formula. Deleting the
formula in Table Format will of course remove all the results that are calculated by
the formula.
•
OLE: delete an OLE object by pressing Del. Insert an OLE object by double clicking
in the field to display the OLE Table. Select either File (to insert an existing file) or
New Object (to insert a new object) from the Insert menu (see OLE data type on
page 181).
Usually, when you are editing fields, you can abandon the current edit by pressing the
Esc key. The field will revert to its previous state.
After editing a field’s contents, click on the field you want to edit next (or use the cursor
movement keys).
Finding records
If you know the record number of a particular record in a table, it is quite easy to locate
the record by using the Go To command in the Edit menu. However, sometimes you
may not know the record number and therefore have to search for the record by finding
a particular piece of data, which you know is held in a field of the record. If you are
working on a small table it should be fairly easy to find the cell you require (for
formatting, deleting, editing, or whatever) by eye. However, if you have a very large
table, it can be quicker to ask Ability to find the cell you want. Whether in Table Grid
View or Form View follow these steps:
200 Database
1. Click on the Find
button on the toolbar or select the Find command from the
Edit menu. The “Find” dialog is displayed.
2. In the Find what box, type the text you wish to search for.
3. In the Direction box choose whether you want to search Up, Down or in All
directions from the current position. Ability searches down columns: for example,
down one column from the present position, then down the next column, and so on.
4. In the Scope box choose whether you want to search in the Whole document or
only in a Selection.
5. In the Options box you can choose to Match case and/or to Match whole word
only.
6. Click on the Find Next button to begin the search. Ability will find the next occurrence
of the search text and the cursor will move to that cell. Click on Find Next again to go
to the next occurrence, and so on till there are no more to be found.
Deleting records
This section explains how to delete records in a table. In Grid View you can delete
several records at once, but only one at a time in Form View.
You can delete one record, a group of records, or all the records in table Grid View. All of
these are done through the same "Delete" dialog.
1. If you want to delete just one record it is best to make this record the current one. Do
this by clicking anywhere in the record. The current row pointer is displayed in the left
row bar. If you want to delete several records at once, you can select (or mark) these
records by clicking your mouse on the left row bar and dragging till the required
records are all selected.
2. Next, click on the Delete
button on the Record toolbar (or select Delete Record
from the Record menu). The "Delete" dialog is displayed. Depending on whether you
selected a current record, or marked one or more records, one of the following is
checked in the dialog for deletion:
•
Current Record (deletes the record that has the pointer at its left)
•
All Marked Records (deletes all the marked records - note that the current
record is not necessarily one of the marked records)
•
All Records (if you want to delete all records, then select this yourself - you can't
delete the new record, of course)
201 Database
3. Click on OK when you have chosen the records to be deleted. You will be warned
that you cannot recover deleted records and asked to click Yes to continue with the
deletion. The table will be redrawn with the deleted records removed.
The Delete command deletes the record and the row it occupies. However, if you use the
Cut command instead, although the record and its row are both deleted, you can use the
Paste command to paste the cut record in the new row at the end of the table.
To delete the current record in Form View, click the Delete button
on the Record
toolbar or select the Delete Record command from the Record menu. You will be asked
if you are sure that you want to proceed with the deletion. The deleted record will no
longer appear as one of the forms and is also deleted from the attached table.
Deleting the contents of fields in a database table
•
To delete the contents of the current field in a table, first click in the field to select it
and then right-click your mouse and select Cut (alternatively press the Del key, click
on the Cut
button on the toolbar or select Clear from the Edit menu).
•
To delete the contents of several fields, select the fields and again select Cut, Clear
or Del. You can select several fields in several rows by dragging the mouse.
•
If you used Cut to delete the contents of the field(s), you can of course use Paste
to move the contents to another field(s).
Copying records
To copy records do the following:
1. Select the record by clicking on the left-hand row bar.
2. Click on the Copy
button in the toolbar (or right-click your mouse and select
Copy from the menu).
3. Select the new row at the end of the table and click on the Paste
button in the
toolbar (or by right-clicking your mouse). The record will be copied to the new row.
To copy several records, follow the above instructions but make sure you first select the
relevant records by dragging your mouse before copying and pasting.
In the same way, you can copy records from one table and paste them into another. Take
care though, you need to have the same – or almost the same – table structure to be
able to do this sensibly.
202 Database
Records can also be copied to and from Spreadsheet and Write documents.
Managing your tables
You can rename, delete, export and import database tables in Database Manager.
•
To Rename a table (or query, relation, form, or report), click once on the table name
to select it, wait a moment and click once again. The table name will be displayed in
Rename mode, surrounded by a box. Type the new name or click in the box and edit
the current name. Click once outside the Rename box to close it. The new table
name is displayed.
•
To Delete a table (or query, relation, form, or report), right-click your mouse on the
table name and select Delete from the menu. Ability will ask you if you are sure that
you want to delete the table. Click on Yes. The table will be deleted from the
database. Be careful when deleting tables: DOS and Windows techniques to recover
files won’t work if you want to recover a deleted table.
•
For information on exporting tables, see Exporting tables on page 266.
•
For information on importing tables, see Importing tables on page 266.
Redesigning a table
After you have designed your table and started to use it, that is to say, entered data in the
fields, it is possible to change your design without having to start from the beginning. To
change the structure of a database table – that is, to add, delete, redefine or reformat
fields – do the following:
•
If the database tree is on screen in Database Manager, click on the table you want
to redesign to select it and then right-click your mouse. From the drop-down menu
click on Format.
•
If you are already in a table in Grid View, select Table from the Format menu.
The "Format Table" dialog is opened. This dialog should be familiar to you from when you
first designed the table, although it was then called "New Table".
In the Table Fields box, in "Format table", you will see all the fields from the table, along
with their associated Name, Type, Description. To go to the Table Indexes box, where
all the indexes for the table are displayed, click on the Index button.
There are several things you might want to do when redesigning a table:
1. To delete a field completely (equivalent to deleting a column in the table), click on the
left-hand row bar in Table Fields to select the field. Next, press Del on the keyboard
and the selected field will be deleted. Several fields can be deleted at once, by
203 Database
dragging your mouse to select the relevant fields and then pressing Del. Be careful
here: when a field is deleted the corresponding column in the table is deleted, along
with all its data. So make sure you really no longer need this data, before deleting the
field.
2. To add a field, go to the next empty line and create the field in the normal way (see
Creating fields in a database on page 189).
3. To rename a field, just type the new name in Name.
4. To change the data type of a field, click on the arrow in Type and select a different
type from the drop down list.
Note: When you select a different type, the data in the table column will be lost if the
data types are incompatible, which they usually are. You should assume that different
data types are incompatible when redesigning a field. However, there are exceptions:
for example, if you have text in a column which has Character data type and you
change the data type of the associated field to Numeric, the contents of the column
will be deleted. If, however, the text is made up of numeral characters, then the
characters will be converted to numbers. Likewise, numeric data will be converted to
text when you change the field type from Numeric to Character.
5. When you change the data type of a field, you will usually want to format the field
anew, or you may wish to reformat a field even though you have not changed the
data type. The formatting properties include width, validation, initial value, caption,
primary key and indexes, etc. depending on the data type of the field. To reformat a
field, make sure you are somewhere in the field and then click on the Format button
(see Data types on page 169 for information on the various data types and their
respective formatting options).
6. To change or add a description of the field, type the new description in Description.
7. If you think the redesigned table merits a different description, then type this in the
Table Description box.
8. Once you have redesigned the table, click on OK to save it and return to Table Grid
View. The table will be redrawn to reflect your changes and you can continue to enter
data.
Formatting columns in a database table
Once you have designed your table and gone to Table Grid View - where you can begin
to enter data - each field corresponds to a column. The formats you have already set for
the fields – when designing the table - determine how data is displayed in the columns
(see Formatting database fields on page 206 for more information).
204 Database
However, there is another level of formatting available that can only be applied once you
are in Table Grid View. Like the field formats, these formats also apply to the columns in
your table and work alongside the corresponding field formats. The column formats are
accessed through the Style command in the Format menu. The format options are:
•
Font
•
Colour
•
Borders
•
Align
Since in a table only an entire column can be formatted, all you need to do to format the
column is select the whole column by clicking on the bar at the top of the column or
position the active cell anywhere in the column by clicking in any cell. You can also select
several columns and format them together.
Formatting fonts in a table
Once you have selected a column (or columns), format the fonts as follows:
1. Select Style from the Format menu. The "Format Columns" dialog is displayed,
turned to the Font page.
2. In the Font box choose a font for the contents of the column.
3. In the Outline box choose a style for the font.
4. In the Size box choose a size for the font.
5. In the Effects box you can switch on the checkboxes for Strikeout and Underline.
6. In the Textcolor box click on the arrow to display the full list of available colors and
then click on the color you require. This option only colors the contents of the column,
for instance, text or numbers.
The formats you have chosen are displayed in the Preview box.
Click on OK to apply the new fonts and styles to your table.
Formatting a table for color
Once you have selected a column (or columns), format them for color and 3-D effects, as
follows:
1. Select Style from the Format menu. The "Format Columns" dialog is displayed.
205 Database
2. Click on the associated tab to turn to the Color page.
3. In the Interior group box there are two color palettes: one for Foreground and one
for Background color. The box just above these is where you choose the pattern
that combines the foreground and background color. The pattern and colors you
choose will fill the whole of the column you are formatting, with text displayed on top
of the pattern (in the color you chose, if any, in Textcolor on the Font page).
Note: The default setting is white on white, that is to say, the white color button is
depressed for both foreground and background. Obviously no pattern can be formed
from this combination, as you can see from the absence of options if you click on the
arrow in the pattern box. Likewise for any other color when it is selected in both
palettes.
To form a pattern, proceed as follows:
1. Click on a color in the Foreground palette and one in the Background palette (note
that white is also a valid color option for either or both of the palettes).
2. Click on the pattern box arrow and select one of the displayed patterns. The pattern
and its color combination are shown in the pattern box and also in the Preview box.
You can proceed to combine different colors by experimenting with the palettes and
the available patterns.
3. In the 3D-Effect group box choose whether you want the column to display its
pattern in down mode (choose Inset), up mode (choose Raised), or normal mode
(choose Normal).
4. The pattern, color and 3D effect are all displayed in the Preview box.
5. Click on the OK button to save and apply the new color formats.
Formatting borders in a table
Once you have selected a column (or columns), you can format the borders of all the
cells in the column (or columns) as follows:
1. Select Style from the Format menu.
2. In the “Format Columns” dialog click on the Borders tab to go to the associated
page.
3. Click on the Type and Color that you want to set for the borders. Click on the
borders in Border for which you want to set the new type and color. As you click on
these − Left, Right, Top, Bottom − one by one, the new formats will be displayed. If
you wish to set border types and colors individually for the borders, click on the
206 Database
relevant border along with the type and color you want it to have, and so on till you
have formatted all the borders.
Note that in setting borders in a particular table column all the cells in the column are
affected.
Alignment in database fields
Once you have selected a column (or columns), you can determine how the data
contained therein will be aligned or justified.
1. Select Style from the Format menu.
2. Click on the Align tab to go the associated page.
3. In the Horizontal box choose from Standard, Left aligned, Center and Right
aligned.
4. In the Vertical box choose from Standard, Top, Center and Bottom.
5. Below these you can switch on Wrap Text, Allow Enter and Auto Size.
Formatting database fields
When you design a database table and create the fields for the table, you can also format
the fields for such properties as:
•
case (whether text is to be upper, lower or mixed case)
•
width (the width of the field)
•
precision (how many decimal places a number can have)
•
indexes (primary key, unique index, or non-unique index)
and other format properties, depending on the data type of the field.
This is the field formatting level. (See Field data types on page 169 for information on
data types and their associated formatting properties.)
Once you have designed your table and gone to Table Grid View - where you can begin
to enter data - each field corresponds to a column. The formats you have set for fields
determine how data is displayed in the columns.
However, there is another level of formatting available that can only be applied once you
are in Table Grid View. Like the field formats, these formats also apply to the columns in
your table and work alongside the corresponding field formats. These include font style
207 Database
and size, background and foreground color, text color, alignment, and border styles (see
Formatting columns in a database table on page 203 for more information).
Changing the grid style
To alter the way the grid (the border around the field contents) is used in the table, do the
following:
1. Select the Options command from the Tools menu and go to the Grid Display page
in the “Options” dialog.
2. In the Titles and GridLines group box most of the Grid display options are switched
on by default:
•
3D-Buttons - the bars at the top of the columns are 3D rather than flat
•
Vertical Lines - sets the vertical lines for the Table Grid
•
Horizontal Lines - sets the horizontal lines for the Table Grid
•
Mark Current Row - an arrow in the left hand row bar marks the current row
•
Mark Current Column - the bar at the top of the column is shown as up when
column is not selected, otherwise down
3. In the Color group box you can select a color for the Table Grid. Click on the options
for which you wish to set a color (Grid Lines, Fixed Lines, Tracking Line, Dragging
Line, Background) and then select a color from the palette.
4. In the User Properties group box set the row and cell properties for the Table Grid:
•
Row resize mode (Automatic resizes all rows when you resize one row; Single
allows you to resize single rows independently of other rows; None does not
allow any row resizing)
•
Row print mode
•
Current Cell (choose a border thickness for the current cell i.e. the selected cell,
from the drop-down list)
5. The changes you make are shown in the Preview box. Click on OK to redraw your
table with the new Grid Style settings.
Note that the new grid style is applied not only to the current table but also to any other
tables you may open or create.
208 Database
Changing the column width
To change the width of a column:
1. Position the mouse pointer over the right hand edge of the column bar.
2. When the pointer turns to a cross, hold down the left mouse button and move the
cross to where you want the edge of the column to appear.
3. Release the mouse button and the column will be redrawn with its new width.
The new column width will be saved with the table and so will not be lost when you leave
the database.
Performing calculations in tables
You can extract certain types of data about the records and columns in a table, query or
relation, as well as perform some calculations.
Select the Data option on the menu bar to access options for:
•
Count
•
Average
•
Sum
•
Calculate
Average, Sum and Calculate can be used with a selection of the records rather than the
whole table by defining a filter condition on the Condition page (see Performing
calculations in a filtered table on page 210).
•
Count has options for All Records - counts the total number of records in the table
(filters are disregarded); Current Filter - counts the number of records in the filtered
table (if no filter has been applied the result is the same as for All Records); and
Marked Records - counts the number of currently selected records. Select one of
these and select OK.
•
Average allows you to find the average value of one or more numeric columns. In the
Average page of the "Calculate Totals" dialog, click on the fields (columns) in
Available Fields for which you want to find the average, and click on Add to move
them to Selected Fields. If you want to move a field into a position between fields
that have already been moved over, click on the field in Selected Fields above which
you want the field to be inserted and use the Insert button rather than Add. Click on
OK. The result is displayed in a "Summary Results" dialog, with an average value for
209 Database
each selected column. You can print this or copy it to the clipboard. Click on Done to
close the dialog when you have finished.
•
Sum allows you to find the total value of one or more numeric columns. In the Sum
page of the "Calculate Totals" dialog, click on the fields (columns) in Available
Fields for which you want to find the sum, and click on Add to move them to
Selected Fields. If you want to move a field into a position between fields that have
already been moved over, click on the field in Selected Fields above which you want
the field to be inserted and use the Insert button rather than Add. Click on OK. The
result is displayed in a "Summary Results" dialog, with a total value for each selected
column. You can print this or copy it to the clipboard. Click on Done to close the
dialog when you have finished.
•
Calculate allows you to perform various calculations on values in numeric columns.
Select it to display the "Calculate Totals" dialog. In the Expressions group box you
design the calculation you want to perform on a particular column:
a. In the Field box click on the arrow to display a full list of the numeric columns in
the table. Click on a field (column) to place it in the Formula box.
b. Build the formula by clicking on "+", "-", "*", "/", "(", ")" in turn, as required, to
insert them into the formula box, and by typing directly into the Formula box any
numbers needed.
c.
Note that you can place as many fields as you want in the Formula box. If you
make a mistake double-click on the inserted symbol, number or field to select it
and then right-click and select Delete (or press Del on the keyboard).
d. Once you have constructed the formula, click on the Add button to insert it into
the large box at the bottom of the dialog.
e. Click on Test to test that the formula is well formed, that is to say, it doesn't break
any of the syntax rules for a formula, such as an unmatched bracket or a "+" sign
with no expression following it.
f.
To clear the formula click on the Clear button. To remove selected expressions,
first select the expressions to be removed and then click on Remove.
g. Finally, click on OK to apply the formula.
h. A "Summary Results" dialog is displayed, with the results of the formula shown in
a column. You can copy this to the clipboard or print it. When you have finished,
click on Done to close the dialog and return to the table.
You can also perform a calculation on a limited number of the records by using Calculate
in conjunction with filter conditions you set in the Condition box.
210 Database
Example of a formula
If you have two numeric fields, called Income and Outgoings, in a table called Thrift,
which records the state of your monthly finances, you can apply the following formula to
your table to work out the percentage of your income that you spend month by month:
(Thrift.Outgoings / Thrift.Income) * 100
The formula will produce a summary column, displaying the monthly ratio of spending to
income on a percentage basis.
Performing calculations in a filtered table
You can calculate averages and sums and perform various other calculations on the
columns in a table (see Performing calculations in tables on page 208). In addition, you
can carry out calculations on a selection of the records rather than all of them by defining
a filter condition in conjunction with the calculation.
When you select Average, Sum or Calculate from the Data menu, the “Calculate Totals”
dialog is displayed with a Condition tab. This allows you to average, sum or perform
calculations on a subset of the records in the table. Basically, the Condition box enables
you to filter a table according to conditions you have specified and then extracts data
from the filtered table according to which fields you selected in Average, Sum or
Calculate. A Condition is always set in conjunction with one of Average, Sum or
Calculate.
To set a Condition follow these steps:
1. First choose the fields you want to perform the calculation on (see Performing
calculations in tables on page 208).
2. Next, click on the Condition tab to go to the page where you design the condition
expression.
3. The three boxes along the top line - Field, Operator, Value - are used to define a
filter condition for each of the fields that is to be used in the filter. Ability takes the
field you select and compares all the values in this field to the condition you specify
for the filter. The filter selects only those records where the field value fulfils the
specified condition.
•
Click on the arrow in the Field box to display the full list of fields in your table and
then click on one of the fields to select it.
•
Click on the arrow in the Operator box to display the full list of operators that can
be used to construct a condition. These include operators for:
211 Database
Equals (=)
Contains ($)
Begins With (<$)
Ends With (>$)
Less Than (<)
Greater Than (>)
Less Than or Equal To (<=)
Greater Than or Equal To (>=)
Not Equal To (< >)
Is Empty ("")
Not Empty (!!)
•
In the Value box you type the value that is to be compared, using the operator, to
the values in the field you selected in Field.
For example, in a table that contains details on customers, you might select, say,
Customer_Name in Field and < in Operator, and type S in Value. This would
filter the table to show only the records where the Customer_Name begins with
any letter less than S, that is, any letter before S in the alphabet.
4. Next, you need to insert the condition into the Condition box. Click on the Insert
button to do this.
5. You can construct more complex conditions by using the Group Start, And, Or and
Group End buttons. These allow you to use And and Or to link condition
expressions, and to control the order of their evaluation using opening and closing
brackets Group Start ( and Group End). Whenever you insert a condition into the
Condition box, it is placed after the current contents of the box. Therefore, if you
have already inserted a condition, you need to insert either an And or an Or before
inserting the next condition. Also, judicious use of brackets will ensure that complex
condition expressions are evaluated properly.
6. Once the conditions making up a filter are inserted and the relevant brackets have
been placed, you can test the filter to check that it is well-formed, that is to say, it
follows the syntax rules or "grammar" for a condition expression. Click on Test. If the
condition expression is well-formed a message is displayed: "The Query is Correct!";
if it is not well-formed, an error message is displayed with an indication of what the
error is e.g. brackets don't match, syntax error, etc. Note that a well-formed filter
expression is merely "grammatically" correct, but doesn't necessarily mean what you
want it to mean. For that you need to make sure the filter is well designed according
to the purposes you set for it.
7. To delete the contents of the Condition box as a whole, click on the Clear button. If
you only want to delete selected text, first select the text and then right-click your
mouse and select Delete (or press Del on the keyboard).
8. After you have constructed the filter from the constituent conditions and tested it to
check that it is well-formed, click on OK to apply the condition to your table. The
212 Database
calculation you defined in Average, Sum or Calculate will only be performed on the
filtered table.
Note: The conditions set through the Data menu in this way are temporary and cannot be
saved. If you wish to perform certain calculations regularly on a particular set of selected
records, it may be better for you to design a named filter and apply it to your table before
using the options in the Data menu. In this case you would not have to bother setting any
conditions in the Condition box of the “Calculate Totals” dialog.
Rearranging columns using the mouse
You can rearrange columns in a database table. This is useful when you need to have
two or more columns visible together on screen. To move a column:
1. Click once on the bar above the table to select the whole column.
2. Click again but hold the mouse button down. A small rectangle is displayed.
3. Continue to hold down the mouse button and move the rectangle to the column
immediately to the right of where you want the selected column to be positioned.
4. Release the mouse button and the table will be redrawn with the columns
rearranged.
You can rearrange as many columns as you like.
Note: Ability allows you to rearrange columns as an aid to working efficiently with your
tables. It does not, however, overwrite the field order you established when you first
designed the table. Any rearrangement of the columns will be lost when you close the
table and the original order will be reinstated. However, if you want to re-use a particular
column rearrangement, you can create a Columns selection that can be applied to your
table at any time.
Rearranging columns using a columns selection
Ability allows you to rearrange columns in a table. This can be done very easily using
your mouse (see Rearranging columns using the mouse on page 212). However,
whenever you close a table the original column order, which you set when designing the
table, is reinstated.
If particular column rearrangements are to be used frequently, it is a good idea to create
a columns selection. The selection can then be applied to the table at any time. The
rearrangement defined by the selection will be applied until you close the table or apply
another selection.
To create a columns selection, do the following when in Table Grid View:
213 Database
1. Click on the Columns
button in the Query toolbar (alternatively, select Columns
from the Format menu). The "Format Query" dialog is opened at the Columns page.
In the right-hand box, Selected Fields, all the fields in the table are listed.
2. Click on Remove All to move all the fields to the Available Fields box.
3. You can now start moving the fields back to the Selected Fields in the order you
want. Click on the field you want to be first in the table and then click on the Add
button. The field is then moved back to the Selected Fields box.
4. Click on the field you want to be second in the table and again click on Add. The field
is moved back to Selected Fields and placed after the first field.
5. Repeat the operation till all the fields have been moved and placed in the order you
want.
6. You can now give the column rearrangement its own name. Type a name in the
Name box and then click on OK. You will be asked if you want to create a new
column definition. Click on Yes.
You will be returned to the Table Grid View with the new column arrangement applied.
Note that the name of the columns selection appears in the box to the left of the
Columns button on the Query toolbar. When you next want to apply this columns
selection, all you have to do is click on the arrow at the right of the box and select the
appropriate columns selection from the drop-down list.
Hiding and showing columns in a database table
While you are working in a table you might find it convenient to hide one or more
columns. This is useful if you are currently working with only a few of the columns and
find the others a temporary distraction.
•
To hide a column right-click your mouse anywhere within the column. Select Hide
Columns from the displayed menu. The table will be redrawn on screen with the
column hidden from view.
•
To hide several adjacent columns in one go, click and drag along the column bars to
select the appropriate columns. Next, right-click and select Hide Columns from the
displayed menu. The selected columns will be hidden.
Ability prevents you from hiding all the columns by ensuring that at least one column
remains visible, but you are free to hide all the rest.
To show hidden columns, do this:
214 Database
1. Right-click your mouse and select Show Columns. The Columns page of the
"Format Query" is displayed. The hidden columns are shown in the Available Fields
box.
2. Click on a column that you want to show again and then click on Add. The column
will be moved to the Selected Fields box.
3. Repeat the operation till all the columns you want to show are moved to Selected
Fields.
4. If you want to show all the hidden columns, click on Add All.
5. Click OK and the table will be redrawn with the selected columns shown.
Ability will hide columns until you choose to show them again or until you close the table.
When you next open the table all previously hidden columns will be displayed once
again. However, if you think you might want to hide the same columns frequently, you
can create a columns selection, which can be applied at any time to your table.
Hiding and showing columns using a columns selection
Ability allows you to hide columns in a table. This can be done very easily as you work in
your table (see Hiding and showing columns in a database table on page 213). However,
whenever you close a table all the columns, which you defined when designing the table,
are reinstated. If you want to hide the same columns frequently, it is a good idea to create
a columns selection. The selection can then be applied to the table at any time. The
columns selection will be applied until you close the table or apply another selection.
To create a columns selection to hide select columns, do the following when in Table
Grid View:
1. Click on the Columns button
in the Query toolbar (alternatively, select Columns
from the Format menu). The "Format Query" dialog is opened at the Columns page.
In the right-hand box, Selected Fields, all the fields in the table are listed.
2. Click on a column that you want to hide, followed by Remove. The column will be
moved to the Available Fields box. Repeat the operation till you have moved, from
Selected Fields to Available Fields, all the columns you want hidden. The columns
remaining in Selected Fields will be shown; those in Available Fields will be hidden.
3. You can give this columns selection its own name. Type it in the Name box.
4. Click on OK and then Yes, when you are asked if you want to define a new columns
selection.
You will be returned to the Table Grid View with the new columns selection applied. Note
that the name of the columns selection appears in the box to the left of the Columns
215 Database
button on the Query toolbar. When you next want to apply this columns selection, all you
have to do is click on the arrow at the right of the box and select the columns selection
from the drop-down list. The appropriate columns will then be hidden.
Note that the converse of hiding selected columns in a table is that you show the
remainder. This columns selection could just as well be defined as a selection of columns
to be shown, rather than as columns to be hidden.
To show columns that you have previously hidden, click on the arrow in the Columns
box on the Query toolbar and select Columns - All from the drop-down list. This restores
all of the columns in the table.
If you don't want to show all the hidden columns follow these steps:
1. Right-click your mouse and select Show Columns from the menu. The Columns
page of the "Format Query" dialog is displayed.
2. Click on the columns to be shown and click on Add to move them to Selected
Fields.
3. Click on OK. You will be asked if you want to save the column definition. Click on No.
(Only click on Yes if you want to change the definition of the original columns
selection that was used to hide selected columns).
The table will be redrawn with the selected columns shown.
You can define a columns selection to show particular columns, which can then be
applied to your table whenever you like.
Sorting a table
You can sort your table records alphabetically or numerically according to the values of
key fields. In Ability sorting works in conjunction with the indexes and primary keys you
have set for fields in your table. An indexed field will sort faster than one without an index.
Also, when determining which fields to sort on, you need to take into account the types of
indexes you have assigned to the fields. For instance, non-unique indexes allow
duplicate values, and so you may wish to sort on a second field, in addition to the first,
when it is possible for the first to contain duplicates (see Indexes and primary keys on
page 191).
You can perform a simple sort on a single field or more complex sorts on several fields at
once. In addition, since any sort applied to a table is undone when the table is closed,
you can save a sort as a Sort Order and re-apply it whenever you choose.
Sorting on a single field
To do a quick sort on a single field, follow these steps:
216 Database
1. Go into Table Grid View and click on the bar above the column (field) you want to
sort on. The column will be selected.
2. Next, right click your mouse and select Sort Ascending or Sort Descending. The
records will be sorted according to the values in the column. (You can also right click
your mouse anywhere within the column without having first selected the column,
except in the current cell if it is in edit mode).
If you repeat the operation on another column, the records will be sorted according to the
values in that column without regard for the first sort.
Note: The Sort Order box on the Query toolbar indicates that the sort is Sort Order Untitled. This is the name given to any temporary sorts you apply to your table and is
redefined for each temporary sort you apply.
To cancel a sort and return to the original order of the records, right click anywhere in the
table and select No Sort (alternatively, click on the arrow in the Sort Order box and
select Sort Order - None from the drop-down list). Closing the table also cancels the
sort. If you want to re-apply a particular sort order, it is a good idea to save it as a named
Sort Order (see Sorting using a sort order on page 216).
Note: If you have set a Primary Key for your table, canceling a sort returns you to the
order imposed by the Primary Key.
Sorting using a sort order
A Sort Order allows you to sort on several fields at once. In addition, you can save a sort
order and re-apply it at will.
To create a sort order for a table, first go into the table and then follow these steps:
on the Query toolbar (or select Sort Order from
1. Click on the Sort Order button
the Format menu). The "Format Query" dialog is opened at the Sort Order page. All
the fields of the table are initially listed in the Available Fields box. You need to
select the fields you wish to sort on - and in the right order, to determine the priority
for each of the sort fields.
2. Select the first field by clicking on it and then click on Add. The field will be moved to
the Selected Fields box.
3. Select the next field and again click on Add to position it after the first field.
4. Repeat the operation till all the fields you wish to sort on have been moved to
Selected Fields. The first field has priority one; the second field priority two; and so
on.
217 Database
5. If you decide that you don't want to sort on a particular field or you have given a field
the wrong priority, just click on the field in Selected Fields and click on Remove.
The sort proceeds in this way:
First sort: the first field is sorted - this is the main sort, with priority one.
Second sort: the second field is sorted, but only if there were duplicate values in the
first field i.e. the second field is sorted within the groups determined by the duplicate
values in the first field.
Third sort - the third field is sorted, but only if there were duplicate values within the
groups in the second; and so on.
Note: This has the consequence that if your table has a primary key or a unique
index (or indexes) i.e. no duplicate values are allowed, and this is the first field to
which a sort is applied, then sorting on the other fields can have no effect, no matter
what type of indexing they have. The basic rule is that it makes sense to sort up to a
primary key or unique index field, but not beyond. So if the first two fields, say, in a
sort order are not indexed or have a non-unique index, and the third has a primary
key or unique index, you would sort up to the third field but not beyond.
6. Once you have decided which fields to use in the sort order and the order of sorting,
you can determine whether each of the fields is to be sorted in ascending or
descending order. To do this click on each of the fields in turn and click on the
Descending checkbox to impose descending order. The default is ascending, which
is indicated by an unchecked Descending checkbox. Ascending order is A…Z, 1…n,
descending order Z…A, n…1, as you would expect.
7. Give the sort order a name in the Name box and click on OK. You will be asked if
you want to create a new sort order. Click Yes to save the sort order under the name
you have given it.
You are returned to the Table Grid View with the sort order applied. The name of the sort
order is displayed in the Sort Order box on the Query toolbar. Whenever you need to
apply this sort order in future, just click on the arrow in the Sort Order box and select the
sort order from the drop-down list.
Note: If you don't give a name to the sort order, the sort order you have defined will still
be applied but it won't be saved for future use. In this case the Sort Order box on the
Query bar will say Sort Order - Untitled, which is the title given to the last applied
unsaved sort.
Filtering a table
Filtering is a way of selecting records from (or creating subsets of) a database table,
according to values that you specify for certain fields. The filter can be either a simple
218 Database
filter on a single field or a more complex filter on several fields at once. You can save and
name complex filters for future use.
Moreover, you can fine tune a named filter to apply conditions before selecting the
records. Since any filter applied to a table is undone when the table is closed, you can
save a named filter as a Filter and re-apply it whenever you choose.
Filtering on a single field
To do a quick filter on a single field, follow these steps:
1. Go into Table Grid View.
2. Choose a value in a particular column as the filter value.
3. Right-click your mouse on the cell that contains the chosen value and select, from the
drop-down menu, one of the following:
•
•
Filter Using Selection (choose one of the following operators to make a
comparison with the current selected cell e.g. if the cell contains 10 and the
operator selected is >, then only the records that have a number greater than 10
in this field will be selected)
=
Equal
>
Greater Than
<
Less Than
>=
Greater Than or Equal
<=
Less Than or Equal
<>
Not Equal
Filter Excluding Selection (select only the records that do not include this value
in this field/column).
The table will be redrawn to show only those records allowed by the filter.
Another filter can be applied on top of the first one:
1. Again right-click your mouse on a value in a particular column (this can be the same
column as before or different).
2. Select either Filter Using Selection or Filter Excluding Selection.
219 Database
You can apply as many filters as you like, each being applied to the records remaining on
view after the application of the previous filter.
To clear a filter or succession of filters, right-click anywhere within the table and select
Remove Filter from the drop-down menu (alternatively, click on the arrow in the Filter
box and select Filter - None from the drop-down list). Closing the table will also clear all
filters.
Note: The Filter box on the Query toolbar indicates that the filter is Filter - Untitled. This
is the name given to any temporary filters you apply to your table and is redefined for
each temporary filter or succession of filters you apply.
If you want to re-apply a filter you can save it as a named filter, which can then be used
as many times as you wish.
Filtering using a named filter
A named filter allows you to filter the records in a table and to save the filter for future
use. You may also filter according to the values in several fields at once. In addition, you
can specify conditions for the filter in order to fine-tune the record selection. Named filters
can be saved and re-applied whenever you like. Note that if you only wish to filter
according to the values in a single field, it is easier and quicker to use your mouse (see
Filtering on a single field on page 218).
To create a named filter for a table, first go into the table and then follow these steps:
1. Click on the Filter button
on the Query toolbar (alternatively select Filter from
the Format menu). The "Format Query" dialog is opened at the Filter page. The final
filter expression will be contained in the Condition box but built up using the
Condition Item box.
2. In the Condition Item group box you define a filter condition for each of the fields
that is to be used in the filter. Ability takes the field you select and compares all the
values in this field to the condition you specify for the filter. The filter selects only
those records where the field value fulfils the specified condition.
•
Click on the arrow in the Field box to display the full list of fields in your table and
then click on one of the fields to select it.
•
Click on the arrow in the Operator box to display the full list of operators that can
be used to construct a condition. These include operators for:
Equals (=)
Contains ($)
Begins With (<$)
Ends With (>$)
Less Than (<)
220 Database
Greater Than (>)
Less Than or Equal To (<=)
Greater Than or Equal To (>=)
Not Equal To (< >)
Is Empty ("")
Not Empty (!!)
•
In the Value box you type the value that is to be compared, using the operator, to
the values in the field you selected in Field. Alternatively you can click on the
arrow and choose a field from the drop-down list. In this case, the values of the
field in Field will be compared to the values of the field in Value, for each record
in the table.
For example, in a table that contains details on customers, you might select, say,
Customer_Name in Field and < in Operator, and type S in Value. This would filter the
table to show only the records where the Customer_Name begins with any letter less
than S, that is any letter before S in the alphabet.
3. Next, you need to insert the condition you have specified into the Condition box.
Click on the Insert button to do this.
4. You can construct more complex conditions by using the Start, And, Or and End
buttons. These allow you to use And and Or to link condition expressions, and to
control the order of their evaluation using opening and closing brackets (Start and
End). Whenever you insert a condition into the Condition box, it is placed after the
current contents of the box. Therefore, if you have already inserted a condition, you
need to insert either an AND or an OR before inserting the next condition. Also,
judicious use of brackets will ensure that complex condition expressions are
evaluated properly. If you make a mistake, you can edit the condition expression in
the normal way by right-clicking your mouse.
5. Once the conditions making up a filter are inserted and the relevant brackets have
been placed, you can test the filter to check that it is well formed, that is to say, it
follows the syntax rules or "grammar" for a condition expression. Click on Test. If the
condition expression is well formed a message is displayed: "The Query is Correct!";
if it is not well formed, an error message is displayed with an indication of what the
error is e.g. brackets don't match, syntax error, etc. Note that a well-formed filter
expression is merely "grammatically" correct, but doesn't necessarily mean what you
want it to mean. For that you need to make sure the filter is well designed according
to the purposes you set for it.
6. You can update or replace a particular condition. Select the condition you want to
replace, including its surrounding brackets, in the Condition box and create a new
condition in the Condition Item box. Click on the Update button. The selected
condition will be replaced by the new condition. Note that everything you select in
Condition will be replaced by the one condition you specify in Condition Item, so be
careful to select only the text that you want replacing before selecting Update.
221 Database
7. To delete the contents of the Condition box as a whole, click on the Clear button. If
you only want to delete selected text, first select the text and then right-click your
mouse and select Delete (or press Del on the keyboard).
8. After you have constructed the filter from the constituent conditions and tested it to
check that it is well formed, you can choose whether you want the filter to replace, act
on top of or be added to a currently applied filter. You do this in the Filter Action box
at the top right corner of the dialog. Click on the arrow and select one of Replace,
And or Or from the drop-down list:
•
Replace is the default. Any filters currently applied to your table are ignored and
the new filter is applied to all the records in the table.
•
And causes the new filter to be applied only to those records that are already
selected by a currently applied filter.
•
Or causes the new filter to be applied to all the records in the table but will also
leave selected any records that are already selected by a current filter.
9. Finally, you can give the filter a name in Name.
10. Click on OK to apply the filter. You will be asked if you want to create a new filter.
Select Yes if you want the filter to be saved for future use under the name you have
given it.
You are returned to Table Grid View with the filter applied and the filter name displayed in
the Filter box on the Query toolbar.
When you next want to apply the filter, just click on the arrow in the Filter box and select
the filter name from the drop-down list.
Filter example
This example applies some of the principles of filter design explained in Filtering using a
named filter on page 219.
Note: If you are new to filters, don't be put off by the length of the example. Since all of
the conditions that go into making the filter are created in a similar manner, most of the
example consists of "variations on a theme". Nevertheless, it should make clear to you
the importance of thinking about the structure of a filter before actually creating it, the
proper use of bracketing, and the difference between AND and OR.
Imagine you have a table, called Contacts, with three fields, viz. Name, Age, and
Occupation. You want to construct a filter that will display all contacts who are
lepidopterists and more than 70 years of age, and whose names are either Smith or
Jones (perhaps you wish to invite a select company to a private viewing of your butterfly
collection).
222 Database
The problem is to find all records such that:
(Occupation = Lepidopterist)
AND
(Age > 70)
AND
(Name = Smith OR Name = Jones).
Note that the two ANDs are specified across fields, that is we want to select records
which contain field values that satisfy the first condition AND the second condition AND
the third condition together. The one OR, which occurs within the third condition, is
specified down records, that is we want to select only those records that have either
'Smith' or 'Jones' in the Name field.
In the example, I have put AND and OR in capitals to give you an idea of the logical
structure of the final condition expression. This requires us to create four conditions in
total: three main conditions connected by ANDs, where the third condition is constructed
out of two sub-conditions connected by OR.
In the Condition Item box, create the first condition:
1. Click on the arrow in Field and select Contacts.Occupation.
2. Click on the arrow in Operator and select = Equals.
3. Click in the Value box and type Lepidopterist.
4. Click on the Insert button to insert the condition into the Condition box below.
The expression inserted is:
(Contacts.Occupation = 'Lepidopterist').
Note that the expression, as a whole, is surrounded by brackets, the typed value is
surrounded by single quotes, and the expression is selected.
5. Next, you need to insert an AND. AND is inserted at the cursor position and will
replace any selected text, so click at the end of the expression to deselect it and then
click on the And button. This gives:
(Contacts.Occupation = 'Lepidopterist') AND.
6. In the Condition Item box create the second condition:
223 Database
7. Select Contacts.Age in Field.
8. Select > Greater Than in Operator.
9. Type 70 in Value.
10. Again click on Insert.
In the Condition box this gives:
(Contacts.Occupation = 'Lepidopterist') AND (Contacts.Age > 70).
Note that 70, as a numerical value, is not surrounded by quotes.
11. Click at the end of the compound expression and click on And to get:
(Contacts.Occupation = 'Lepidopterist') AND (Contacts.Age > 70) AND.
In the Condition Item box you can now create the third and most complex condition:
12. First, select Contacts.Name in Field and = Equals in Operator, and type Smith in
Value.
13. Click on Insert to insert the condition.
14. In the Condition box click at the end of the compound expression and click on Or.
This gives:
(Contacts.Occupation = 'Lepidopterist') AND (Contacts.Age > 70) AND
(Contacts.Name = 'Smith') OR.
In the Condition Item box create the second part of the OR expression:
15. Select Contacts.Name in Field.
16. Select = Equals in Operator.
17. Type Jones in Value.
18. Click on Insert.
In the Condition box this gives:
(Contacts.Occupation = 'Lepidopterist') AND (Contacts.Age > 70) AND (Contacts.Name =
'Smith') OR (Contacts.Name = 'Jones').
224 Database
All the relevant conditions have now been inserted to form a compound condition
expression. However, you must now insert brackets in the right places to make sure that
the expression is evaluated properly. At present a filter using this expression will correctly
select all the Smiths who are lepidopterists aged over 70, but will incorrectly select all
Joneses, no matter what their occupation or age. This is because the OR has not been
restricted to work only within the scope of the third - joint - condition. Therefore, you need
to surround the two conditions connected by OR by another pair of brackets.
19. Click immediately before (Contacts.Name = 'Smith') and then click on Start ( to insert
an opening (left-hand) bracket.
20. Click immediately after (Contacts.Name = 'Jones') and then click on End ) to insert a
closing (right-hand) bracket.
This gives you the final compound condition expression for your filter:
(Contacts.Occupation = 'Lepidopterist') AND (Contacts.Age > 70) AND ((Contacts.Name
= 'Smith') OR (Contacts.Name = 'Jones')).
Rearranging it on the page should make the structure of the condition expression clearer:
(Contacts.Occupation = 'Lepidopterist')
AND
(Contacts.Age > 70)
AND
((Contacts.Name = 'Smith') OR (Contacts.Name = 'Jones')).
Compare this with the outline of the problem I gave at the start of this example.
Note that using Test will indicate a well-formed expression for both the correct version
and the previous one with the extra brackets missing. This is because both expressions
are perfectly legitimate, though they give different results. In addition, when I put in the
extra brackets after inserting all the conditions, I did this to show you the difference
brackets make to evaluation. There is nothing to stop you putting in extra brackets
immediately they are needed.
Queries
A query is a way of applying various combinations of query components to tables and
relations:
•
sort orders
225 Database
•
filters
•
column views
•
SQL statements
Queries are useful in that they allow you to apply their components all in one go, rather
than having to individually apply each one. The outcome of a query is a table in its own
right. The query table is live and so reflects the latest state of the table or relation on
which it is based. Queries can be saved, thereby allowing you to apply them whenever
you need to.
To apply a query you first need to have created a table in your database. You can
create a query from Database Manager, and you can then apply it whenever you need
to. Alternatively you can create a query while you are working in a table, and the query
can then be applied immediately.
Creating and applying a query
The following steps show you how to create a query and then apply it to a table (you
follow the same steps when you want to apply a query to a relation):
1. Go into Database Manager.
2. Right-click your mouse and select New and then Query. The "Format Query" dialog
is opened. This is where you design the new query.
3. In the Based On box click on Table (or on Relation if you want to base the query on
a relation) and then click on the arrow in the box just to the right. The drop-down list
displays all the tables in the current database. Click on one of these to select it. This
is the table that the query will be based on.
4. Next you need to select the query components that you want to apply to the table. It
may be that you have already created some of these separately in Columns, Sort
Order or Filter. If so, you can click on the arrows in the boxes in the Select Query
Components group box. In each case the existing components will be displayed in a
drop-down list. Click on the required components to select them.
5. However, you may need to design the query from scratch. Notice that the "Format
Query" dialog has pages for Columns, Sort Order and Filter, as well as Query. Click
on the respective buttons at the top of the dialog to access these pages in turn and to
design the query components. For information on designing query components, see
these sections:
Rearranging columns using a columns selection on page 212
Hiding and showing columns using a columns selection on page 214
226 Database
Sorting using a sort order on page 216
Filtering using a named filter on page 219
6. After you have designed and named a query component on a particular page, click
on a button for one of the other pages to design another component. You will be
asked if you want to create a new filter/column_definition/sort order, depending on
the page. Click on Yes (alternatively click on OK if you want to apply the component
immediately and close "Format Query").
7. You can return to a page as many times as you like to design as many components
as you think you might need for future queries based on this table.
8. Once you have finished designing the query components, go back to the Query page
of "Format Query".
9. In the Select Query Components group box choose the components that you want
the query to apply from the respective drop-down lists in the boxes. All the query
components you have just designed will appear in the lists.
10. Finally, give the query a name in Query Name and click on OK.
The query will be applied to your table and a Query table created. This is based on the
original table, with the component conditions of the query applied.
In Database Manager the new query will appear under Queries. Whenever you are in
the database you can select the query directly without having to open the original table
first. The query will always reflect any changes you have made to the table. Note that the
individual query components - sort orders, column views, filters - are listed under the
table from which the query was designed.
Select the View SQL button to design more complex queries (see SQL Guide on page
464 for more information).
Creating a query while working in a table
If you want to apply a new query while working in a table, follow these steps:
1. Select Query from the Format menu to open up the "Format Query" dialog. Note that
the table name is already selected in the Based on box. The table name is also
grayed out to show that the query you are about to create must be applied to this
table, that is you can't choose another table (or relation).
2. Select the required query components, if there be any, in the Select Query
Components box, or use the individual component pages to design new
components, as explained in Creating and applying a query on page 225.
227 Database
3. If you want to use this particular query again, then give it a name in Query Name and
click on OK (otherwise leave the name blank).
The query will be applied to the table, but you will remain in Table Grid View. If you gave
the query a name, it will appear under Queries in Database Manager. Thereafter it can
be used just like any other query; that is to say, if you select it again in future it will open
up a Query table based on the original table, without you having to go into the table first.
Editing a query
To edit a query right-click on the query name in Database Manager and then select
Format. The "Format Query" dialog is displayed. Alternatively, if you are already in a
table, query table or relation, you can select Query from the Format menu.
You can edit a query by going to the Query page in "Format Query". If you change the
name of the query, the edited query will be saved under the new name and the original
retained. If you then wish to delete the original, you can do so in Database Manager (see
Deleting a database object on page 265).
To edit a query without changing its name, that is to say, the edited query is saved under
its existing name, use the drop-down lists in the Select Query Components group box
to select the new query components (select None if you want to exchange a selected
component for no other component).
Note that in editing a query you can go to the other pages in the "Format query" dialog
and edit or create new query components as required. See Editing query components on
page 227.
When you have finished editing the query click on OK.
Editing query components
You can edit a query component in the “Format Query” dialog. This has pages for
Columns, Sort Orders and Filters, as well as Queries (see Editing a query on page 227).
There are various ways of opening the dialog:
•
In Database Manager right-click on the query component name (this will be under
the relevant table or relation name either in Column Views, Sort Orders, or Filters)
and select Format.
•
If you are already in a table, query table or relation, you can select Query, Sort
Order, Columns or Filter from the Format menu. Alternatively click on the relevant
button on the Query toolbar.
You can edit the query component by selecting the component name in the Name box
and making changes as required in the body of the dialog. When you click on OK or
228 Database
move to another page in "Format Query", you will be asked if you want to save the edited
component. Click on Yes and the component will be saved with the changes made.
If you also change the name of the component, you will be asked if you want to create a
new component. In this case the edited component will be saved under its new name and
the original component will not be changed.
If you want to delete the original you can do this in Database Manager (see Deleting a
database object on page 265).
Joining tables
When designing tables in Ability, you will often find that you are about to create a field for
information that is already held in another table. For example, you may have a table that
contains customer account information and another that contains invoice details. It would
be inefficient and unnecessary to have customer names and addresses in both tables. In
this case you would create a field, say for a unique customer account number, that both
tables could have in common, and put the names and addresses of the customers in the
customer accounts table alone.
In order to relate such tables, Ability allows you to use the device of Relations to join
tables. Joined tables must have at least one field in common, called the join field, by
which they are related, thereby making it possible to view the contents of two tables
together. The resulting table is called a Relation and you are allowed to apply Queries,
Column Views, Sort Orders and Filters to it, just as you can with normal tables.
You can join more tables to the tables you have already joined, with the proviso that each
join is between common fields for adjacent tables. For example, a name field in one table
may be joined to a name field in a second table, and an age field in the second table may
be joined to an age field in a third table, even though the first and third tables do not
share a common field.
Note: The term common field requires that the joined fields have at least the same data
type. For a join to make sense the fields should also contain similar data, that is to say,
there should be the possibility that some of the records in the joined tables contain
exactly the same data in the joined fields, otherwise there can be no match.
The data contained in a relation is a live reflection of the data contained in the tables that
are joined in the relation, that is to say, any change of data in the original tables is
reflected in the related table. Likewise, any changes you make in the related table cause
similar changes in the original tables. You can therefore update several tables while
working only in the one related table.
Whenever you join tables, all the fields from the original tables are shown in the relation.
However, what records are shown from each of the original tables depends on the type of
join you use. There are three options:
•
229 Database
Inner - only the records that have matching values in their join fields are shown
•
Left outer - all the records in the left hand table are shown but only the matching
ones from the right hand table
•
Right outer - all the records in the right hand table are shown but only the matching
ones from the left hand table
Creating a relation
To create a relation you should have already created at least two tables in the current
database. In addition, the tables should have at least one field in common. See Joining
tables on page 228 for more information.
Note: It is important that the tables to be related have their join-field, that is the field that
is to be common to the tables, set as either a primary key (in the case of the left-hand
table) or as a non-unique index or no index (in the case of the right-hand table). See
Indexes and primary keys on page 191 for more information. Indexes can be used to
control what data is entered into a field: for instance, allowing no duplicates in a primary
key field or as many duplicates as you like in an indexed or no index field. Obviously the
use of indexes facilitates a relation between, say, a customer table, which wouldn’t
normally contain more than one record per person, and an invoice table, which will often
contain several records for the same customer.
Follow these steps to create a relation between two tables:
1. In Database Manager right-click your mouse and then select New followed by
Relation. The "New Relation" dialog is displayed.
2. In the Relation Structure box you decide which tables are to be joined, which fields
are to be used as the join fields, and the type of join to be applied. Each line
represents one join from one table to another.
3. Click in the Left Table field and click on the arrow to display a drop-down list of all
the tables in the current database. Click on one of these to select it as the left table.
Notice that the large left-hand box, just above the Relation Structure box, now
displays all the fields in the table, with the name of the table appearing just above the
box.
4. Next, click in the Join Field and click on the arrow to display a drop-down list of all
the fields in the left table. Click on the field that you want to use as the join field.
5. Click on the arrow in the Right Table field to display a drop-down list of all the tables
in the database, excluding the table already selected as the left table. Select one of
these as the right table.
230 Database
6. Click in the Join Field and select the field from the right table that is to be joined to
the join field from the left table. Notice that a connecting line is drawn between the
two join fields, from the left table box to the right table box.
7. Finally, select the type of join from the Join Type box. The default is Inner, with Left
outer and Right outer as alternatives.
8. You have now defined a relation between two tables. Give the relation a name in the
Relation Name box and click on OK. You are returned to Database Manager, with
the new relation listed under Relations.
9. Open the relation by double-clicking on the relation name in Database Manager.
The relation table is displayed, along with all the fields from the two tables and the
records allowed by the join fields and join type you chose. See Joining tables on page
228 for more information on types of join.
At this point, if you want to join another table to the new relation, select Relation from the
Format menu. This returns you to the "Format Relation" dialog. Notice that the table you
chose as Right Table in the first line of the Relation Structure box is selected
automatically as Left Table in the second line. Proceed along the line, selecting the
table, join field and join type as appropriate.
You can edit the data in a relation table and thereby change the data in the underlying joined - tables. Column views, sort orders and filters can be applied in exactly the same
manner as for ordinary tables (see Queries on page 224 and Query components on page
164).
Relating tables using forms
You can relate tables by using a Database Field while in Form mode to see data from a
field in another table. The following example shows you how to go about this.
Example
You have two tables, Orders and Products, as shown below. It is your aim to design a
form that will show, for each order, the product name, the quantity, and the cost per
item.
Orders
Order_ID
Product_ID
Quantity
ORD1
ORD2
ORD3
A003
A001
A003
5
7
4
ORD4
A002
3
231 Database
ORD5
ORD6
A002
A004
Product_ID
A001
A002
A003
A004
Description
File
Lamp
Pen
Fan
2
6
Products
Cost
2.99
25.50
1.20
18.99
1. Open the Orders table.
2. Click on the View Form
the Orders table.
3. Click on the Design
button on the toolbar to open up an auto-form based on
button.
4. You now need to insert two lookup fields from Products, namely, Description and
Cost. You will need to insert each field separately, using the “Insert Field Wizard”. To
see how to do this, go to Inserting a lookup field on page 239.
Note: In this example the following selections should be made in “Insert Field
Wizard”. Since the field that connects the two tables is Product_ID, you should select
it as both the Data Field and the Lookup Field. Select the Products table as the
Lookup Source. Since we want to show the product name rather than just the
Prodcut_ID, we will choose the Description field from the Products table as the
Display Field. The same selections are made when inserting the second lookup
field, only this time you should select Cost as the Display Field.
Once you have inserted the lookup fields you should return to browse mode to scroll
through the records. The two lookup fields will display the name and the cost respectively
for each order.
You can hide any field you don’t want to see in your form (see Hiding fields from the form
on page 235).
232 Database
Form view
A form is an alternative view of a database table. In a form, the data is displayed one
record at a time in whatever layout you want. It is often easier to add and edit records in a
form than it is using the table grid view.
There are two processes in forms - creating forms and using forms - and so it has two
modes of operation: design mode and browse mode.
Design mode is used to create the page layout and to create and position fields. The
operation of a form in design mode is similar to Draw.
Browse mode is used for working with the data – you can view and edit records, create
filters to select subsets of records, hide and show fields, rearrange the order of fields,
apply sort orders and print records, just as you can in table grid view.
Any changes you make in a form are reflected in the underlying table.
The form can be created either by opening a standard auto form, or else by creating and
designing the form yourself.
Opening an auto form
The easiest way to get started with a form is to look at an auto form.
1. Select the table (or query or relation) you want to use in Database Manager.
2. Click on the View Form
the View menu.
button on the toolbar, or select the Form command from
A form is created based on the current table, along with any column views, sort orders
and filters that have already been applied in Table Grid View.
The auto form is opened in Browse mode (see Using browse mode in a form on page
233).
You can modify an auto form according to your own design while in Design mode.
Design mode
You may decide you want to make modifications to the layout of an auto form. Auto forms
make a good starting point for designing your own customized forms.
Click on the Design button
View menu.
on the toolbar or select the Design command from the
233 Database
Forms switches from browse to design mode and the toolbar changes to the Draw
toolbar.
Design mode works in a similar way to the Draw module – you can add and edit text
boxes and graphical elements (see Creating a drawing on page 386 for information on
how to use the Draw module).
Ability allows you to reposition fields in the form and to insert various types of object:
database fields, formula fields, summary fields, table grids, page numbers, date and time,
pictures, and other objects (see Creating a new form on page 236 for information on how
to use these).
If you have made any changes to the form while in design mode, you will be asked if you
want to save the changes when you try to switch to Grid View or close the form. You will
then be asked to give the form a name. This form will now be classed as a Saved Form,
rather than an auto form, and will be attached to the relevant table. Next time you are in
the table and you switch to Form View, a "Change Form Type" dialog will be opened,
which will give you the opportunity of choosing a new auto form view or the named
(saved) form view. You can create as many named form views, attached to the one table,
as you like. These can be opened directly from Database Manager (see Opening an
existing form on page 233).
To go back to working with your data, switch to browse mode by selecting the Browse
button
on the toolbar or the Browse command from the View menu.
See Editing fields in forms and reports on page 249 for information on editing and moving
fields in form design mode.
Opening an existing form
•
To open an existing form in browse mode, select the form in Database Manager and
double-click to open it (alternatively right-click and select Browse). You will go
straight into the form view without having to go into the corresponding table first.
•
To open the form in design mode, select it in Database Manager, right-click and
select Design.
Using browse mode in a form
You use browse mode to actually work with the data from your database table. In browse
mode you can page through your records, edit, add and delete records, create filter
queries to select subsets of records, hide and show fields, and apply sort orders. These
operations are the same as those you use when working in Table Grid View.
You can switch to browse mode, if you are in design mode, by clicking on the Browse
button
on the toolbar or selecting the Browse command from the View menu.
234 Database
Here’s a summary of the things you can do in forms browse mode:
•
Page up and down through the database table (see Moving around in a form on page
234)
•
Edit, add and delete records (see Adding records on page 197, Editing records on
page 235, and Deleting records on page 200)
•
Print records (current form, all forms or a subset of forms).
•
Switch to a table grid view or to form design mode.
•
Create filters (see Filtering a table on page 217)
•
Apply sort orders (see Sorting a table on page 215)
•
Hide fields (see Hiding fields from the form on page 235)
•
Show fields (see Showing hidden fields in the form on page 236)
Moving around a form
To move around a form, you would usually use the mouse and click to put the cursor
where you want it. You can use the scroll bars at the right and bottom of the screen to
view more of the form.
However, you can also move the cursor using the keyboard, and there are times when
this can be quicker. The following table shows all the ways you can move the cursor,
whether within a particular form (the same record) or to another form (another record).
Key
Description
tab
Go to the next field.
shift+tab
Go to the previous field.
home
Go to the start of current field.
ctrl+home
Go to the first record (form)
end
Go to the end of current field.
ctrl+end
Go to the last record.
page up
Scroll one screen upwards, but go to previous
record when top of page is reached
235 Database
ctrl+page up
Go to the previous record.
page down
Scroll one screen downwards, but go to next
record when end of page is reached
ctrl+page down
Go to the next record.
You can also use the buttons on the Record toolbar to move through the records in your
table.
Browsing through the database table
You can use the four movement buttons on the browse Record toolbar to move forwards
and backwards through the records in your table (whether in Grid View or Forms):
Next
Previous
First
Last
You can also use the Record menu to access the same commands.
Editing records
In browse mode all the data is “live” – you can edit the contents of fields by moving the
cursor to them and typing in new information.
Any changes you make will automatically be saved as soon as you move to another cell.
You can reverse the changes you’ve made to the current field by clicking on the Undo
button on the toolbar (or selecting the Undo command from the Edit menu).
Hiding fields from the form
You don’t need to display every field from the database table on your form. To remove a
field from Form View, right-click your mouse and select Columns. The Columns page of
the "Format Query" dialog is displayed. Remove the columns you want to hide from
Selected Fields to Available Fields. This works in the same way as for a table (see
Hiding and showing columns using a columns selection on page 214).
236 Database
Note: If you have already hidden some fields while in Table Grid View, these fields will
also be hidden when you go to Form View. This will not be the case the other way round
though, unless you use a named columns definition in forms to hide columns.
Showing hidden fields in the form
You can show hidden fields by right clicking your mouse and selecting Columns. The
Columns page of the "Format Query" dialog is displayed. Transfer the columns you want
to show from Available Fields to Selected Fields by using the Add buttons. This works
in the same way as for a table (see Hiding and showing columns using a columns
selection on page 214).
Creating a new form
Forms can be created in three ways:
•
an auto form directly from the table (see Opening an auto form on page 232)
•
an auto form which is redesigned in design mode, given a name and saved as a
named form (see Design mode on page 232)
•
a new form which is designed from scratch and is not based on an auto form (see
Creating a form from scratch on page 236)
Creating a form from scratch
To create a form from scratch rather than basing it on an auto form, follow these steps:
1. Go to Database Manager and right-click your mouse.
2. Select New and then Form from the displayed menu. A "Create Form Wizard" dialog
is displayed.
3. On the first page of the dialog choose the layout of the form in the Types box:
ƒ
Fields arranged down form
ƒ
Fields arranged across form
Click on Next to go to the following page.
4. On this page choose whether you want to base the form on a Table, Query or
Relation. Selecting, say, Table causes all the tables in your database to be
displayed in the Choose a database object box. Click on the table (or query or
relation) you want the form to be attached to, and then click on Next.
237 Database
5. On this page you choose which fields in the table (query or relation) you want to
appear in the form. Select these one by one in the Available Fields box and click on
the Add button each time to move them to the Selected Fields box (use the Add All
button if you want to move all of the fields across). You can determine the order of
the fields as you are doing this. If you make a mistake or change your mind, use the
Remove buttons.
6. Click on Finish.
A new form is created and displayed in design mode. The fields chosen from the
attached table (or query or relation) are displayed in the order and with the form layout
type you set.
It is a good idea at this point to save the form and give it a name. Select Save Form from
the File menu. You will then be asked to give the form a name. Click on OK once you
have done this.
Note that in form design mode the drawing toolbar is displayed. This has the same
functionality as the toolbar in Draw. You can draw lines, shapes and frames, and add
text.
Ability allows you to insert database fields (that is, fields from the attached table that you
may have forgotten to select in Available Fields), formula fields, summary fields, table
grids, page numbers, date and time, pictures, and other objects.
You can resize form fields and inserted fields or move them to different locations in the
form: click on the field and drag the handles to resize, or move the field by dragging and
dropping the whole field in a new position when the crossed arrows appear.
See
Inserting the date and time into a form or report on page 248
Inserting a picture into a form or report on page 248
Inserting an object into a form on page 248
Inserting fields into a form
You can insert various types of field into a form when in design mode:
•
Database Field
•
Formula Field
•
Lookup Summary Field
238 Database
•
Table Grid
These can be accessed individually by selecting them from the Insert menu. All four use
the standard "Insert Field Wizard" dialog, with each being designed on its own page.
Inserting database fields into a form
To insert a database field into a form you first need to make sure you are in form design
mode. You can insert any field from those already in the attached table or a field from
another table.
If you based the form on an auto form, then you merely need to show fields that you have
previously hidden. However, it could be that you want a field to appear more than once in
the form. In this case you need to specifically insert the field.
If you created a new form and did not base it on an auto form, then it could be that you
forgot to include a particular field or that you want some field to appear more than once.
Again, in this case, you need to insert the field.
For information on how to insert a database field, see Inserting a database field on page
81.
Inserting a database field
To insert a database field into a form or report, follow these steps:
1. Select Database Field from the Insert menu.
2. The mouse pointer will turn to a cross. Use your mouse to position the cross at the
point where you want the database field to appear (you can move this again later, if
you want).
3. Click once. The "Insert Field Wizard" dialog is displayed, turned to the database field
page.
4. In the Database Field group box you choose the field you want to insert. Note that
the Database Name line gives the name of the current database and its file path, and
the Data Source line identifies the table (or query or relation) to which the form or
report is attached.
5. Click on the arrow in the Data Field box to display a drop-down list of all the fields in
the attached table. Select the field you want to insert. The name of the field will also
appear in the Field/Label Name box. This is the name that will appear as the label
for the field in the form or report. You can edit the label name if you want, although
the field itself will retain the name you gave it when designing the table.
239 Database
6. Click on Next to go to the Control Type page. Here you can select a control type for
the field (see Control types on page 416). If you want to insert the field you chose, in
step 5, from the attached table, leave all the control types blank. (However, see
Inserting a lookup field on page 239 for information on using the combo box control
type with lookup fields).
7. Click on Next to go to the next page, where you can determine the font, alignment,
gap and position for the field label (see Editing field labels on page 259).
8. Click on Finish to close the "Insert Field Wizard" and return to form design mode or
report view.
The new database field will be inserted.
Repeat the process for every database field you want to insert.
Inserting a lookup field
A lookup field is a type of database field and can be inserted into a form or report. It is
useful when you want to insert a field from another table into a form or report based on
the current table. A lookup field can also be used to link to a field in another table while
displaying the data from a different field.
To insert a lookup field into a form (or report), you should first make sure you are in form
Design mode (or Report View for a report), and then follow these steps:
1. Select Database Field from the Insert menu.
2. The mouse pointer will turn to a cross. Use your mouse to position the cross at the
point where you want the database field to appear (you can move this again later, if
you want).
3. Click once. The "Insert Field Wizard" dialog is displayed, turned to the database field
page.
4. In the Database Field group box you choose the field you want to insert. Note that
the Database Name line gives the name of the current database and its file path, and
the Data Source line identifies the table (or query or relation) to which the form or
report is attached.
5. Click on the arrow in the Data Field box to display a drop-down list of all the fields in
the attached table. Select the field you want to insert. The name of the field will also
appear in the Field/Label Name box. This is the name that will appear as the label
for the field in the form or report. You can edit the label name if you want, although
the field itself will retain the name you gave it when designing the table.
240 Database
6. Click on Next to go to the Control Type page. To insert a lookup field select the
Combobox option (see Control types on page 416 for more information on control
types).
7. Click on Next to go to the next page, where you can determine the font, alignment,
gap and position for the field label (see Editing field labels on page 259).
8. Click on Next to go to the design page for the Combobox control type.
9. In the Control Source group box click on the Lookup Choices checkbox to switch it
on.
10. Click on the Lookup Source button and select a table (or query or relation) from the
“Lookup Source” dialog.
11. Click on the Lookup Field arrow and select a field from the lookup source table.
12. Click on the Display Field arrow and select the field whose contents you want to be
displayed in the inserted lookup field.
13. Click on Finish to close the "Insert Field Wizard" and return to form design mode or
report view.
The new lookup field will be inserted. In forms you should now click on the Browse
button to return to browse mode, where you can scroll through your records.
Inserting formula fields into a form or report
To insert a formula field into a form (or report), you need to be in form design mode (or
report view) first, and then follow these steps:
1. Select Formula Field from the Insert menu.
2. The mouse pointer turns to a cross. Place this where you want the field to appear
and click once on your mouse. The "Insert Field Wizard" dialog is displayed, turned to
the formula field page.
3. In the Formula Field group box you design the formula you want to insert. You can
either type a formula directly into the Formula box or create a formula by clicking on
the Functions button to access the standard Ability functions. If you leave the
Formula box empty the inserted formula field can be used as a normal text field.
4. If you want to show the formula rather than its result, click in the Show Formula
checkbox to switch it on.
5. Click on Next to go to the control type page, where you can choose what sort of
control to use with the formula (see Control types on page 416).
241 Database
6. Click on Next to go to the last page, where you can set field specific attributes, such
as Hide Zeros, Hide Errors, and Edit Source.(for setting up two-way links).
7. Click on Finish to close the "Insert Field Wizard" and return to form design mode (or
report view).
The formula field will be inserted at the place you chose.
Repeat the process for every formula field you want to insert.
Inserting a lookup summary field into a form or report
The lookup summary field establishes a join between a selected field in one table (the
table that is attached to your form or report) and a matching field in a second table (the
joined table). It then uses this join to summarize the information held in a selected
numeric field from the joined table. The matching records from the joined table are
grouped together according to the field values from the first table.
To insert a summary field into a form (or report) you need to be in form design mode (or
report view) first, and then follow these steps:
1. Select Lookup Summary Field from the Insert menu.
2. The mouse pointer turns to a cross. Place this where you want the field to appear
and click your mouse once. The "Insert Field Wizard" dialog is displayed, turned to
the lookup summary field page.
3. In the Data Field box you select a field from the attached table. Click on the arrow to
display a list of all the fields in this table and click on one of these to select it.
4. In the Lookup Field Source group box you select the table (or query or relation) and
field you want to join to and the field in the joined table for which a summary is to be
calculated:
•
Click on the button to the right of the Join Source box. A list of all the tables (or
queries or relations) in the current database is displayed. Click on the table you
want to join to, and then click on OK.
•
In the Join Field box, click on the arrow to display a list of all the fields in the
table you have just selected in Join Source. Click on one of these. (Note that it
is your aim to match records in the table to which Data Field belongs with
records in the Join Source table, so make sure you select fields that have the
same data type and the possibility of some matching values. For example, you
might select a Surname field in both.)
242 Database
•
In the Lookup Field box, you select the field in the joined table that contains the
information which is to be summarized. Since most summary information is
calculated using numeric values, this should nearly always be a numeric field.
•
In the Lookup Formula box you select the type of formula to apply to Lookup
Field. Choose from the following list:
ƒ
Count (counts the number of matching records)
ƒ
Sum (sums the values in the matching records)
ƒ
Minimum (finds the minimum value in the matching records)
ƒ
Maximum (finds the maximum value in the matching records)
ƒ
Average (finds the average value of the matching records).
Obviously this normally requires that the field you select in Lookup Field be of
numeric data type. The exception is Count, which can be used to count the
number of matching records irrespective of the data type of the Lookup Field.
5. Finally, click on Next and then on Finish to insert the lookup summary field at the
place you chose.
Using lookup summary fields in forms or reports: example
This example shows you how to use lookup summary fields in forms and reports (see
Inserting a lookup summary field into a form or report on page 241).
You have two tables in a database, one called Employees which contains employee
names and ID numbers, and another called Holidays, which contains employee ID
numbers and information on holidays yet to be taken by each employee by the end of the
year, excluding the general Christmas holiday.
Employees
ID
Surname
First_name
1
SMITH
JACKIE
2
ROACH
PHILIPPA
3
ENGLAND
CHRIS
4
COLEMAN
JOEL
5
SMITH
JAMES
243 Database
6
HOWLETT
PAULINE
Holidays
ID
Holidays
Days
6
November 2 - 5
4
5
October 2 - 15
10
4
October 3 - 7
5
6
December 1 - 5
5
1
October 21 - 23
3
4
December 2 - 4
3
5
November 18 - 22
5
Your aim is to make a summary of each employee’s holiday entitlement. Note that not all
the employees have holiday entitlement and that of those who do some have more than
one period, that is to say, they are listed more than once in the Holidays table. Note also
that there are two employees called Smith, hence the importance of using a unique
identifier, in this case an ID number, for each employee.
You can insert a lookup summary field into any form or report that is already attached to
the Employees table. Make sure you are in form design mode or report view first.
To insert a lookup summary field follow these steps:
1. Select Lookup Summary Field from the Insert menu and click once at the place
where you want the field to appear.
2. In "Insert Field Wizard" do the following:
•
In the Data Field box, select the ID field from the Employees table.
•
In the Join Source box, select the Holidays table.
•
In the Join Field box, select the ID field from the Holidays table as the common
field.
244 Database
•
In the Lookup Field box, select the field from which you want to extract summary
information. Obviously in this case it is the Days field in the Holidays table.
•
In the Lookup Formula box, select one of Count, Sum, Minimum, Maximum
and Average. In this case select Sum. These work as follows:
Count gives the number of periods of holiday for each employee;
Sum gives the total number of days of holiday for each employee;
Minimum and Maximum give the number of days of holiday in the shortest and
longest periods respectively for each employee;
Average gives the average number of days of holiday for each employee across
all the periods.
3. Click on Next and then click on Finish.
4. It is a good idea to save the form (or report) at this point. Select Save Form (or Save
Report) from the File menu and give the form a name.
The summary field is inserted.
If you have inserted the lookup summary field into a form, click on the Browse button to
go to browse mode. You can now use the Record buttons to move through the forms.
Each form corresponds to a record in the original Employees table.
Since you have selected Sum in the Lookup Formula box, the result in the summary
field in each form will be the total number of days of holiday for the corresponding
employee i.e. the corresponding ID number.
For employees without holiday entitlement, that is those with ID numbers that do not
appear in the Holidays table, a #REF message is displayed in the summary field,
indicating that there is no reference from that ID number in Employees to a
corresponding ID number in Holidays.
Inserting a table grid into a form
Ability allows you to insert a table grid into a form. The inserted table establishes a join
between a selected field in the attached table (on which the form is based) and a
matching field in a second table (the joined table) from the same database. It then uses
this join to select matching records from the two tables according to the values in the join
field. The join fields should be of the same data type and have the possibility of
containing common data.
To insert a table grid into a form you need to be in form design mode first, and then follow
these steps:
245 Database
1. Select Table Grid from the Insert menu.
2. The mouse pointer turns to a cross. Move this to where you want the field to appear,
hold down the left button and drag the cross to create a box outline for the table.
Release the button. The "Insert Field Wizard" dialog is displayed, turned to the table
grid page.
3. In the Data Field box click on the arrow to display a list of all the fields in the form's
attached table. Select the field that is to be the join field.
4. Click on the button to the right of the Join Source box to display a list of all the tables
(or queries or relations) in the current database. Select the table you want to join to,
and then click on OK.
5. Click on the arrow in the Join Field box to display a list of all the fields in the table
you selected in Join Source. Select the field that you want to join to the field you
selected from the attached table in Data Field. Click on Next to go to the next page.
6. On this page you select the fields (columns) from the joined table that are to be
displayed in the inserted table. By default all the columns are listed in the Hidden
columns box. Select the columns, in turn, that you want to be visible, and then click
on Show for each one to move it to the Visible columns box. Note that in this
manner you can also determine the order of the columns in the inserted table.
7. Finally, click on Finish to insert the table into the form.
8. Since the form is in design mode, click on the Browse button
mode.
to switch to browse
In browse mode you can scroll through the records from the attached table using the
Record buttons. The inserted table will display the information from the fields you chose
to show from the joined table, according to whether the join field matches the
corresponding field in the attached table. Where there was no match the inserted table
will be empty.
Inserting a table grid into a form: example
You have two tables in a database, one called Employees which contains employee
names and ID numbers, and another called Holidays, which contains employee ID
numbers and information on holidays yet to be taken by each employee by the end of the
year, excluding the general Christmas holiday.
The aim is to display a table in forms for each of the records in the attached table.
Employees
246 Database
ID
Surname
First_name
1
SMITH
JACKIE
2
ROACH
PHILIPPA
3
ENGLAND
CHRIS
4
COLEMAN
JOEL
5
SMITH
JAMES
6
HOWLETT
PAULINE
Holidays
ID
Holidays
Days
6
November 2 - 5
4
5
October 2 - 15
10
4
October 3 - 7
5
6
December 1 - 5
5
1
October 21 - 23
3
4
December 2 - 4
3
5
November 18 - 22
5
Assuming you have already created a form that is attached to the Employees table and
that you are in form design mode, follow these steps:
1. Select Table Grid from the Insert menu.
2. Position the cross at the place you want in the form, depress the left mouse button
and release.
3. In "Insert Field Wizard" make the following selections:
•
In Data Field select the ID field from Employees
247 Database
•
In Join Source select the Holidays table
•
In Join Field select the ID field from Holidays
•
Click on Next to go to the next page
4. Move the ID and Days fields from Hidden columns to Visible columns, using the
Show button.
5. Click on Finish to insert the field.
6. Click on the Browse button
to switch from design mode to browse mode.
Use the Record buttons to move through the forms. Since each record in the attached
table has a corresponding form view, there will also be a corresponding table in each
form. The table will have fields for ID and Days.
The first form will show a table with ID number 1 and Days 3; the second form (for ID 2,
that is Philippa Roach) will show a blank table (there is no ID 2 in the Holidays table); the
sixth form will show a table with two records (ID 6, that is Pauline Howlett, has two
holiday periods of 5 and 4 days respectively); and so on for the other forms.
Inserting a page number into a form or report
To insert a page number field into a form (or report) you need to be in form design mode
(or report view):
1. Select Page Number from the Insert menu.
2. The mouse pointer turns to a cross. Place this where you want the field to appear
and click once on your mouse.
3. The page number field will be inserted at the chosen place.
(a) In forms, click on the Browse button
to switch to browse mode. As you use
the Record buttons to scroll through the forms, each form will display its own
page number. If you alter the order of the records by applying a sort order, the
new order of forms will still be numbered consecutively from 1 upwards.
(b) In reports, click on Print Preview. Each page will be numbered in order. Note
that with a report it makes sense to put the page number in the Page Header or
Page Footer.
248 Database
Inserting the date and time into a form or report
To insert the current date and time into a form (or report) you should be in form design
mode (or report view):
1. Select Date and Time from the Insert menu.
2. The mouse pointer turns to a cross. Place this where you want the date and time field
to appear and click once on your mouse.
3. The field will be inserted at the chosen place.
(a) In forms, click on the Browse button
to switch to browse mode. Each form
will now contain the current date and time.
(b) In reports, click on Print Preview. Each page will display the date and time. Note
that the date and time field is repeated every time the section where it was
inserted is repeated.
Note that the date and time field is live and so will alter as the date and time change.
Inserting a picture into a form or report
To insert a picture into a form (or report) you should be in form design mode (or report
view):
Select Picture from the Insert menu. The "Open" dialog is displayed. You should locate
the directory of the required picture file as normal and then double-click on the file (or
click on Open) to close the dialog and insert the picture. Note that before the picture is
inserted the mouse pointer, which will have turned to a cross, should be moved to a
suitable position in the form before clicking once. You can always move or resize the
picture once it has been inserted.
Once you have inserted the picture field, click on Browse
to switch to browse mode
in forms (or click on Print Preview in reports). The inserted picture will be displayed in
each of the forms (or in the report).
Inserting an object into a form
To insert an object into a form you should be in form design mode:
1. Select Object from the Insert menu.
2. The mouse pointer turns to a cross. Move this to where you want the object field to
appear, click and drag your mouse to create a box for the object field, and release.
249 Database
3. The "Insert Object" dialog is displayed, in which you can locate the object that is to be
inserted.
4. Once you have inserted the object field, click on Browse
mode.
to switch to browse
The inserted object will be displayed in each of the forms.
Editing fields in forms and reports
You can change the position and size of any field in your form (or report) and edit the
field's properties. To do this you need to be in form design mode (or report view):
Left-click on the field to resize it using the handles and to reposition it by dragging.
To change the properties of a field, left-click on the field to select it and then right-click
and select Properties from the drop-down menu (alternatively, left-click on the field to
select it and edit individual properties by selecting them from the Format menu). The
"Format Object Style" dialog is displayed. Note that the properties accessible in the
dialog depend on the type of field you are editing.
The following table lists the properties that you can edit:
Field property
Description
General
Data fields, data sources, formulas used in the field, etc.
Color
Background and foreground color of the field
Font
Font styles and sizes
Style
Pen and brush styles
Border
Border types
Align
Align the field's contents left, right or center
Control
Edit control type
Label
Edit placement and alignment of label
Attributes
Choose various field attributes e.g. Hide Zeros, Edit Source
Format
Display format for numbers, dates, and times
250 Database
Multi-page forms
Ability allows you to use more than one page when designing a form. You may find that
you have too many fields to fit onto a single page, and so need to use another.
Before selecting the type of field to insert or the shape that you want to use to create a
drawing, go to the required page by using the right hand and bottom scroll bars (to scroll
below and to the right of the first page respectively).
The new page will be visible on screen for you to insert fields and design drawings. Note
that extra pages are available both below and to the right of the first page.
Reports
Reports provide a powerful method of analyzing database information and allow you to
present your data in a more attractive and effective way. The basic data in a report
comes from an underlying table (or query or relation), although you can summarize the
data and also insert various types of field. The report can be designed using the full
resources of the Draw module. You can preview a report on screen and then print it for
maximum impact.
Opening an auto report
Auto reports are an easy and efficient way of creating reports. When browsing any table,
relation or query, you can always create an auto report with a single click, as in step 4
below. To get the most out of this feature though, it is best to select the columns, sort
order and filter conditions for the report first , as follows:
1. In table grid view, select the columns you want to see in the report – if you start with
all columns, use the right mouse button to hide the columns you don’t want (for more
details on column selections, see Hiding and showing columns in a database table on
page 213).
2. Apply any filters you want. Use the right mouse button to perform a quick filter
selection; alternatively use the filter dialog for a more complex filter– see Filters on
page 217 for more details.
3. Still in table grid view, select a sort order for the report. Sorting has special
significance for the auto report: data will be sorted and grouped together, with group
totals appearing automatically. You can sort on multiple levels – see Sort orders on
page 215 for more details.
4. Finally, select the Report button
or select Report from the View menu.
251 Database
The report is initially divided into several sections separated by bars. Each bar heads its
own section, in which you can display data or enter text and graphics. Here is a list of the
bars and what they stand for:
•
Report Header - a header for the whole report on the first page
•
Page Header - a page header for every page (by default, the table field names)
•
Detail - the main body of the report, which displays the table fields
•
Page Footer - a page footer for every page
•
Report Footer - a footer for the whole report on the last page, which automatically
displays total summary information for some of the fields
Note that the Draw toolbar is also displayed.
Detail of an auto report
•
An auto report places the fields from the underlying table in the Detail section.
•
In the Page Header section the names of these fields are displayed underlined in
text boxes. You can see that the page headers will be used as titles for the columns
in the report.
•
The Report Header and Page Footer sections are left empty for you to insert fields,
if you wish.
•
The Report Footer section automatically displays total summaries for several of the
fields displayed in the Detail section: the first Character field (Count) and all the
Numeric fields (Sum).
The basic detail filled in by the auto report is sufficient to produce a good example of how
on the toolbar to see how the auto
a report works. Click on the Print Preview button
report will look when printed, with all the relevant data displayed (see Viewing a report in
print preview on page 263 for information on previewing your reports). Return to Report
View by clicking on Close.
You can edit an auto report to change its layout, add or delete fields, insert summaries,
format the sections, and so on (see Editing reports on page 257).
Any graphics, fields or text boxes you insert into a section will be repeated whenever the
section is repeated in Print Preview. For instance, since a page header is repeated at
the top of every page, any objects inserted into the page header section will also be
repeated at the top of every page. Also, since the fields in the Detail section represent
252 Database
one record in the underlying table, any objects inserted will be repeated for every record
displayed in Print Preview.
If you make changes to an auto report, when you try to close it you will be asked if you
want to save the report. If you say Yes, you will then be asked to give the report a name.
In future when you switch to Report View from an open table, you will be given the
choice of opening another auto report or an already existing named report based on this
table.
You can open a named report directly from Database Manager (see Opening an existing
report on page 252).
Opening an existing report
To open an existing report, select the report name in Database Manager and then do
one of the following:
•
Double-click to open the report in Print Preview
•
Right-click and select either Preview to go straight into Print Preview, or Design to
go into Report View.
You will go straight into print preview or report view, without having to open the
corresponding table first.
Creating new reports
To create a new report from scratch, follow these steps:
1. You first need to go into Database Manager.
2. Right-click your mouse and select New, followed by Report. The "Create Report
Wizard" dialog is opened.
3. On the first page of the dialog you choose the type of the report, from these options:
•
Fields arranged across report
•
Fields arranged down report
•
Labels
(see Types of report on page 254 for more information)
The following steps assume you have selected either Fields arranged across report or
Fields arranged down report (since Labels works slightly differently, see Labels in
reports on page 255).
253 Database
4. Click on Next to go to the next page of the dialog.
5. On this page you choose a database object on which to base the report. Select one
of the following:
•
Tables
•
Queries
•
Relations
Selecting Tables, say, will cause all the tables in the current database to be
displayed in the box. Click on one of the tables (or queries or relations) to select it as
the database object, and then click on Next to go to the next page.
6. On this page you choose the fields whose data you want to be displayed in the main
body of the report, that is in the Detail section. Click on these one by one and use the
Add button to transfer them from the Available Fields box to the Selected Fields
box. Remember that you can determine the order of the fields at this point. If you
make a mistake just use the Remove buttons and start again. Go to the next page.
7. On this page you choose the way the report is to be grouped. Since you can have
groups determined by the values of one field, and groups within these groups
determined by the values of another field, it is important to order the fields correctly.
Therefore make sure that the field which determines the primary group comes first,
the field which determines the secondary group comes second, and so on. To select
the fields for the groups, click on these one by one in the Available Fields box and
use the Add button to transfer them to the Selected Fields box. If you make a
mistake use the Remove buttons and start again. You can select up to three group
fields. See Sorting and grouping in a report on page 260 for more information.
Note: Groups automatically have a sort order applied to them. By default this is
ascending for each group field (hence the “ASC” appended to each field in Available
Fields), although you can change this when you edit a report.
8. On the last page, you choose the fields for which you want to calculate summary
values:
•
In the Field column all the fields to which summaries can be applied are listed.
•
Next, select the type of summary you want to be applied. The options are:
Count (counts the number of records)
Sum (calculates the total for the values in a numeric field)
Avg (calculates the average of the values in a numeric field)
254 Database
Min (finds the smallest of the values in a numeric field)
Max (finds the largest of the values in a numeric field).
Note that the type of summary available depends on the data type of the field. So
for a character field, for instance, the only summary option is to count the number
of records, and for a numeric field all the summary options are applicable. By
default, the first character field has its Count option switched on, and all numeric
fields have their Sum option switched on. You can change these and also select
extra summary types for a particular field.
9. Once you have chosen the layout, associated table, report fields, group fields and
summary options for your report, click on Finish to close the dialog.
The new report, based on the database object you chose, is displayed. The selected
fields are displayed in the Detail section and the selected group fields are displayed in
the Group Header sections. The Group Footers and the Report Footer all display the
summary fields and types of summary you chose.
Whether labels and/or page headers are also displayed depends on the type of the
report. See the following sections for more details:
Type of report: vertical fields on page 255
Type of report: horizontal fields on page 255
Labels in reports on page 255
At any time you can switch to Print Preview
to check what the report will look like.
The new report can be saved and named. Select the Save Report command from the
File menu and enter a name for the report. Alternatively, if you close the report you will
be asked whether you want to save it, and if so what name you want it to have.
The report will appear under Reports in Database Manager and can be opened directly
from here in future.
See Editing reports on page 257 for information on how to edit your report.
Types of report
When you create a new report from scratch, you can choose from one of three basic
report types. These are:
•
Fields arranged across report (see Type of report: horizontal fields on page 255)
•
Fields arranged down report (see Type of report: vertical fields on page 255)
255 Database
•
Labels (see Labels in reports on page 255)
Once the report is created, based on one of the three types, it is likely that you will want
to edit it to suit your own purposes. For instance, you can rearrange fields, display some
fields and hide others, choose whether to display labels, resize sections, etc. and, of
course, insert graphics, other fields and text.
Type of report: vertical fields
•
In the Detail section of this report type the selected fields are arranged vertically, one
above another, with their labels displayed to the right, one for each field.
•
Each group field (if there are any) is placed in its own Group Header section, with its
label placed directly above it. The primary group field is placed at the left of its
header; the secondary group field is placed at the next position along in its header;
and so on.
•
The effect of this in Print Preview is to display the values from the fields in a column,
each value being identified by its label. If the report is grouped, the groups are clearly
sectioned off from one another and each section is headed by a different value from
that particular group field, along with the group label, which remains the same
throughout the sections defined by a particular group field.
Type of report: horizontal fields
This report type has the same basic format as an auto report.
•
In the Detail section of this report type the selected fields are arranged horizontally,
but no labels are displayed. Instead, the names of the fields are displayed as titles in
text boxes in the Page Header section.
•
Each group field (if there are any) is placed in its own Group Header section, with its
label placed directly above it. The primary group field is placed at the left of its
header; the secondary group field is placed at the next position along in its header;
and so on.
•
The effect of this in Print Preview is to display the values from the fields in a row,
each value being identified by the title in Page Header under which it falls. If the
report is grouped, the groups are clearly sectioned off from one another and each
section displays a different value from that particular group field, with the group label
remaining the same throughout the sections.
Labels in reports
You can create mailing and other types of label in a labels report. The report is based on
a table (or query or relation). Obviously for mailing labels the table should contain names
256 Database
and addresses. To create a label report from scratch, go to Database Manager and do
the following:
1. Right-click your mouse and select New followed by Report.
2. In the "Create Report Wizard" select Labels.
3. On the next page:
•
select the type of label from the Available labels box (the default is Custom)
•
select the number of columns of labels per page in the Columns box (the default
is 2)
•
fine tune the label width and height in the Label box
•
change the horizontal and vertical gap between labels in the Gap box
4. On the next page select the table, query or relation on which you want to base the
label report.
5. Next, choose the fields that are to be displayed in the first line of the label report (e.g.
these might be title, first name and surname fields). Use the Add button to transfer
these from the Available Fields box to the Selected Fields box.
6. On the next page you choose the fields that are to appear on the subsequent lines,
making sure that you transfer them in the order you want (just use the Remove
button if you make a mistake). Label reports display one record per label, using only
the fields you have previously selected.
7. Click on Finish to close the dialog and go into Report View.
The selected fields are displayed in a column in the Label section. Note that in the case
of a label report you cannot rearrange the fields at the Report View stage (if you have
made a mistake in the order of the fields which you haven’t corrected at the Wizard
stage, then it is best to start again).
You can change the font style, the fore- and background colors, the border style, and so
on, of any field. In addition you can exchange one field for another. To do any of these
select the field you wish to format by clicking on it. Right-click and select Properties from
the drop-down menu. In the “Format Object Style” dialog select from the available tabs:
General, Color, Font, Style, Border, Align, Label.
You can also use the Draw toolbar on the left to insert shapes and text boxes.
To see what the labels will look like, click on the Print Preview button
on the toolbar.
257 Database
At this point you can click on the Print button to print the labels, otherwise click on Close
to return to Report View.
If the printing of the label contents appears to near to the edge of the physical label,
select all the fields and drag them left and/or down.
To save and name the report, select the Save Report command from the File menu.
Inserting fields in a report
You can insert various types of field into a report. These are accessible through the
Insert menu:
•
Database Field (see Inserting a database field on page 81)
•
Formula Field (see Inserting formula fields into a form or report on page 240)
•
Lookup Summary Field (see Inserting a lookup summary field into a form or report
on page 241)
•
Group Summary Field (see Group summary fields on page 261)
If you want an inserted field to appear just once in every report, you need to insert it into
the Report Header or Footer.
If you want it to appear on every page, insert it into the Page Header or Footer.
Insert it into the Detail section if you want it to appear with every record.
Editing a report
You can edit a report to:
•
Add and remove fields (see Inserting fields in a report on page 257)
•
Format sections (see Format sections in reports on page 259)
•
Relocate and edit fields (see Editing fields in forms and reports on page 249)
•
Edit field labels (see Editing field labels on page 259)
•
Add graphics and text (see Creating a drawing on page 386)
•
Resize sections (see Resizing the sections in a report on page 258)
258 Database
Resizing the sections in a report
When you first enter a report you will see that the sections of the report are placed in
close proximity to one another. To resize the sections so that there is enough space to
enter text, create graphics and insert fields, you should do the following:
1. Resize a section by moving your mouse pointer to the border of the bar above the
following section. The mouse pointer turns to a double vertical arrow.
2. Click and drag the border to the required place, and then release the mouse. The
section is resized.
For instance, to resize the Report Header section, move the mouse pointer to the top of
the Page Header bar. When the vertical arrows appear, click and drag and then release
to resize.
You can perform this operation on any of the sections, whenever and as many times as
you like, till you get a suitable size for all the sections. Appropriate section sizes are
important, not just for creating space to design a report but also for display purposes. For
instance, if you reduce a section so that certain fields are not visible in Report View,
neither will these fields be visible in Print Preview, and hence they will not be shown
when the report is printed.
You can also resize the height of sections in the “Sections Properties” dialog (see Format
sections in reports on page 259).
Headers and footers in a report
There are three types of headers and footers in a report:
•
those for the report as a whole
•
those for the pages
•
those for the groups (see Sorting and grouping in a report on page 260 for more
information on group headers and footers).
The Report Header will appear once at the top of the report, that is, on the first page,
and the Report Footer will appear at the bottom of the report, that is, on the last page.
The Page Header and Page Footer will appear at the top and bottom respectively of the
individual pages in the report. When you open an auto report directly from its underlying
table, the Page Header section contains by default the field names, underlined, from the
table. These will be displayed at the top of each page, although you can edit them (or
delete them if you don't want them to appear at all).
259 Database
To enter text or graphics into a header or footer, use the buttons on the Draw toolbar
(see Creating a drawing on page 386. You can also insert page numbers (see Inserting a
page number into a form or report on page 247) and the date and time (see Inserting the
date and time into a form or report on page 248) into a header or footer.
Note that if you have created a report header and a page header, the report header
always occurs before the page header on the first page of the report. Similarly, a report
footer always occurs after the page footer on the last page of the report.
Format sections in reports
You can format the sections in a report in various ways. In Report View select the
Sections command from the Format menu. The “Section Properties” dialog is displayed.
All the sections in your report are listed in the Section Name column, including any group
headers and footers you may have created. For each section you can format the
following properties:
1. Background Color: click in the field to display an arrow and then click on the arrow
and select a color from the drop-down list. The default is white.
2. Height: type in a new height for the section.
3. Breaks: click in the field to display an arrow and select one of the following from the
drop-down list:
•
Continuous: sections run on from one another (this is the default)
•
New Page: a new page is started every time the section is printed
4. Visibility: click in the field to display an arrow and select one of the following:
•
Yes: the section will be displayed in Report View and Print Preview (this is the
default)
•
No: the section will not be displayed in Report View or Print Preview
5. Click on OK once you have formatted the new section properties.
Report View is redrawn to reflect the new formats.
Editing field labels
You can determine the font, alignment, gap and position for database field labels in forms
and reports (and group summary fields in reports). This can be done when you insert a
new field (see Inserting a database field on page 81 and Group summary fields on page
261). Alternatively, for an already existing field with a label, first select the field by clicking
260 Database
on it once when in Form Design Mode or Report View, then right-click and select
Properties, followed by Label in the “Format Object Style” dialog.
On the Label page, follow these steps to edit a label:
1. Choose whether you want the label to be displayed (or not) by clicking the Show
Label box on (or off).
2. In the Placement box you choose whether the label is to be displayed Over, Under,
Before or After the field.
3. In the Horizontal Align box (for Over or Under) or Vertical Align box (for Before or
After), choose whether to align the label Left, Center or Right, or Top, Baseline or
Bottom respectively.
4. In the Gap box you can edit the default value to set the gap you want between the
label and the field.
5. Click on the Font button to set a font, style, size and color for the label.
Sorting and grouping in a report
Ability allows you to group records that have common values in a particular field. This is
accomplished by sorting on the field. In Reports the sorting command automatically sorts
the records in ascending order (according to the values in the chosen field) and then
sections off the records with common values.
Within the groups created by this primary grouping, you can create a secondary grouping
for records with common values in another of the fields, and so on. The secondary
grouping is created by the second sort. In this way Ability provides an effective method of
structuring the data in a report. In addition, you can manipulate a report so that the values
of group fields act as titles for each group.
You can choose which fields to sort and group on in both Table Grid View and Report
View. This is accomplished through the Sort Order page of the “Format Query” dialog,
although grouping itself will only be applied when you are in a Report. To create groups
in an auto report or in an already existing report do the following:
1. Click on the Sort Order
button on the Query toolbar. The “Format Query” dialog
is opened at the Sort Order page.
2. The Available Fields box shows all the fields in the table (or query or relation) upon
which the report is based. To group records by a particular field, click on the field
name to select it and then click on the Add button. The field name is copied to the
Selected Fields box. Ability will look at every value under this field in the table and
arrange the records into groups, each group of records having a common value in the
specified field.
261 Database
3. You can choose ascending (the default) or descending order for the records. Click on
the field in Selected Fields to activate the Descending checkbox. For a descending
order, make sure the Descending checkbox is switched on, and for an ascending
order, leave it blank.
4. It may be that you want to group the records within the primary groups. To do this,
click on the field in the Available Fields box that you want to group by, and again
click on Add to copy it to the Selected Fields box. It is placed after the primary group
field. This tells Ability to sort and group by the first field, and then, within the groups
so created, sort and group by the second field.
5. Again you can set an order for the secondary group field. Select the field in the
Selected Fields box and switch the Descending checkbox on or off. Note that the
secondary grouping can have a different sort order from the primary grouping. You
can have as many groups as there are fields in the original table, although of course
you would only want to group where it is appropriate.
6. To sort and group you need to switch on the Group on report checkbox for each of
the selected fields that you want to group. If you leave the checkbox blank, the sort
order (or orders) will be applied but the sorted records will not be grouped.
7. Once you have defined your groups and their sort order, click on OK to close the
dialog and return to the report.
The report is redrawn to show a new set of headers and footers for each group. Anything
you insert into a group header or footer will be displayed at the head or foot of each
group in the report (the full effect of this is only apparent when you go in to Print Preview
- see Viewing a report in print preview on page 263).
Ability automatically gives your report a default layout – see Layout of a grouped report
on page 262.
Group summary fields
Group summary fields are used to provide summary information of various types for the
groups in a report. You can summarize any or all of the groups individually by inserting
a Group Summary Field into the relevant Group Footers or Headers. In addition, you
can obtain a total summary for all of the groups combined, by inserting a Group
Summary Field into the Report Footer or Header. To insert a Group Summary Field
into a report, follow these steps:
1. Make sure you are in Report View.
2. Click in either a Group Header or Footer section (for individual group summaries), or
in the Report Footer or Header section (for total report summaries).
3. Select Group Summary Field from the Insert menu.
262 Database
4. The mouse pointer will turn to a cross when you move it over the report. Use your
mouse to position the cross at the point in the section where you want the Group
Summary Field to appear (you can move this again later, if you want) and click once.
5. The “Insert Field Wizard” dialog is displayed, turned to the Group Summary page:
(a) In the Database Field box, the current database is displayed in Database Name
and the table upon which the report is based is displayed in Data Source. These
are fixed and can’t be changed by you. Click on the arrow in Data Field and
choose, from the drop-down list of all the fields in your table, the field for which
you want a summary. Note that a label is created for this field in the Field/Label
Name box, which you can edit if you like.
(b) In the Formula box, click on the arrow to display the list of available summary
options for the chosen field. These are:
•
Count (counts the number of records)
•
Sum (adds the values if the field is numeric)
•
Minimum (finds the minimum value if the field is numeric)
•
Maximum (finds the maximum value if the field is numeric)
•
Average (finds the average value if the field is numeric)
6. Click on the Next button to go to the next page. Here you can set various formats for
the label that accompanies the inserted field (see Editing field labels on page 259).
7. Click on Finish to close the dialog and return to Report View.
The Group Summary Field is inserted into the section.
If you want to insert another field just repeat the above steps.
To see what the report will look like, click on the Print Preview button on the toolbar.
Note that a Group Summary Field inserted into a group header or footer provides
summary information for each of the groups, and one inserted into a report header or
footer displays total summary information for all the groups combined.
Layout of a grouped report
•
Once you have chosen the groups for your report and returned to Report View you
will see that extra headers and footers have been added for the groups. These group
headers and footers are named after the fields they have been based on. The group
headers are placed between the page header and the details section, and the group
footers are placed between the page footer and the details section. The first or
primary group header is placed above the secondary group header, and so on for
263 Database
any other group headers. The primary group footer is placed below the secondary
group footer, and so on for any other group footers.
•
The group headers cause the report to display the value for each of the groups at
the head of each group. The same is true for any secondary groups that are
contained (nested) within the primary groups. Each of the values from a group field
can be said to act as a title for its own group section. You may wish to display the
labels that accompany the group fields. Switch to Print Preview to get a clearer
idea of the effect of grouping.
•
In the Detail section the report automatically displays all of the fields from the
underlying table. Since for a grouped report the values from one or more of these
fields will appear at the head of each group, you may want to delete some of the
fields in Detail.
•
In the group footers and the report footer, there are displayed several summary
fields: the first Character field from the underlying table is counted and all the
Numeric fields are summed. Thus each grouped section has its own summary
information. This applies to the secondary and lower level groups, as well as the
primary ones. You may want to delete some or all of these, or add others. Similarly,
the Report Footer contains summary information for the whole of the report, and can
also be edited.
•
You can easily relocate fields within the sections by clicking and dragging.
•
The default report layout is designed to contain enough information to make
subsequent editing easier for you. For instance, it is much easier to delete the fields
you don’t want and to relocate the remaining fields, than to have to insert fields that
are not displayed.
See Editing reports on page 257.
Using queries in reports
When you create a report, it will retain any query formats that were already set in the
underlying table. This includes filters, column views, and sort orders. If you then save the
report it will retain the query formats. These can be changed in Report View by using the
options on the Query toolbar. You can do this in the same way as for Table Grid View
(see Query components on page 164).
Viewing a report in print preview
Whenever you enter a Report View you are enabled to view the basic design of the
report. Here you can insert objects, create graphics, resize the sections and generally
edit the report's design. What you do not see is the report as it will appear when printed,
that is, with all its data, summaries, groups, etc.
264 Database
•
To view the report as a report you need to click on the Print Preview button
the Standard toolbar (or select Print Preview from the File menu).
on
This takes you to the print preview page, where the report as it will appear when printed
is displayed. At this stage you can check the report for its overall layout, its group order,
the contents of headers and footers, the position of labels, and other features.
•
Use the Zoom and Page buttons and the scroll bars to see more of the report.
To make changes click on Close to close the preview and return to Report View.
Printing a report
To print a report, follow these steps:
1. Open the report as a Report View
2. Switch to Print Preview (use the button
File menu)
on the toolbar or the command in the
3. Click on the Print button in Print Preview to print the report.
Note that to set up a page prior to printing a report, you need to be in Report View, not
Print Preview. Select Page Setup from the File menu and choose the page margins,
paper orientation, paper size, and printer. You can then print from Print Preview.
Deleting a database
To delete a database, you should be in the Ability Database window and make sure that
the database you want to delete is closed:
1. Select Open Database from the File menu. The "Open existing database" window is
displayed.
2. Locate the database to be deleted and right click on it.
3. Select Delete from the displayed menu. You will be asked if you are sure that you
want to delete this database. Click on Yes and the database will be deleted.
If the database is open, an error message will be displayed and you will not be allowed to
go ahead with the deletion (see Closing a database on page 163).
265 Database
Deleting a database object
To delete a database object (tables, relations, forms, reports, queries, sort orders,
filters, column views) follow these steps:
1. Go to Database Manager.
2. Right click on the object you wish to delete and select Delete from the menu.
3. You will be asked if you are sure that you want to proceed with the deletion. Click on
Yes and the object will be deleted.
Note that when you delete a query, any query components you created when designing
the query are retained under the relevant table name.
Repairing a damaged database
On rare occasions you may find that you are unable to open a database, or, if you can
open it, that its behavior is unpredictable. It is more than likely that the database has
somehow become damaged. This can be caused, for instance, by a power failure when
you are trying to write to the database, or by a general hardware fault. Repair Database
will try to solve any such problems.
In addition, you may have deleted data from the database and therefore wish to reclaim
space that is no longer used. Compact Database compresses the database and frees
up the unused space.
Ability combines these operations in the one command.
To repair and compact a database, follow these steps:
1. Make sure you are in the Ability Database Window but that the database you want to
repair is not open (select Close Database from the File menu to close the current
database).
2. Select Compact and Repair Database from the Tools menu.
3. In the Database to Compact From box select the required database.
4. The title of the box will change to Compact Database Into. Give the database a new
name in the File name line and click on Save.
5. After a few seconds the database will be compacted and repaired.
Note that you can now delete the old database and rename the new one with the original
name, if you wish.
266 Database
Importing tables
You can import tables into an Ability Database. The imported tables can come from an
earlier version of Ability, another database in Ability, or another program altogether. In
addition, you can append an imported table to an existing table in Ability (see
Appending imported tables on page 267).
To import a table you should first open the Ability database into which the table is to be
imported (see Opening a database on page 161). Once you are in Database Manager
do the following:
1. Select Import from the File menu. The “Import” dialog is opened.
2. In the Data Source box, select the type of database from which you want to import
and then click on OK. The “Open” dialog is displayed with the selected database type
in the Files of Type box.
3. Locate the database you want to import from by using the Look in box. Once it has
been placed in the File name box, click on Open.
4. The “Import” dialog is opened. All the tables in the source database are listed in the
Objects box. Click on the table you want to import, to select it, and then click on OK.
The table will be imported to the current Ability database and will be listed under Tables
in Database Manager. You can now go ahead and work with the imported table as you
would with any table created in Ability.
Exporting tables
You can export tables from an Ability Database. The exported tables can be exported to
another database in Ability or another program altogether.
To export a table you should first open the Ability database from which the table is to be
exported (see Opening a database on page 161). Once you are in Database Manager,
do the following:
1. Select Export from the File menu. The “Export” dialog is opened.
2. In the Data Destination box select the type of database to which you want to export
and then click on OK.
3. In the Objects box all the tables in the current Ability database are listed. Select the
table you want to export and click on OK.
4. The “Save As” dialog is opened. The destination database type is displayed in the
Save as type box. Locate the destination database in the Save in box and select it to
place it in the File name box.
267 Database
5. Click on Save to export the table to the selected destination database.
Open the destination database and the exported table will be shown in the Database
Manager (or equivalent, depending on the program). You can now go ahead and work
with the exported table as you would with any table created in the destination database.
Appending imported tables
You can append an imported database table to a table in Ability. This is useful if you want
to append, say, an address table to an address table. The two tables should therefore
have similar contents and the fields that are to be matched should be of the same data
type (for instance, it wouldn’t make sense to append a character field to a numeric field).
To append the imported table (the Source table) you should first open the table in Ability
that you want to append to (the Destination table), and then follow these steps:
1. Select Import from the File menu. The “Import” dialog is opened.
2. In the Data Source box, select the database type from which you want to import.
Note that the Append to current table box is switched on. Click on OK.
3. In the “Open” dialog, use the Look in box to locate the source database and place it
in the File name box. Click on Open to open the “Import” dialog.
4. In the Objects box, select the table you want to import and then click on OK.
5. The “Field Correspondence” dialog is opened. The Source table fields and
Destination table fields boxes list all the fields in the two tables. The Current
correspondences among the fields box displays, on the left, all the fields in the
source table and, on the right, any matches Ability has been able to make between
the tables. You can add and delete matches as follows:
•
To remove a match, select that line and click on Delete.
•
To make a match select the fields to be matched in the Source table fields and
Destination table fields boxes respectively, and then click on Add. The
matched fields are linked in the Current correspondences among the fields
box. If you attempt to match fields with incompatible data types, an error
message will be displayed and the match will not go ahead.
•
Once you have created the appropriate matches, click on OK to close the dialog
and return to the destination table.
Records will be appended to your table from the imported source table, with values
shown in the appropriate match fields.
268 Photopaint
Photopaint
Photopaint is an image editing and creation program that allows you to perform a wide
range of design tasks, from editing of family photographs for fun to creation of subtle
effects in the design of advertisements to promote your business. To this end you will find
all the necessary tools for manipulating and experimenting with images, allowing you to
paint, tone, erase, edit and apply special filter effects.
The secret of successful image editing and creation lies in the use of two important
Photopaint features: selections (see Selections on page 274) and layers (see Layers on
page 317).
Most of the time when you begin to work with any image, you will find it useful to select
some area that you want to concentrate on, while leaving the rest of the image
untouched. (Selections can be seen as similar in concept to the highlighting of text in a
word processor before changing a font.) In Photopaint you can select the whole image or
drag the mouse over a rectangular or other shaped area. Once an initial selection is
made, you can change the shape of that selection, proceed to select all other parts of the
image of a similar color, and so on. Moreover, once you have made a selection you can
then zoom in on the selected area, thereby making it easier to apply delicate and subtle
effects. There are many powerful tools to help you select exactly what you want.
Although a printed image is a two-dimensional arrangement of colors, the creation of the
image can utilize a feature called layers. Layers allow you to create a finished image by
adding to and editing the image on different levels, which can be understood on the
analogy of several panes of glass stacked together. They have a certain (controllable)
transparency, and different images can be painted on each layer, the overall effect
depending on what order you use to stack the layers. The order of the layers can be
changed as you see fit. Mastering layers simplifies the task of combining component
images.
So, the basic elements of Photopaint are:
Selections on page 274
Paint and draw tools on page 284
Filters on page 304
Layers on page 317
269 Photopaint
Starting Photopaint
Start Photopaint from the menus:
1. Select the Start button on the Windows task bar
2. Select Programs and then Ability Office
3. Select Ability Photopaint
The first thing you’ll notice about the opening screen is the lack of standard toolbars. This
is because you need as much of your screen as possible to view the image. Photopaint
has floating toolboxes that automatically appear according to the task in hand. The only
toolbar that is immediately visible is the Tools bar, which contains the various paint and
selection tools. In addition, there are three other basic toolboxes: Layers, Information
and Recent Colors. These can be turned on and off in the View menu.
Creating a new image
Create a new image by selecting New from the File menu.
The “New” dialog is displayed.
Here you can set the width, height and resolution of the image window that is to be
created and choose a scale of measurement (pixels, inches, cm, picas, or points).
Give the image a name in the Title box if you don’t want to use the default name.
The Contents box allows you to choose a color for the default background layer: Fore
color, Back color, or Transparent. The default is Transparent, which normally shows
as a checkerboard pattern. (You can change the shading and size of the checkerboard
pattern in File/Preferences/Grid. A grid size of none in effect creates a blank sheet,
either light, medium or dark according to the setting.)
For now, just press OK. A new image window will be created.
270 Photopaint
Note that the background is displayed as a checkered pattern (officially called Level 1 in
a new image - see Layers on page 317). This denotes transparency , a concept which is
of great importance in Photopaint. It may seem odd at first, but there is an important
difference between “nothing” and, say, a white background: you can put images onto a
transparent background and whatever is beneath the background will show through
where there are no other images. If it were solid white, any background would be
obscured. Of course if there is only one layer, there is nothing to see beneath a
transparent background. The full effect of transparency is best seen with the use of layers
(see Layers on page 317).
Along the bottom of the image window you can see the current magnification (actual size
is 100%) and the number of pixels available for the width and height of the image.
271 Photopaint
On the left the Tools bar is visible.
You can at this point begin using the paint tools straightaway
(see Paint Tools on page 284).
At the bottom of the Tools bar you’ll see the Foreground and
Background Color boxes. These will be important throughout
Photopaint. (See Color selection on page 271)
Color selection
The two boxes at the bottom of the Tools bar are the
Foreground and Background Color boxes. They are
interchangeable using the double-arrow button just below. The
higher box is always the foreground color and the lower box
the background color.
Whenever you use a paintbrush or pencil tool, it is the current foreground color that is
applied. Whenever you erase pixels from the background or lowest layer in an image, it is
the current background or foreground color, depending on which one you chose in the
“New” dialog, that shows through in a printout, in Print Preview or when viewed through a
higher transparent layer.
272 Photopaint
You can change the color in either of the boxes by clicking on the box to open up the
“Select Color” dialog.
In here you can select a color by using the mouse to drag the crossed lines in the larger
box or the single line in the tall thin box. The latter gives you an approximate color range,
while the former enables greater fine tuning. Alternatively, you can set a color exactly by
entering the right figures for Hue, Saturation, Brightness, Red, Green and Blue in the
boxes to the right. You can also use the respective sliders to do this. The result will be
displayed immediately in the Preview box. Whichever way you set the color all the
relevant indicators will change together to reflect the current color: the color boxes, the
Preview box, the sliders, and the measurement boxes. Once you are satisfied, click on
OK.
The relevant color box on the Tools bar will be given the new color.
Note that as you change the colors in the Foreground and Background Color boxes,
the old ones are stored in the “Recent Colors” dialog. (If this is not visible, select Recent
Colors from the View menu.)
273 Photopaint
Select any of these colors to make it the current Foreground Color.
You can use the Color Picker (see Color picker on page 300) to select a color from an
image and make it the Foreground Color.
While we are on the topic of color it is worth mentioning that the Information dialog
(select View/Information if this is not visible) can give you useful data about the color
values in an image, amongst other valuable pieces of information (see Information dialog
on page 274).
Opening an existing image
You’ll probably spend most of your time editing already existing images, especially
photographs that have been scanned, rather than designing new images.
In this case, select Open from the File menu and use the “Open” dialog to locate and
open the required file.
The image file will appear in the Photopaint window as a file of the type in which it was
originally opened. Since there are some file types which do not preserve any layers you
might have added, you may choose to use Save As from the File menu to convert the file
into a Photopaint image file (that is, with extension .apx). This guarantees that any layers
you add will be preserved, rather than being flattened onto the original image’s
background (where they cannot be recovered on a subsequent opening of the file).
Photopaint files will, of course, require more memory to preserve layers.
Once you have opened the file, the image will appear in the image window. At first it will
be displayed using the actual pixel size and therefore might be larger than the image
window. If you would like to see the whole of the image, select Fit on Screen from the
View menu.
The image will appear on a layer called Background, unlike a new image where the
background layer is called Level 1 (see Layers on page 317 for some notes on the
difference between the two).
At this point you can immediately begin to use the paint and selection tools on the image.
However, you probably don’t want to change the background image itself, so it is best to
create a duplicate layer, hide the background and proceed to edit the duplicate or create
further layers. All this is explained in the section on layers (see Layers on page 317).
274 Photopaint
Another option is to create a duplicate of the image file, using Duplicate in the Image
menu. You can then work with the duplicate and leave the original untouched. Whatever
you do it is highly recommended that you have at least one untouched version of the
original file.
Information dialog
The “Information” dialog contains useful information about the color values, selection
dimensions and current position of the pointer in an image window. It can be a valuable
source of instant information as you work on an image.
To open up the dialog, select Information from the View menu.
There are four sections in the dialog:
R G B in the top-left corner gives the respective values (between 0 and 255) for red,
green and blue in any color that the pointer is currently passing over.
C M Y K in the top-right corner gives the respective percentage values for cyan,
magenta, yellow and black in any color the pointer is currently passing over.
X Y in the bottom-left corner gives the coordinates in pixels (horizontal and vertical
respectively) of the current pointer position.
W H in the bottom-right corner gives the width and height of a current selection, hence
helping you to size selections accurately as you make or edit them.
Selections
Photopaint allows you to select parts of images or photographs. The advantage of
selection is that you can work on a particular area within an image, without having to
worry about altering areas outside the selection boundary. You may, for instance, want to
change the color scheme in only one part of an image, leaving the rest of the image
untouched. Since all images in Photopaint are pixel-based there is no way of
automatically selecting, say, the head of a man from a picture that includes the rest of his
body. Unlike a mere software package, only you, as perceiver, have a definite concept of
parts of the body. This is where the selection tools come to your aid in helping you target
the areas you want to work on.
275 Photopaint
There are several ways of making selections, each achieved through its own selection
tool. The selection tools are grouped together at the top of the Tools bar, which is visible
on the left-hand side of the screen when you open up a file. (If it is not visible, select
Tools from the View menu).
Once you have made a selection, you can later edit it to refine its borders, change its
position or alter it in some other way. There is a range of editing options available through
the Transform Selection tool and the Select menu.
If you have already made a selection, the application of another selection will always
override the first.
The selection tools available are:
Rectangular Selection on page 275
Elliptic Selection on page 275
Single Row Selection on page 276
Single Column Selection on page 276
Lasso on page 276
Polyline Lasso on page 276
Magic Wand on page 276
B-Spline Selection on page 277
Crop on page 277
Rectangular selection
Outline of selection is always comprised of horizontal and vertical outlines, joined in a
tool on the Tools bar. Hold down the
rectangle. Click on Rectangular Selection
mouse and drag the cross until required horizontal and vertical area is selected.
Elliptic selection
Outline of selection is always elliptical or circular. Click on Elliptic Selection
tool on
the Tools bar. Hold down mouse and drag the cross till required area is surrounded by
ellipse or circle.
276 Photopaint
Single row or single column selection
A single line selection selects one row or column of pixels. Click on Single Row
or
tool on the Tools bar. Click mouse once at point through
Single Column Selection
which you want row or column to run. To reposition line just click at another point.
Lasso
The lasso tool gives you the freedom to create a selection outline by hand. Click on the
tool on the Tools bar. Hold down mouse and drag lasso symbol around area
Lasso
you wish to select. When mouse is released the ends of an incomplete outline will
automatically be connected by a straight line. This may cut off part of the area you wish
to select, so it is best to complete the outline yourself by finishing off at the starting point.
Polyline lasso
The outline is formed by a series of straight lines, joined point to point. Click on the
tool on the Tools bar. Click at the point where you want the outline
Polyline Lasso
to start. Click at the next point. A straight line will immediately connect the two points.
Continue clicking at various points till the outline is complete and then right-click. If you
do not complete the outline by finishing on the start point, the start and finish points will
automatically be connected by a straight line.
See
Selections on page 274
Magic wand
This tool automatically makes a selection based on the brightness of adjacent pixels
within a certain threshold. For example, if you click on a solid yellow circle placed within a
larger blue one the selection will outline the yellow smaller circle. If you click on the blue
circle the outline will appear round the blue circle and also round the yellow circle, that is,
it will select the whole of the blue area and exclude the yellow area (rather like a ring
doughnut).
Click on the Magic Wand
tool on the Tools bar. The “Magic Wand” dialog allows
you to set the threshold value between 0 and 255. The default value is 32. The threshold
determines what range of pixels will be selected by the Magic Wand in relation to the
original selected pixel. A value of 0 will result in only the adjacent pixels of exactly the
same brightness being chosen. The higher the threshold value the greater the range of
pixels selected, according to brightness. At 255 almost everything is guaranteed to be
included in the selection.
277 Photopaint
Anti-aliasing is a technique for softening the edges of a selection by surrounding the
edges of the selection with a one-pixel transition. You should nearly always leave the
Anti-alias box checked.
B-spline selection
The outline of this selection uses smooth curves to join a series of points.
Click on the B-Spline Selection
tool on the Tools bar.
Click at the point where you want the selection to begin. Click at the next point. The two
points will be joined by a curve. Proceed with the clicking as you move around the area to
be selected. Try to keep the points close-in to the area to ensure the accuracy of the
selection. Finally click on, or at least near, the start point.
To finish, just right-click. The start and finish points will automatically be joined to
complete the selection.
Crop
The Crop tool allows you to draw a rectangular border round the area you want to keep,
everything outside this selection being discarded.
tool on the Tools bar and drag the mouse until a reasonably
Click on the Crop
accurate selection is made. Release the mouse button. You can refine the crop by
moving the mouse over the handles, at which point a cross will appear. Depress the left
button and drag till you are satisfied with the selection on that particular border. Do the
same with the other borders, as required.
To perform the crop, right-click and select Crop.
Selection editing
Once you have made a selection using any of the selection tools (see Selections on page
274), it is possible to fine tune the selection in various ways, for instance, to make it fit an
area more closely or to expand the selection borders.
There are two main ways of editing selections. In the Select menu you can apply such
features as feathering, inversion, smoothness, and so on. Using the Transform
Selection
tool you can alter a selection dynamically, changing the selection’s
position, angle, shape, and so on. Both of these will be dealt with.
278 Photopaint
Selection menu
You can edit a selection in various ways through the Select menu. Most of the options in
this menu are grayed out until you have actually made a selection using one of the
selection tools, as you would expect. Here are some of the most important option
available through the Select menu.
•
All selects the whole of the visible window, putting a selection border around it. (Note
that it is best not to use this option if it is your intention to edit the whole of the image.
Although the image as it stands may occupy only the visible window, it is possible
that at some time you may only have a part of the image visible, the rest stretching
outside the window boundaries. In this case the selection will always be restricted to
just that part of the image that is visible. It is best, therefore, to select the appropriate
layer without making a selection within the layer.
•
None clears any current selection. (Note that on occasions you may try to add color
to an image to no avail, even though you are on the right layer and the layer is
visible. It is more than likely that in these cases you have not cleared a selection
properly, that is, you have clicked on the screen when a selection tool is active and
reduced the selection to a barely visible dot, outside of whose boundaries nothing
can be done until the selection is cleared.)
•
Invert reverses the area currently selected in the visible window. If, for example, you
have a small circle selected and you then apply Invert, a selection border will appear
around the whole of the visible window in addition to the circle selection. This means
that the selection is now the area between the circle border and the outer selection,
that is everything in the visible window excluding the area within the original
selection.
•
Feather softens the edges of a selection when color is applied at the selection
boundaries. In effect, feathering creates a transition area of increasing transparency,
which gives an appearance of gradual, gentle succession from the selected to the
unselected pixels.
The Feather radius is set in the Radius box in the “Feather” dialog and is measured
in pixels. The greater the radius (2 to 50 is the range) the greater the extent of the
feathering.
Note that the effects of using Feather are only seen with colors applied after
feathering has been applied to a selection. The immediate effect is merely to expand
the selection boundaries in accordance with the radius set by you.
•
Border takes the current selection as a basis for creating a new selection of a
specified width. The original selection is then abandoned. The border width is set in
the Width box of the “Border” dialog and is measured both in and out from the
boundary of the current selection.
279 Photopaint
If, for example, you have a circular selection and then you apply a border of 5 pixels,
the new selection will consist of a circular band with borders 5 pixels in and five pixels
out from the original selection, rather like a ring doughnut.
•
Smooth reduces the rough edges of a selection. Only the selection outline is
affected, not the colors within the selection. In the “Smooth Selection” dialog, set the
Radius at a value from 2 to 50 pixels. The higher the radius the greater the
smoothing that will occur.
•
Expand increases a selection by expanding its boundaries outwards. The degree of
expansion is determined by the value you enter in the Expand by box in the
“Expand” dialog. The range is from 2 to 50 pixels.
•
Contract decreases a selection by contracting its boundaries inwards. The degree of
contraction is determined by the value you enter in the Contract by box in the
“Contract” dialog. The range is from 2 to 50 pixels.
•
Transform Selection is used for dynamic editing of selections and actually activates
the Transform Selection tool on the Tools bar (see Transform selection tool on page
279).
•
Grow uses a current selection to select adjacent areas of the same color as the
selection. Grow works best when the currently selected area contains a single color.
•
Similar uses a current selection to select the same color throughout an image. The
areas of color need not be adjacent. Similar works best when the currently selected
area contains a single color.
•
Selection to Alpha deletes the whole of the image on the current layer except for
any areas you have selected.
•
Alpha to Selection selects all colored areas on the current layer. On a layer which is
otherwise transparent there will be as many selections as there are separate areas of
color.
•
Make Pattern uses the current selection to store a pattern in the “Pattern” dialog.
This dialog is called upon by several of the tools, especially the Pattern brush on
page 288 .
Transform selection tool
This tool enables you to take a selection and transform it in various ways. Transform
Selection works only on the selection boundaries and not on the image within the
selection (use Transform Image on page 283 if you want to transform the selected image
itself). To transform a selection, obviously you need to have made a selection first, using
one of the selection tools on the Tools bar (see Selections on page 274).
280 Photopaint
Click on Transform Selection
on the Tools bar. A rectangular box is placed around
the selection, no matter what the shape of the selection. Handles are placed on the
boundaries of the box and a moveable star-like symbol placed at its center.
The mouse pointer becomes an arrow inside the box, a cross while placed over any of
the handles, and a curved double-headed arrow outside the box.
To move the selection as a whole, place the pointer inside the box and drag the arrow to
a new position. The whole of the selection is moved to the new position. Note that the
image within the original selection boundaries stays put when the selection is moved.
To stretch the selection, place the pointer over the relevant handle or handles and drag
the cross to a new position. The selection border will be repositioned.
To rotate the selection, move the pointer anywhere outside the box and drag the curved
double-headed arrow to a new position. Note that the selection rotates round the star-like
symbol at the center of the box. You can move this symbol by clicking and dragging on it;
the selection will henceforth rotate round the new position.
You can cancel a transformation by pressing Esc on the keyboard or selecting Undo
Transform from the Edit menu.
The above operations are together known as Free Transforms, that is they are applied
by you by hand, using the mouse, and are all available simultaneously. More precise and
automatic transforms can be performed by right-clicking (or selecting Transform in the
Edit menu) and choosing an option from the displayed menu (see Transform options on
page 281). In choosing one of these options, you automatically make the others
unavailable. For instance, while scaling you will be unable to rotate the selection.
See also:
Transform Image on page 283
281 Photopaint
Transform options
The Transform options are applicable to both Selections (see Transform Selection on
page 279) and Images (see Transform Image on page 283).
They are available either by right clicking over a selection box or by selecting Transform
in the Edit menu i.e. after you have selected either the Transform Selection or the
Transform Image tool in the Tools box. Note that each of the options transforms either
the selection itself or the image within the selection, depending on whether you have
chosen Transform Selection or Transform Image respectively.
The options include:
Scale
Scale the transformation box either horizontally or
vertically by dragging the handles. The selection will
be scaled to match the new box dimensions.
Rotate
Rotate the transformation box by dragging the
double-headed arrow outside the box. The
selection will rotate with the box. Note that the starlike symbol acts as the center of rotation and can
be repositioned.
Skew
Skew the transformation box by dragging a handle
in the direction of the line on which it is situated.
You can drag the handle in only one direction at a
time. The selection will adjust to fit the skewed box.
Note that dragging a center-of-line handle moves
the whole of the line.
Distort
Distort the transformation box by dragging any
handle in any direction. The selection will adjust to
fit the distorted box. Note that dragging a center-ofline handle moves the whole of the line.
Perspective
The dragged handle will move in the direction of the
line of the transformation box. If the handle is at a
corner, the opposite corner will move the same
distance in the opposite direction. Note that
dragging a center-of-line handle moves the whole
line.
282 Photopaint
Numeric
In the “Numeric Transform” dialog set the Position
values in the X (horizontal) and Y (vertical) boxes.
Leave the Relative box checked if you want the
transformation box to move relative to the current
position, rather than move to a position starting
from the top left-hand corner of the window i.e. X =
0 & Y=0.
Set the Scale values in the Width and Height
boxes. These will scale the width and height of the
transformation box. If you want the scaling to be in
proportion leave the Constrain Proportions box
checked. Whatever you set for the width will also be
automatically set for the height, and vice versa.
Uncheck the box to set these separately.
Set the Skew values, in degrees, in the Horizontal
and Vertical boxes. You can set the angle of skew
anywhere between -60 and 60 degrees.
Set the Rotate value, in degrees, in the Angle box.
The possible values run through -179 (clockwise
283 Photopaint
from the x-axis) to 180 (anti-clockwise from the xaxis) degrees. Note that there is also an Angle
Indicator: use your mouse to turn the little circle on
the circumference of the big circle to set a new
angle. The value in the Angle box will be
automatically adjusted.
Rotate
Rotate the selection by 180 degrees, 90 degrees
clockwise or 90 degrees counter-clockwise.
Flip
Flip the selection either horizontally or vertically.
Transform Image
This tool enables you to take a selected image or part of an image and transform it in
various ways. This distinguishes this tool from the somewhat similar Transform
Selection (see Transform selection tool on page 279), which merely transforms selection
boundaries rather the image that is selected. Note that Transform Image only works with
a selection and therefore you need to apply one of the standard selection tools first.
on the Tools bar. Handles will appear on the boundaries
Click on Transform Image
and a moveable star-like symbol will appear in the center of the selection.
The mouse pointer becomes an arrow inside the selection, a cross while placed over any
of the handles, and a curved double-headed arrow outside the selection.
To move the selected image as a whole, place the pointer inside the selection and drag
the arrow to a new position. The whole of the selected image is moved to the new
position.
To stretch the selected image, place the pointer over the relevant handle or handles and
drag the cross to a new position. The selection border will be repositioned and the image
stretched to fit the new border.
284 Photopaint
To rotate the selected image, move the pointer anywhere outside the selection and drag
the curved double-headed arrow to a new position. Note that the selection rotates round
the star-like symbol at the center of the selection. You can move this symbol by clicking
and dragging on it; the selection will henceforth rotate round the new position.
You can cancel a transformation by pressing Esc on the keyboard or selecting Undo
Transform from the Edit menu.
The above operations are together known as Free Transforms, that is they are applied
by you by hand, using the mouse, and are all available simultaneously. More precise and
automatic transforms can be performed by right-clicking (or selecting Transform from the
Edit menu) and choosing an option from the displayed menu (see Transform options on
page 281).
See also:
Copy, Cut and Paste on page 327
Paint tools
The paint tools allow you to apply and edit colors and special tone effects. These tools
can be found on the Tools bar on the left-hand side of the screen (Select Tools from the
View menu if this is not visible).
The available paint tools are:
Pencil on page 285
Paintbrush on page 286
Airbrush on page 286
Eraser on page 287
Duplicate on page 288
Pattern Brush on page 288
Blur on page 289
Sharpen on page 289
Emboss on page 290
Dodge on page 291
Burn on page 291
285 Photopaint
Smudge on page 292
Historic Brush on page 298
Pencil
This tool enables you to draw using a brushstroke with hard edges, as with a real pencil.
Click on Pencil
on the Tools bar.
In the “Brushes” dialog choose the method of applying the pencil from the following:
•
enables you to draw directly with the current foreground color, the
Free Hand
path of the applied color following the movement of the mouse when the button is
depressed.
•
Spline
enables you to plot a series of connected curves by clicking at the
relevant points. To finish, right-click and the curves are replaced with the foreground
color.
•
enables you to plot a series of connected lines by clicking at the
Line Drawing
relevant points, which are replaced with the foreground color when you right-click.
•
enables you to draw an ellipse by dragging the mouse till you have the
Ellipse
wanted shape and size. On releasing the mouse button the ellipse is converted into
the foreground color.
•
enables you to draw an arc (or incomplete circle). Click on the spot which
Arc
you want to be the center of the arc and move the mouse (there’s no need to keep
the button depressed) till you have the required dimensions. Click once more and use
the mouse to move clockwise to reduce the angle of the arc from a full circle or anticlockwise to increase the angle from zero. Click once more to replace the arc with the
foreground color.
•
Rectangle
enables you to draw a rectangle by dragging the mouse till you have
the required dimensions. On releasing the button the sides of the rectangle are
replaced with the foreground color.
Select a shape and size for the pencil stroke from the Brushes box (see Brushes on
page 294).
Select a mode in the Mode box (see Brush modes on page 295).
286 Photopaint
Change the degree of transparency in the Opacity box.
Note that Pencil produces a “harder” outline than Paintbrush, which employs a technique
called “dithering” to soften the edges of a painted shape. Basically, dithering consists in
softening the edges of an area of color by fading it into the surrounding color. This results
in a less stepped edge than is produced by Pencil. The effect of dithering becomes more
apparent if you increase the size of the image (see Zoom on page 293).
Paintbrush
This tool enables you to paint using a brushstroke with soft edges, as with a real
paintbrush.
Click on Paintbrush
on the Tools bar.
In the “Brushes” dialog choose the method of applying the pencil from Free Hand,
Spline, Line Drawing, Ellipse, Arc, Rectangle (for information on each of these, see
Pencil on page 285).
Select a shape and size for the brushstroke from the Brushes box (see Brushes on page
294).
Select a mode in the Mode box (see Brush modes on page 295).
Change the degree of transparency in the Opacity box.
Note that Paintbrush produces a “softer” outline than Pencil, employing a technique
called “dithering” to soften the edges of a painted shape. Basically, dithering consists in
softening the edges of an area of color by fading it into the surrounding color. This results
in a less stepped edge than is produced by Pencil. The effect of dithering becomes more
apparent if you increase the size of the image (see Zoom on page 293).
Airbrush
This tool allows you to paint with soft, hazy brushstrokes, as with a real airbrush.
Moreover, the color is fed out continuously and so will thicken whenever you keep the
pointer in one place for a while or move it very slowly across the page.
Click on Airbrush
on the Tools bar.
Choose a brush size and shape from the options in the “Brushes” dialog (see Brushes on
page 294). You can decide how transparent the paint should be by altering the value in
the opacity box. 100% is, of course, the maximum.
287 Photopaint
Eraser
This tool allows you to “erase” pixels. In reality the effect of the Eraser tool is to change
existing color values by:
•
applying the current background color when used on the background layer
•
converting the colored pixels of an image on any other layer to fully transparent pixels
Click on Eraser
on the Tools bar.
Select a brush shape and style from the “Brushes” dialog (see Brushes on page 294).
Depending on the brush chosen you can erase colored pixels in a variety of ways,
sometimes getting a complete erasure and sometimes a faded effect.
Change the degree of transparency in the Opacity box. The higher the value the more
pixels will be erased by the selected brush.
At the bottom of the box there is checkbox that allows you to switch on the Red Eye
Reduction option, which is useful for reducing the red eye effect that is a common
problem with flash photography. See Red Eye Reduction on page 287 for more details.
Red Eye Reduction
The Red Eye Reduction option enables you to reduce the red eye effect that often occurs
with flash photography and transforms perfectly respectable friends and relatives into
extras in a vampire film.
You can access this option in the box that is displayed when you click on the Eraser tool
on the Tools Bar. First, though, it is a good idea to select the area to be altered by using
the Magic Wand tool, hence restricting the area across which changes are to be made.
1. Click on the Magic Wand tool and then set the tolerance so that the appropriate area
is selected when you click on the area of red eye on the image. See Magic wand on
page 276 for usage details.
2. Once you have selected the red eye area (you’ll have to do the complete red eye
removal one eye at a time), click on Eraser to open up the “Eraser” dialog box.
3. Click on the Red Eye Reduction box at the bottom to switch it on.
4. Three sliders will be displayed: Threshold, Power, Red Range. The default setting
should usually be fine for most red eye removal, but you can play around with the
sliders to study the different effects. (Note that the Threshold value here works
independently of the one you set using the Magic Wand, which is restricted to
determining a selection. The red eye threshold value determines the range of the
288 Photopaint
pixels to be changed according to color and tonal values, although any changes will
of course be restricted to the area within the selection.)
5. Proceed to remove the red eye by clicking with the eraser on the appropriate eye,
that is, on the area within the current selection.
6. Repeat the above operations for the other eye.
Duplicate
(New topic text goes here.)This tool allows you to “clone” a part of an image and then
paste it elsewhere. It is useful if you have an image that needs retouching and it would be
appropriate to use a similar color and pattern from elsewhere in the image.
Click on Duplicate
on the Tools bar.
Select a brush mode from the “Texture Brush Options” dialog (see Brushes on page
294). This will determine the shape of the area to be cloned.
Select a mode in Mode (see Brush modes on page 295).
Change the degree of transparency in Opacity.
Next, press Alt on the keyboard and click once on the area that you want to clone.
Move the pointer to the area you want to paste to and press on the mouse button for a
couple of seconds. The clone will be pasted in the shape of the brushstroke you chose.
Drag the mouse if you wish to duplicate over a larger area.
Note that cloning can duplicate every part of an image window, starting from the paste
point and copying everything that the cross moves over. The original position of the cross
coincides with the copy point. If you wish to clone within a selected area you can use one
of the selection tools first (see Selections on page 274).
Pattern brush
This tool allows you to paint with a pre-defined pattern.
Click on Pattern Brush
on the Tools bar.
In the “Pattern” dialog select the pattern you want to paint with.
289 Photopaint
In the “Duplicate Options” dialog (this contains the same brushes as in the “Brushes”
dialog) select a brush style with which to apply the pattern.
Proceed to paint with the brush by dragging the mouse.
You can, of course, draw the pattern in a restricted area by using a selection tool.
(Note that to use the Pattern Brush you must already have created a pattern. To create a
pattern, use one of the selection tools to select the area containing the pattern you want
to paint with. Next, select Make Pattern from the Select menu. Alternatively, you can use
a pattern from a external file by loading the file in the Patterns Editor - see Patterns
Editor on page 353.)
Blur
This tool blurs an image by reducing the contrast between adjacent colors.
Click on Blur
on the Tools bar.
Select a brush style and shape in the “Brushes” dialog (see Brushes on page 294).
Keeping the mouse button depressed, drag the pointer over the area that you want to
blur.
Sharpen
This tool sharpens an image by increasing the contrast between adjacent colors.
Click on Sharpen
on the Tools bar.
Select a brush style from the “Brushes” dialog (see Brushes on page 294).
Keeping the mouse depressed, drag the pointer over the area you want to sharpen.
290 Photopaint
Emboss
This tool enables you to cause an area of an image to stand out, as in a relief made of
stone or metal. You can choose to maintain the color of the image or convert the image
to grayscale as you paint with the emboss tool.
Click on Emboss
on the Tools bar.
In the “Emboss Options” dialog select a style and shape for the brush (see Brushes on
page 294).
Use the sliders to set an Azimuth between 0 and 360 degrees, an Elevation between 0
and 180 degrees, and a Depth between 0 and 100%. These control the amount and
direction of light and shadow in the embossed image. You can think of the Elevation and
Azimuth as determining the angle of a single light source in the vertical and horizontal
planes respectively. The Depth determines the depth of the relief. The combination of
these determines the appearance of the embossed image. (As you would expect, an
elevation of 90 degrees i.e. the light source is directly above the image, makes the
embossed image brighter, and an elevation of 0 or 180 degrees leads to a darker image.
A depth of 0%, since it flattens the image, reduces the contrast between lights and
shadows and therefore produces a more uniform embossed image, whether dark or light.
The azimuth, since it determines the angle of light in the horizontal plane, alters the
direction of light and shadow.)
Select Emboss for grayscale, otherwise select Bumpmap to preserve color.
Drag the brush over the area of the image you want to emboss.
291 Photopaint
Dodge
This tool allows you to lighten the tones of the colors in an image.
Click on Dodge
on the Tools bar.
In the “Dodge Options” dialog select the style and shape of the brush (see Brushes on
page 294).
Choose the tonal range on which to concentrate from the following:
•
Highlights concentrates on the lighter tones, making them lighter still, but also
affects the darker tones.
•
Midtones concentrates on all tones, making them lighter, apart from the very light or
dark.
•
Shadows concentrates on the darker tones, making them lighter, but also affects
other tones.
Adjust the value in Exposure to change the amount of tonal lightening you want to allow.
A higher value results in a greater lightening over the tonal range chosen. (This effect is
similar to a photographer’s use of light intensity when exposing a negative.)
Proceed to drag the brush across the relevant areas.
Burn
This tool allows you to darken the tones of the colors in an image.
292 Photopaint
Click on Burn
on the Tools bar.
In the “Burn Options” dialog select a size and shape for the brush (see Brushes on page
294).
Choose the tonal range on which to concentrate from the following:
•
Highlights concentrates on the lighter tones, making them darker, but also affects
the darker tones.
•
Midtones concentrates on all tones, making them darker, apart from the very light or
dark.
•
Shadows concentrates on the darker tones, making them darker, but also affects
other tones.
Adjust the value in Exposure to change the amount of tonal darkening you want to allow.
A higher value results in a greater darkening over the tonal range chosen.
Proceed to drag the Burn pointer over the areas you want to change.
Smudge
This tool allows you to smear an image. The effect on the color values of the image is
determined by the brushstroke used and amount of pressure selected. A larger sized
brush will smear a greater amount of color and a higher pressure will redistribute the
color over a wider range.
Click on Smudge
on the Tools bar.
293 Photopaint
In the “Smudge Options” dialog select a size and shape for the brush (see Brushes on
page 294).
Use the slider to set the pressure in the Pressure box.
Proceed to drag the Smudge pointer through the appropriate areas of the image.
View tools
There are two tools that make it easier for you to view an image: Hand and Zoom.
Hand
This tool allows you to move an image when the image is larger than the current window.
Since you can drag the image in any direction, this gives you more freedom than when
using the scroll bars. Also it is handy for those times when you are using Full Screen view
and the scroll bars are not visible.
Click on Hand
on the Tools bar.
Keeping the mouse button depressed, use the hand to drag the required portion of the
image into view.
Zoom
This tool allows you to magnify the image in the current window.
Zoom comes with a selection outline that gives you the power to “zoom in” on a part of
the image. You choose which part of the image you want to fill the window with after
using Zoom. The smaller the selection the greater will be the magnification applied to the
image as a whole. This is because the selected area is zoomed up to fill the whole of the
window.
Once you have applied Zoom, you can use the Hand tool to move around the image.
Alternatively use the vertical and horizontal scroll bars. With the magnified image before
you, you can proceed to apply the paint tools as normal.
There are several ways of magnifying an image, as follows:
Click on Zoom
on the Tools bar. The pointer becomes a magnifying glass.
Click anywhere in the window and zoom will be applied.
294 Photopaint
To zoom in on a specific area, left click and drag the pointer till you are satisfied with the
selection borders, that is, you have surrounded the area you want to zoom in on. Release
the mouse and zoom will be applied, the selected area filling up the window.
If you want to cancel a selection before zoom is applied, press ESC on the keyboard.
You can then go ahead and make another selection.
For further zoom options, right-click and select from Zoom In (increases magnification),
Zoom Out (decreases magnification), Actual Pixels (reduces image to original size) and
Fit To Screen (fits image to screen.
The maximum magnification is 1600% or 16 times the original size.
Brushes
Every time you select a Paint tool a dialog is displayed with an array of brushes. Although
the same brushes are common to each of the Paint tools, the dialogs in which the
brushes are displayed are slightly different from one another, depending on the particular
tool selected.
The brushes vary in size, shape and solidity, and determine how quickly color is applied,
toned or erased, and over how large an area. This allows you to work, on the one hand,
very quickly with large uniform patches of color, and, on the other hand, to concentrate
on the details in a small area of an image. You can switch between brushes with ease.
The two main tools for painting are Pencil and Paintbrush (see Paint Tools on page
284). Whenever you choose a paint tool, you have the option to choose a brush through
which the paint tool can be applied. If you do not specifically select a brush, the last brush
used by the particular paint tool remains selected. (Pencil produces a “harder” outline
295 Photopaint
than Paintbrush, which employs a technique called “dithering” to soften the edges of a
painted shape.)
Whenever you select a brush its name and the number of pixels in the brush shape are
displayed above the “Brushes” box. For instance, one of the squares has this attached
information: Square <10, 10>. This means that the selected shape is a square that is 10
pixels by 10 pixels. Another option is: Circle, radius = 17 <35, 35>, for a circle with
radius 17 pixels, and vertical and horizontal axes through the center of the circle i.e. the
diameter, of 35 and 35 pixels respectively.
There are 53 standard brush styles in all. You can create and edit your own brushes by
right-clicking in the “Brushes” dialog and selecting an option to open up the “Brush
Options” dialog. Alternatively, select the Brush Editor from the Tools menu, where there
is a full set of tools for editing and creating brushes. (See Brush Editor on page 349)
The effect of applying any Paint tool and therefore the particular brush style used with a
tool, is to change the color value of every pixel that comes into contact with the brush.
Three concepts relating to the application of Paint tools need to be understood:
Base color: the pixel color before the brush is applied.
Blend color: the color you wish to apply.
Resultant color: the color after the blend color has been combined with the base color
using a particular brush style.
These notions are important in understanding the way the various Brush modes work
(see Brush modes on page 295), that is the way the applied color blends with the already
existing color. The default value for the blending mode is Normal, as you can see in the
Mode box.
Another important concept when selecting a brush style and blend mode is that of
opacity, which is set in the Opacity box. If an applied brushstroke has opacity of 100%
and the mode is set at Normal, the brushstroke will completely over-paint any color that it
comes into contact with. The lower the opacity the more transparent or “see-through” the
applied color will be, hence enabling you to see through to the colors beneath. Obviously
opacity is a matter of degree and it is certainly worth experimenting with it to understand
its full effect.
Brush modes
You can set a brush mode for several of the tools, for example, Pencil, Paintbrush,
Duplicate, Fill and Gradient Fill. The brush modes determine how an applied brush
stroke affects the colors already in an image. Essentially, this can be understood in terms
of the existing or base color of a pixel, the color that will be applied by the brushstroke,
and the color that results from the combination of the base and applied colors, as
determined by the selected brush mode. For instance, if you paint a blue line over a
296 Photopaint
patch of red in an image, do you want the red to be completely replaced by the blue, or
somehow blended with it? The brush modes allow you to decide how and to what extent
the applied color will affect what is already there.
The main options, which you can select in the Mode box in the “Brushes” dialog, are:
•
Normal
The color is applied in full, that is to say, the existing base color is totally
over-painted.
•
Dissolve A color applied with a less than 100% opaque brush is converted “dissolved” - to 100% opaque randomly scattered pixels. The effect is of a rough
brushstroke rather than an evenly transparent one.
•
Multipy
The brightness values of the base and applied colors can be combined
to create a darker tone. This is done by multiplying the two brightness values when
they are expressed as fractions. For example, white has a brightness value of 255
(the maximum) and is represented as 255/255 or 1; black has a brightness value of 0
(the minimum) and is represented as 0/255 or 0. All other brightness values are
represented as fractions between 0 and 1 e.g. 150 is represented as 150/255; 100 as
100/255. Therefore, using Multiply we get the result (100 * 150) / (255 * 255), which
works out at 59/255. You can immediately see that the resultant brightness will
always be lower than (or equal to) the brightness of either one of the multiplied
fractions. This intuitively fits in with our experience of placing one transparent sheet
on top of another, where the result is always darker.
Note that the above means that if the applied color is white, the resultant color is the
same as the base color. If the base color is white, the resultant color is the same as
the applied color. If either the base or the applied color is black, the resultant color is
black. If the base color is transparent, the result of applying any color is black (since
a transparent layer counts as 0, that is the same as black).
•
Screen
This mode has the opposite effect from Multiply, combining the base and
applied colors to create a lighter tone.
These are some of the more important options but there are many others that it is worth
experimenting with:
Behind, Overlay, Difference, Addition, Subtraction, Darken Only, Lighten Only,
Hue, Saturation, Color, Luminosity, Divide, Color Burn, Color Dodge, Hard Light,
Soft Light
Typing and color fill tools
In addition to the selection and paint tools, there are several other useful tools that enable
you to insert text or color into an image.
These include:
297 Photopaint
Type Tool on page 297
Historic Brush on page 298
Fill Tool on page 299
Color Picker on page 300
Gradient Fill on page 301
Type tool
This tool allows you to enter text. The text is placed in the document as if it had been
painted directly by you i.e. it is pixel-based rather than object-based. This means that the
text can be edited, using the full range of tools, just like any other part of an image, but
cannot take normal text editing.
1. Click on Type
on the Tools bar. The pointer will turn to a T-symbol.
2. Position the T where you want the text to go and click once.
3. In the “Type Tool” dialog type your text in the top box.
4. Choose from Left, Center and Right in the Alignment box.
298 Photopaint
5. In the Angle box type a new angle or use the arrows to scroll. The angle will be
measured anti-clockwise from the horizontal.
6. If you would like the text to go on a new layer, check the Add Layer box. A Text
Layer will then be created for the text. Note that unless you explicitly change layers
all new paint or text operations will take place on this new layer.
7. Check the Outline box to make text appear in outline rather than as solid.
8. All the usual font commands for your text are available through the Font button.
9. The text and the applied formats will appear in the Preview box, giving you the
opportunity to make changes before clicking on OK.
See
Paint Tools on page 284
Typing_and_color_fill_tools on page 296
Historic brush
This Historic Brush
on the Tools bar, enables you to reverse the last operation
performed on an image. In this it is like the Undo command but limited to undoing the last
operation only. However, unlike Undo the Historic Brush allows you to partially recover
pixels from the result of the last complete operation rather than recover the whole result.
(By “complete operation” is meant the action carried out between one click of the mouse
and the next click.) The Historic Brush can be used in conjunction with the History palette
to recover the state before a previous incarnation of an image (see History palette on
page 298).
History palette
It is possible to go back to an earlier state of an image by selecting the History option
under the Edit menu. The “History” dialog lists the states that you can recover. The
actual states are shown on the left of the dialog and the operation that corresponds to
each of the states is shown on the right.
299 Photopaint
Use the scroll bar, if necessary, to see more of the states of the image, and then click on
the state you would like to recover. You can then proceed to work with the recovered
image.
Note that any intermediate states between the current and the recovered state are lost,
unless you choose one of them from the “History” dialog. Also there is a limit to the
number of previous states remembered in the dialog.
You can use the History palette in conjunction with the Historic Brush (see Historic
brush on page 298).
The History palette functions in a similar way to the Undo option in the Edit menu.
Consequently, the Purge Undo command in the Edit menu empties both the History
palette and the Undo store.
Fill tool
This tool allows you to apply color by clicking on an image. The color you click on will be
taken as the standard, and all adjacent pixels within a certain tolerance, using either the
default or one set by you, will be filled in with the Fill color. The tolerance is a measure of
the brightness of pixels and stretches out in either direction from the selected color. The
Fill color itself is the currently selected foreground color.
Click on Fill
on the Tools bar.
300 Photopaint
1. In the “Fill Options” dialog set the following options:
2. Select a mode in the Mode box (see Brush modes on page 295). The default is
Normal.
3. Set the opacity in the Opacity box: 0 is total transparency, that is the underlying color
shows through totally; 100 is total solidity, that is the fill color covers the underlying
color totally.
4. The tolerance is set in the Threshold box: 0 causes only adjacent pixels with exactly
the same color (strictly speaking, brightness) to be filled; 255 causes all pixels in the
image to be filled.
5. Leave Color Fill checked to apply a color fill.
6. Pattern Fill allows you to use a pre-saved pattern instead of the selected foreground
color. (To create a pattern you first need to use one of the selection tools to select the
area containing the pattern you want fill with. After this, select Make Pattern from the
Select menu. The selected pattern will then appear in the Pattern box and will also
be available for future use.)
7. Once you have chosen a suitable color or pattern and set the threshold, opacity and
mode, just place the Bucket pointer over the area to be filled and click once. The fill
will go ahead according to the settings you chose.
Color picker
This tool allows you to define a new color for either the foreground, background or paint
tools by clicking on a part of an image.
Click on Color Picker
on the Tools bar. The pointer turns to an eye-dropper.
Position the eye-dropper over a color and click once. The foreground color box on the
Tools bar becomes the same color as the color you clicked on.
You can now use a paint tool to paint with this color, or redefine the background color by
exchanging the foreground color box with the current background color box.
301 Photopaint
(Note that the Recent Colors box displays a collection of the most recent colors picked
out by the Color Picker, or selected in the Select Color dialog - see Color selection on
page 271 - when you are choosing a color for the foreground. If it is not visible, select
Recent Colors from the View menu. Selecting any of the colors will make it the current
foreground color.)
Gradient Fill
This tool allows you to fill an area, whether a selection or an entire layer, with a range of
colors. Starting with one color and progressing to another, the colors in between are
graduated according to the particular gradient used. The extent of the gradient is
determined by the distance you drag the pointer.
There are four basic features of Gradient Fill that you will need to understand to use it
properly:
•
Gradient The various gradients available are ways of determining particular color
progressions. Some use the current background and foreground colors to generate
the gradient, others use different color schemes, depending on the choice of gradient
(the gradient name is usually indicative of the range of colors to be used).
•
Gradient type The gradient type is the “shape” of the gradient. The default type,
Linear, takes the gradient set in Gradient and spreads it in a straight line from the
start to the finish point, that is to say, in a definite direction across the image window.
The Spiral type forms a spiral gradient around the start point; the shorter the
distance you drag the pointer, the tighter the spiral. There are many other gradients
types from which to choose.
•
Mode The brush modes determine how the gradient will blend with any colors
already there on the layer. Note that the mode determines a permanent state of the
image and can only be undone by selecting Undo from the Edit menu. Some
examples of blending are given in Brush modes on page 295 .
•
Opacity The opacity slider measures the degree of transparency or “seethroughness” of the applied gradient. A setting of 100% will completely cover any
existing image with the applied gradient; anything less than this and the existing
image will be visible through the gradient. Note that the opacity here determines a
permanent state of the image and can only be undone by selecting Undo from the
Edit menu.
All of these features are available in the “Gradient Fill” dialog.
302 Photopaint
To apply a gradient fill, do the following:
1. Click on Gradient Fill
on the Tools bar.
2. In the “Gradient Fill” dialog set the following options:
•
Choose from the blend modes in Mode (see Brush modes on page 295). The
default is Normal.
•
In Opacity use the slider to set the transparency of the gradient. The default is
100% or totally opaque.
•
In Gradient select a gradient. The default is FG to BG RGB mode.
•
In the Gradient Type box select a gradient type. The default is Linear.
Once you have made your selections, click on a spot in the image window from where
you want the gradient to start. Drag the gradient pointer to a finish point and release the
mouse button. The gradient will be applied after a few seconds, in conjunction with the
gradient type, mode and opacity.
Note that the shorter the distance you drag the pointer the more tightly will the band of
colors be packed.
In addition, you can create and edit your own gradients, which can be saved for future
use. To do this click on Edit to open up the Gradient Editor (see Gradient Editor on
page 345) and set the required options.
For some examples see Gradient Fill: examples on page 302.
Gradient Fill: examples
This section continues the explanation given in Gradient Fill on page 301 and also gives
some examples.
303 Photopaint
1. In the Gradient box you can choose the basic colors for the gradient. The default
gradient is FG to BG RGB (Red, Green, Blue) mode, followed by FG to BG HSB
(Hue, Saturation, Brightness) mode. Both of these produce a gradient that runs from
the foreground color through to the background color, blending the tones in between.
The next option, Foreground to transparent, produces a gradient in which the
foreground color gradually thins out. These three gradients all use the current
foreground and background colors to produce their effects.
There are many other gradients, most of which, like German Flag and French Flag,
generate colors independently of the current foreground and background.
2. In the Gradient type box you can choose a shape or style for the gradient. The
default type is Linear, which draws the gradient in a straight direction across a plane.
The other options include Radial, Spiral Clockwise and Anti-Clockwise, Square,
Conical Symmetric and Asymmetric, and BiLinear. Each of these defines a style
for the gradient. For instance, if you select one of the spiral options and drag the
pointer a short way across an image, a tight spiral will be drawn, of course using the
currently selected gradient. If you drag the pointer a greater distance the spiral will be
much wider. The same general principle goes for all the other gradient types. For
instance, if you use the gradient FG to BG RGB (Red, Green, Blue) mode with the
Linear type, the foreground and background colors will form solid blocks before and
after the start and finish points respectively.
3. In the Mode box you determine how the gradient will be blended with the existing
image. The default is Normal. There are many others, including Dissolve, Multiply
and Luminosity. The best way to get to know how the modes work is to experiment.
There is more explanation and some examples in Brush modes on page 295 . Two
things worth remembering are: the mode used with the gradient is permanent once
applied and can only be undone by using Undo from the Edit menu; in most cases
the gradient will cover the existing image if the Opacity is set at 100%.
4. In the Opacity box you can choose the transparency of the gradient. The default is
100% opaque (or 0% transparent). As said above, you need to reduce the opacity
from 100% in order to see the existing image show through the applied gradient.
Remember that the effect of applying a gradient with an opacity is permanent and
can only be undone by selecting Undo from the Edit menu.
The gradient is always applied by dragging the pointer and then releasing the mouse.
Different gradients will take longer or shorter periods of time to be take effect. All in all the
final effect depends on the combination of settings made in the Gradient, Gradient type,
Mode and Opacity boxes.
Using these settings:
304 Photopaint
this gradient can be produced:
Filters
Filters are the Photopaint equivalents of the filters used in photography to create various
effects. As in photography, some filters are merely corrective in that they try to preserve
the appearance of the original image while removing some defects, and others are
creative in that they radically change the image.
305 Photopaint
The best way to understand the effects of filters is to experiment with them a bit. Here
only a few of the filters, of the many available, will be described.
All of the filters are accessible through the Filters menu.
They are grouped into several general categories, for example, Artistic, Sharpen,
Distort, Tiles, and others. Within these categories there is a wide range of types, many
of which are editable by you.
Take a look at Super Nova under Light Effects. A dialog will open, making it possible to
edit and preview the filter before applying it.
•
Use the Radius and Spokes sliders to increase and decrease the radius and number
of spokes respectively of the super nova. The changes will immediately be displayed
in the Preview box to the left.
•
The X and Y boxes give the horizontal and vertical positions respectively. You can
set these precisely by typing new values into the boxes. Alternatively use the mouse
to click on a spot anywhere in the Preview image.
•
The Color box contains the current background color. If you’d like a different color
click anywhere in the Color box to open up the “Select Color” dialog. Here you can
use the mouse to select a color. This will not affect the current background color.
Once you have designed your super nova, click on OK and watch the filter take
effect. Depending on the size of the image, it can take anything from a few seconds
to a couple of minutes.
Note that whenever a filter is applied it affects only the currently selected - or active layer.
You can undo the filter by selecting Undo from the Edit menu.
306 Photopaint
You can apply as many filters as you like to an image, whether on the same layer each
time or across some or all of the layers, using many different types of filter.
Taking the above super nova effect, you can add a page curl filter on top. This is another
good filter to experiment with and again easily editable.
Select Filters/Artistic/Page Curl to open the “Page Curl” dialog.
•
In the Parameters box use the sliders to set the Opacity, Ratio, Size and Angle of
the curl.
•
Click the Shadow under curl checkbox on for a shadow effect.
•
(All of these effects will become obvious to you as you look at the immediate
implementation of the changes in the Preview box.)
•
You can change the color of the curl in the Curl Shading Color box, using either the
current foreground or background color, or even a previously saved pattern.
•
In the Orientation box choose between vertical and horizontal.
307 Photopaint
•
Lastly, choose a corner for the curl in the Location box.
•
Once again watch the changes take place in the Preview box and click on OK once
you’re satisfied.
The filter effects will take a few seconds to be implemented. If you decide you don’t like
them, just select Undo from the Edit menu and start again.
Note that once you’ve applied a filter you can make some further changes using the Fade
… option at the top of the Filters menu. Thus in the case of Page Curl you can select
Fade Page Curl to open the “Fade” dialog. In here you can change the opacity and the
blend mode of the curl (or whatever was the last filter you applied).
The effect is to fade the filtered image into the original unfiltered image by reducing the
opacity from the maximum of 100%. As the slider approaches 0 in the Opacity box the
effect of the filter becomes fainter until at 0 the unfiltered image is restored. You can
experiment with fading and immediately see the results in the image window.
The options in the Mode box - Normal, Dissolve, Behind, Multiply, and so on determine how the filter will blend with the existing colors. The modes work pretty much
as they do in Blending between layers on page 324 , with the difference that once you’ve
applied Fade the blend becomes permanent (although you can undo a fade or a filter by
selecting Undo from the Edit menu).
Click on OK to exit the dialog and apply the Fade, otherwise click on Cancel.
For more examples of filters, see Filters: examples on page 307 .
Filters: examples
In the section on Filters (see Filters on page 304) you were introduced to the concept of
filters and shown a couple of examples (Super Nova and Page Curl). Altogether there are
93 filters divided into 10 categories. In addition, the Custom Filter option allows you to
design your own filters. With such an extensive range of filters there are obviously many
308 Photopaint
possibilities for combining different filters to produce even more effects. As ever, the best
way for you to learn about these possibilities is to experiment.
The categories are: Artistic, Sharpen, Blur, Stylize, Edge Detect, Tiles, Distort,
Noise, Light Effects, Effects, Custom Filter.
Here we will describe a few more of the filters:
Filter: Add Noise on page 308
Filter: Waves on page 309
Filter: Blur on page 310
Filter: Mosaic on page 313
Filter: Light Effects on page 315
Filter: Add Noise
The Add Noise filter is accessible in the Noise category in the Filters menu. This filter
concentrates on single pixels, increasing or decreasing their color values and thereby
creating “noise” in the image. Noise can be defined as those single or small groups of
pixels whose color values differ considerably from those of the bulk of nearby pixels. The
overall effect can be like the grainy look of old film.
In the “Add Noise” dialog set the following options:
In the Parameters box:
•
•
309 Photopaint
Use the slider to set the Amount of variation from the original colors. The lower the
amount the closer are the pixels to the original image colors.
Tick the Monochromatic box if you want to create noise that lightens or darkens
pixels but leaves their hue unaffected. This results in most pixels being either black or
white when Amount is set to high.
In the Distribution box choose the type of random distribution to be used for the noise:
•
Uniform leads to a random distribution of even density throughout the image.
•
Gaussian leads to a much more random distribution than Uniform, in which noise
can be concentrated in single pixels and groups of pixels, and there can be areas of
no noise at all.
All the changes you make can be seen immediately in the Preview box.
Filter: Waves
The Waves filter is accessible in the Distort category in the Filters menu. The effect is of
an image being distorted when viewed under ripples of water.
In the “Waves” dialog use the sliders to set the following in the Parameters box:
•
Amplitude
The height of the waves between 0 and 100
•
Phase
The point in the wave cycle in degrees between 0 and 360
•
Wavelength
The wavelength between 0 and 50
All the changes are immediately shown in the Preview box.
310 Photopaint
Filter: Blur
There are several filters grouped together in the Blur category in the Filters menu. All of
these filters blur images by searching out areas of strong color contrasts and sharp
edges, which are then softened by converting pixels in the relevant areas to an average
of their total color values.
The most basic and quickest filters to use are:
•
Blur
•
Blur More
•
Heavy Blur
None of these brings up a dialog for you to make your own settings and there is no way
to preview the results. Essentially they are a rough and ready way of averaging the sharp
contrasts in an image, though without being susceptible to fine control. As the names
suggest they are, in ascending order, relatively stronger than one another in their effects.
The following Blur filters give you much more control:
Motion Blur on page 310
Gaussian Blur on page 311
Smart Blur on page 312
See also:
Filters on page 304
Filters: examples on page 307
Filter: Motion Blur
This filter, available through Filters/Blur/Motion Blur, makes the contents of an image
look as if they were in motion.
311 Photopaint
In the Parameters box of the “Motion Blur” dialog you can do the following:
•
Set the extent of the blur (between 0 and 255) by sliding the Length slider.
•
Use the Angle slider to set the direction of the blur.
In the Blur Type box choose from these options:
•
Linear blurs in straight lines. (Note that when you use Linear, the blur will run in the
direction you set and in the opposite direction.)
•
Radial blurs out from the center of the image.
•
Zoom blurs within the original area, concentrating the colors according to the setting
in Length.
All the changes you make can be seen in the Preview box.
Filter: Gaussian Blur
This filter, available through Filters/Blur/Gaussian Blur, gives a more naturalistic look to
the transitions between adjacent colors when blurring. It achieves this by blurring
unevenly, as is the case in real life, according to the distribution calculated using the
Gaussian Bell Curve. Essentially this filter reduces detail in an image, while trying to
avoid the artificial look of too smooth a blur across the image.
312 Photopaint
In the “Gaussian Blur” dialog set the following:
•
Use the Blur Radius slider (or type in the value directly) to set the radius of blur,
between 1 and 100. This controls the amount of blurring by using the blur radius, as a
measure from the center of each pixel, for averaging of color values. The greater the
blur radius the greater the overall blurring of the image.
•
The Blur Horizontally and Blur Vertically checkboxes are both checked by default.
Click to uncheck either or both of these. As their names indicate they determine the
direction of the blur. You would normally want to blur in both directions. Note that
unchecking both boxes makes it impossible to blur at all.
All your settings will immediately appear in the Preview box.
Filter: Smart Blur
This filter, accessible through Filter/Blur/Smart Blur, works to remove low-intensity
“noise” from an image. It does this by preserving the areas where there is a sharp color
contrast, such as edges, and blurring the areas where the colors are almost the same
(within a tolerance set by you). As you can imagine, this is useful when treating grainy
photographic images, since the grainy areas are usually only slightly different in color
from the surrounding areas. The real detail of the image is largely left untouched.
313 Photopaint
In the “Smart Blur” dialog set the following:
•
Use the slider to set the Radius - or type it directly into the box - between 1 and 50.
The radius is a measure of the distance from the center of each pixel and determines
the extent of the color averaging that constitutes the blurring process. Naturally the
higher the radius, the greater the blurring.
•
Set the Maximum Delta, again by using the slider or typing, between 0 and 255. This
is a measure of the threshold for blurring. At low values there is blurring only between
very similar colors; at high values almost any colors, no matter how dissimilar, may
be blurred together.
The effects of your filter settings are displayed in the Preview box.
Filter: Mosaic
This filter is accessible through Filters/Artistic/Mosaic and gives you the power to apply
a range of mosaic effects. The mosaic tiles are surrounded by a black border and the
colors of the tiles themselves are based on the colors of the original image. Any spaces
between tiles are colored black.
314 Photopaint
Once you have entered the “Mosaic” dialog you have various options.
In the Tiling Primitives box, choose the basic mosaic shape:
•
Squares
•
Polygons
•
Polygons & Squares
In the Parameters box, set the following as you wish:
•
Tile Size: the size of the tiles between 5 and 100. The higher the value the fewer the
tiles used to comprise the image.
•
Tile Height: the height of the tiles between 1 and 50.
•
Tile Spacing: the spacing of the tiles between 1 and 50. The lower the value the
tighter the fit between the tiles.
•
Tile Neatness: the degree of neatness, or regularity of shape, of the tiles between 0
and 100%. The lower the value the more irregular the tile shapes.
•
Light Direction: the angle the light falls on the tiles between 0 and 360 degrees.
•
Color Variation: the color differences between the tiles can be heightened or
lowered between 0 and 100%. The lower the value the closer the tiles are in color.
In the Options box tick the boxes to set the following:
•
Anti-aliasing: This is a technique for softening the edges of the individual mosaic
tiles by surrounding their edges with a one-pixel transition.
•
Color Averaging: This alter the colors of the individual tiles so that they are an
average of their own color and the surrounding colors.
•
Pitted Surfaces: The tiles are given a pitted look, rather like an image of the surface
of the moon.
•
FG/BG Lighting: The edges of the tiles are traced in the current foreground and
background colors, according to the colors of the tiles they surround.
All your settings are shown in the Preview box.
315 Photopaint
Filter: Light Effects
The Light Effects filters all work with the qualities of light in your images. You may already
have seen one of these, Super Nova, described in the Filters section (see Filters on page
304).
Here we will describe a few more of the light filters:
Lens Flare on page 315
Discotheque on page 316
Star on page 316
See also:
Filters: examples on page 307
Filter: Lens Flare
This filter, accessible through Filters/Light Effects/Lens Flare, makes part of an image
stand out by brightening the pixels, with the surrounding pixels becoming progressively
less bright. As the name implies the effect is as of a bright flare.
In the “Lens Flare” dialog set the following:
•
Use the Brightness slider (or type directly into the box) to increase the brightness of
the flare. The maximum is 500% or five times the original brightness.
•
In the X and Y boxes you can set the location of the flare. The location is measured
in pixels from the top left-hand corner of the image window.
Your settings will be displayed in the Preview box.
316 Photopaint
Filter: Discotheque
This filter, accessible through Filters/Light Effects/Discotheque, imposes a bright
disco-light effect on top of the original image. The light source is located in the center of
the image.
In the “Discotheque” dialog use the sliders (or type directly into the boxes) to set the
following:
•
Rotation rotates the disco-lights through 0 to 360 degrees.
•
Scale increases and decreases the intensity of the light source and therefore the
extent of the light-spread across the image from the center.
•
Transparency determines how much of the image is visible. A transparency of 0%
causes the image to be not visible at all, with the disco-lights more or less the only
thing visible, depending on the scale setting; at 100% the image is totally visible, with
the disco-lights superimposed.
The changes you make are immediately displayed in the Preview box.
Filter: Star
This filter, available through Filters/Light Effects/Star, allows you to apply various starlike effects. The possible variations are created through manipulation of the colors that
comprise the image.
317 Photopaint
In the “Star” dialog you can use the sliders to set the following:
•
Red, Green and Blue Density
•
Brightness
•
Red, Green and Blue Transparency
These are all measured on a percentage scale.
The effects are immediately shown in the Preview box before you apply them to the
image itself.
Layers
Layers are one of the most useful features of Photopaint. They enable you to treat an
image as a series of separate superimposed images, each occupying its own transparent
layer. This allows you to make changes to an image on one layer without upsetting the
images on the other layers. In addition, the order of the layers can be altered. Altogether,
layers are an essential tool in helping you to control how your images are created and
edited.
The most important feature of layers is their capacity to be transparent in various
degrees. Whenever you create a new layer it is shown as a transparent window, usually
visible as a checkerboard pattern by default. (You can change the shading and size of
the checkerboard pattern in File/Preferences/Grid. A grid size of none in effect creates a
blank sheet, either light, medium or dark according to the setting. You can change the
style of the layers either before or after opening a file.)
To reiterate, the essential characteristic of layers consists in the fact that whenever you
create or edit an image on a particular layer, the images on the other layers will be visible
318 Photopaint
in so far as they can be seen through a transparent area of the layers above. Obviously
with more than two layers, the potential for complexity increases, especially if you start
changing the order of the layers.
You can keep a check on the arrangement, visibility, opacity and blend mode of the
layers you have created by selecting Layers from the View menu. This opens up the
“Layers” dialog:
The following sections will further explain how to use the various features available in
“Layers”:
Background layer on page 318
Creating and working with layers on page 319
Layer options on page 321
Background layer
Each Photopaint document contains a background layer. There are several points you
should be aware of in connection with the background.
If you create a new Photopaint document from scratch, that is to say, using the New
command in the File menu rather than opening up an already existing image file, the
default layer is called Layer 1. Whenever you open up an already existing image file,
using the Open command from the File menu, the default layer is called Background.
The main difference between these is that a Background layer is always opaque, no
matter what position you place it in the hierarchy of layers. If you erase any of the pixels
in a Background layer the current background color is used to fill them in. With a new file
where the default layer is called Layer 1, you can subsequently move this layer up the
hierarchy of layers and it will behave in the same way as any other transparent layer. In
319 Photopaint
both cases the bottom layer, whatever that is, will be opaque. This is as you would
expect, since there is nothing to see beneath the bottom layer. Consequently, if you
erase color from the bottom layer and it is called Background, the background color will
show through, but if the bottom layer is any other type of layer a checkerboard pattern (or
plain sheet) will show through. The checkerboard pattern does not mean that the bottom
layer is transparent, as you can see if you select Print Preview from the File menu or
print the document, in both of which the checkerboard pattern is converted into the
current background color. Moreover, if you “look through” higher layers to parts of the
bottom layer where erasure has taken place you will see the current background color.
Given the above there would obviously be not much point in changing the position of a
Background layer in the hierarchy of layers. However, you can use the duplicate
command to create a layer called Copy of Background, which will then act in the same
way as any normal layer.
You can at any time rename any layer.
Creating and working with layers
The following section will show you how to create and work with layers, explain the
relevant concepts, and illustrate some of the main operations that can be carried out with
them.
First, you may want to edit a picture file, for example, a photograph that you have already
scanned in to your computer.
Select Open from the File menu and locate and open the relevant picture file.
The picture will be displayed in the Ability Photopaint window. If the picture is larger than
the window and you want to see it as a whole, without having to use the scroll bars, then
select Fit on Screen from the View menu. You can always select Actual Pixels to
restore the picture to its original size.
The picture occupies the Background layer, as explained in Background layer on page
318 . This is the default layer and can be edited directly or used as the basis for editing
on other layers. It is best to keep the background layer clean; if you wish to edit it directly,
work on a copy of it instead. (You might also choose to work on a copy of the original file:
select Duplicate from the Image menu. A copy will be created and displayed. You can
then close the original file by selecting it from the Window menu and continue to work
with the copy, which is converted to an Ability Photopaint file. Note that Image/Duplicate
creates a copy in which Background acts like any other layer.)
To create a copy of the Background layer, first make sure the “Layers” dialog is visible
(select Layers from the View menu). Background will be the only layer visible in the
dialog until you create another one. Click on the Duplicate Layer
button in the dialog
to open up the “Duplicate Layer” dialog. Click on OK to create a copy of the background
layer.
320 Photopaint
Note that though these two layers are called Background and Copy of Background,
they are in effect Layers 1 and 2 - if you add a new layer to them it will be called Layer 3.
Any layer can be renamed by clicking on the Layer Options
dialog.
button in the “Layers”
Now that you have created two layers you can see both of them listed in the “Layers”
dialog. The bottom layer in the dialog is always the “background” layer, and the ones
above are stacked on top of this. Any new layer is added to the top of the stack, that is, it
becomes the layer furthest away from the background layer.
The list of layers has several important features. These need to be grasped if you are to
use layers successfully:
•
At the left-hand side of each layer there is an Eye button. As you would expect, this
indicates that the layer is presently visible. Click once to switch off the eye button
(and once again to switch it back on). By switching off a layer you make it impossible
to see any image content from that layer, thereby making the content of the layer
below visible (in so far as it was hidden by the image on the hidden layer). You can
switch off as many layers as you like, and also have any combination of switched-on
and switched-off layers.
•
The currently selected (or highlighted) layer is the active layer. Any editing you do is
always implemented on the active layer. Since it is not possible to have more than
one active layer at a time, none of the inactive layers will be affected by your editing.
This is, of course, the main value of layers in the first place. You can make any other
layer the active one simply by clicking on it.
With this in mind it is important to note the following: a layer may be the active one and at
the same time be invisible, that is with the eye button switched off. If this is the case, you
will not be able to see the effects of editing until you switch on the eye again, but editing
will be applied to the currently selected active layer whether or not it is currently visible.
321 Photopaint
Layer options
There are various layer options, available through the “Layers” dialog or, if not there, the
Layers menu. These options show some of the most powerful features of layers.
(The example “Layers” dialog shows an image of a house on the Background Layer - see
Background layer on page 318 - and a Super Nova filter on Layer 2. The images can be
combined in the image window to show a house with a super nova filter, or either layer
can be switched off to show only the image on the other layer. The active layer in the
example is Layer 2 and all actions will take place on this layer until the other one is
selected.)
We will go through the options in the “Layers” dialog not already dealt with in Creating
and working with layers on page 319 . After that we will cover some of the options
available through the Layers menu.
Click on the New Layer
dialog.
button in the “Layers” dialog to open up the “New Layer”
322 Photopaint
In the Name box the layer is given a default name e.g. Layer_3. You can change the
name as you wish. (The Opacity, Group with previous and Mode options are dealt with
in the account of the “Layer Properties” dialog later on in this section.) Click on OK to
close the dialog and create the new layer.
Note that whenever you create a new layer it is placed directly above the current highest
layer in the stack, that is it becomes the layer furthest from the background. This can be
observed in the “Layers” dialog.
If you want to delete a layer, first select the layer in the “Layers” dialog and then click on
the Delete Layer
button.
You can duplicate a layer by first selecting the correct layer in the “Layers” dialog and
then clicking on the Duplicate Layer
button.
323 Photopaint
In the “Duplicate Layer” dialog the layer to duplicated will be given a default name which
you can change as you wish. In the Destination box you can choose whether to have the
duplicate layer saved to the present document, an already existing document or to a new
document.
There are several buttons that enable you to alter the order of the layers. In each case,
first select the layer to be moved.
•
Click on Layer Up
to move a layer one up the stack, that is one layer further
away from the background.
•
Click on Layer Down
•
button takes the selected layer to the top of the stack, that is the
The Layer First
furthest away from the background.
•
button takes the selected layer to the bottom of the stack, that is
The Layer Last
makes it the background layer.
Click on the Layer Options
to move a layer one down the stack.
button to open up the “Layer Properties” dialog.
There are several options here which are also available in the “Layers” dialog itself, such
as power to change the name, alter the opacity, and select a different blend mode for the
layer. In addition, you can choose to group layers together.
•
Opacity: use the slider to reduce the opacity of the active layer. In effect, 100%
opacity on a layer prevents you seeing through an image to the layer below. As you
gradually reduce the opacity the image fades more and more. Note that altering the
324 Photopaint
opacity merely changes the appearance of a layer, but does not effect a permanent
change unless you choose to merge or flatten an image (see Merge operations with
layers on page 326).
•
Mode: the blend mode determines how colors on the active layer will blend or
combine with colors on the layers below (see Blending between layers on page 324
for more information).
•
Grouping: The Group with previous checkbox should be switched on if you want to
“clip” the active layer to the layer below. Essentially, grouping causes the information
on one layer to mask the information on the other. So, if you have two adjacent
layers, with the upper layer clipped to the lower, the only part of any image on the
lower layer that will “show through” is that which coincides with the image on the
upper layer. The image on the upper layer will be seen as if filled with the colors from
the image on the lower. Another way of thinking about this is to see the transparent
areas of the upper layer as masking the equivalent areas of the lower layer. An
example of the use of the technique is when you have some text on the upper layer,
say “Happy Birthday”, which you want to be displayed with the colors that are directly
underneath in the lower layer. You can cancel a grouping by clicking on the checkbox
again or by selecting Ungroup from the Layers menu.
•
Click on OK to close the dialog and apply the changes.
Blending between layers
In the Layer Options section (see Layer options on page 321) we explained some of the
various options available in the “Layers” dialog. One of the most useful is the Mode
option, which determines how colors on the active layer will blend or combine with colors
on the layers below. The effect of a Blend mode is usually obtained in conjunction with a
setting for the Opacity of the layer.
There are several options for blending. The list of these is the same as for Brush modes
(see Brush modes on page 295). There are, though, important differences:
•
brush modes concern blending between colors on one layer, whereas blend modes
concern blending between different layers;
•
brush modes can be limited to a selection on a layer, whereas blend modes work on
the whole of a layer;
•
a brush mode will only take effect once you start to paint with it, leaving previously
applied brushstrokes untouched unless you paint over them, whereas a blend mode
is applied immediately it is selected to the whole of the layer and will continue to be
applied as long as it is selected;
•
325 Photopaint
brush modes are permanent, unless you use the Undo option in the Edit menu,
whereas blend modes can be changed or cancelled by selecting another blend
mode.
The usefulness of blending can be gauged from the following notes.
The image window can contain many layers in a definite order. Each layer can have its
own image but all the layers share the same “space”, namely the standard image
window. However, when it comes to displaying or printing an image that is comprised of a
series of layers, it is obviously impossible to display all the separate layer images. In
other words, only one image can actually be displayed. Blending is a way of determining
the final color values for an image you wish to display or print, when that image consists
of more than one layer. Note that the Blend modes do not effect a permanent change and
can be cancelled at any time by selecting Normal in Mode and setting the Opacity at
100%.
For some examples of blending between layers, see Blending between layers: examples
on page 325.
Blending between layers: examples
The following examples show you how to apply the techniques discussed in Blending
between layers on page 324.
Since blending is applied to the color values of the pixels on more than one layer,
Photopaint has to calculate, for each pixel, the resultant color from a combination of the
base color (or color of the layer below the active layer) and the blend color (or color of
the active layer). The particular Blend mode used determines the way the resultant color
is calculated.
The default value for the blend mode is Normal, as you can see in the Mode box.
Another important concept when selecting a blend mode is that of opacity, which is set in
the Opacity box. For some blend modes an effect becomes apparent only if the opacity
is set at less than 100% e.g. Dissolve.
The main blend options, which you can select in the Mode box, are:
•
Normal
The resultant color is the same as on the current active layer (subject to the amount
of transparency set in the Opacity box, therefore visibility through to the lower
layer). In effect, the base color is not used to help calculate the resultant color
where the base and blend colors overlap.
•
Dissolve
326 Photopaint
A layer with less than 100% opacity is converted - “dissolved” - to 100% opaque
randomly scattered pixels. The effect is of a rough brushstroke, containing a mixture
of blend and base pixels, rather than an evenly transparent one.
•
Multipy
The brightness values of the base and blend colors can be combined to create a
darker tone. This is done by multiplying the two brightness values when they are
expressed as fractions. For example, white has a brightness value of 255 (the
maximum) and is represented as 255/255 or 1; black has a brightness value of 0
(the minimum) and is represented as 0/255 or 0. All other brightness values are
represented as fractions between 0 and 1 e.g. 150 is represented as 150/255; 100
as 100/255. Therefore, using Multiply we get the result (100 * 150) / (255 * 255),
which works out at 59/255. You can immediately see that the resultant brightness
will always be lower than (or equal to) the brightness of either one of the multiplied
fractions. This intuitively fits in with our experience of placing one transparent sheet
on top of another, where the result is always darker.
Note that the above means that if the blend color is white, the resultant color is the
same as the base color. If the base color is white, the resultant color is the same as
the blend color. If either the base or the blend color is black, the resultant color is
black. If the base color is transparent, the result of blending any color is black (since
a transparent layer counts as 0, that is, the same as black).
•
Screen
This mode has the opposite effect to Multiply, combining the base and blend colors
to create a lighter tone.
These are some of the more important options, but there are many others:
Behind, Overlay, Difference, Addition, Subtraction, Darken Only, Lighten Only,
Hue, Saturation, Color, Luminosity, Divide, Color Burn, Color Dodge, Hard Light,
Soft Light
Remember that you can always cancel or change the effect of a blend mode by selecting
another one, especially the Normal blend mode. For information on how to make a
particular blending permanent, see Merge operations with layers on page 326.
Merge operations with layers
The merge options, accessible in the Layers menu (see Layer options on page 321),
provide a useful way of fusing the contents of layers to form one image on one layer.
•
Flatten Image merges all visible layers into a single background layer, leaving out
and discarding non-visible layers (the ones with the Eye switched off). At the end of
this operation there is only one layer left.
•
•
327 Photopaint
Merge Visible merges all visible layers into the bottom-most visible layer, creating a
single background layer and leaving non-visible layers untouched and above the
background layer.
Merge Down merges the active layer with the layer below it.
The merge operations are permanent, although if you make a mistake with a merge just
select Undo from the Edit menu to restore the previous state.
Copy, Cut and Paste
The Copy, Cut and Paste commands in the Edit menu work in conjunction with the
Layers facility. Whenever you copy or cut a selected image or part of an image and then
use paste, the selection is pasted onto a new layer. The pasted selection will be slightly
off-center, rather than superimposed on top of the copied selection.
1. The Copy, Cut and Paste commands only become active after you have made a
selection, in the normal way, using one of the selection tools (see Selections on page
274) or an option from the Selection menu (see Selection menu on page 278).
2. After making your selection, click on either Copy or Cut in the Edit menu.
3. Click on Paste in the Edit menu.
The selection is pasted onto a new layer, which automatically becomes the active layer.
Note that if you want to move a selected part of an image to another area on the same
layer, you can’t just copy and paste. Instead, you should drag the Move arrow when the
selection is in Transform mode (see Transform Image on page 283).
Edit menu
The Edit menu enables you to perform various editing operations. Nearly all of these
have been dealt with in other sections:
•
Undo undoes the last applied command. You can undo several commands, the
precise number depending on what part of Photopaint you’ve been using. The next
command to be undone always appears just to the right of Undo e.g. Undo Ellipse
selection.
•
Redo, as the word implies, restores the last undone command. Again the number of
commands it is possible to redo depends on the nature of the commands.
•
History: see History palette on page 298 .
•
Cut, Copy, Paste: see Copy, Cut and Paste on page 327.
328 Photopaint
•
Stroke uses the current selection border as the basis for painting a band of color
around the selection. The color used is the current foreground color (see Color
selection on page 271 for information on how to select a new color). In the “Stroke
Selection” dialog you can set the following:
•
Width: enter a value for the stroke width (in pixels).
•
Blending: choose a Mode and Opacity (see Brush modes on page 295 for
information on the various ways of blending colors.)
•
Location: choose whether to have the stroke in the Center, Inside or Outside of
the selection border.
•
Click on OK to exit the dialog and draw the stroke.
The selection border will be traced with the foreground color, using the width and
“location” chosen by you. When the selection is cancelled the stroke remains in
place.
•
Fill enables you to fill in a selection using any color or pattern you like. In the “Fill”
dialog set these options:
329 Photopaint
Choose a Fill color in the Color box:
Foreground: the current foreground color
Background: the current background color
Black: solid black
50% Gray: half white, half black
White: solid white
Custom Color: select a color in the Select Color dialog
Pattern: select a pattern in the Pattern Editor dialog
Note that the Fill color is displayed in the Preview box.
In the Blending box set the Mode and Opacity (see Brush modes on page 295
for information on blending).
Once you have set the Color, Opacity and Mode click on OK to apply the Fill.
330 Photopaint
•
•
Clear: Deletes the contents of the current selection (or layer if a selection hasn’t been
made). Note that the deleted selection is “replaced” with the current background
color, not with the transparent grid and not with the color of any underlying layer.
Free Transform and Transform enable you to transform either the selection
boundaries, leaving the image unaffected, or the image itself. They are described in
Transform selection tool on page 279 and Transform Image on page 283.
Image menu
The commands in the Image menu enable you to adjust the color values of and to resize,
rotate, crop and duplicate images. The Adjust commands are especially useful when
working with scanned images, since the colors are usually not perfectly duplicated in
computer form.
These are the main options in Image:
Adjust on page 330
Duplicate on page 341
Image Size on page 341
Canvas Size on page 342
Rotate on page 344
Histogram on page 344
Adjust Image
The Adjust command in the Image menu opens up a new menu containing a variety of
commands:
Auto Levels on page 331
Levels on page 331
Curves on page 333
Color Balance on page 335
Brightness/Contrast on page 337
Hue/Saturation on page 337
331 Photopaint
Desaturate on page 339
Invert on page 339
Equalize on page 339
Posterize on page 339
Threshold on page 340
Use these to adjust the color values of the image.
Auto Levels
The Auto Levels command - from the Adjust section of the Image menu - applies an
automatic tonal readjustment of the image by repositioning the endpoints of the tonal
range. The tones are readjusted to fit in between the new endpoints. The effect is to
increase the contrast in the image.
The lightest and darkest pixels of the image are reset as white and black respectively,
and then the intermediate pixel values are redistributed proportionately. The dark values
get darker and the light values get lighter, hence causing the image to have higher
contrast and greater color saturation.
For more information on adjusting levels, see Levels on page 331.
Levels
The Levels command enables you to adjust the brightness of pixels, hence relocating the
brightness values of an image. This is done by manipulating the controls which represent
the shadows, mid-tones and highlights in the image. In effect the Levels sliders are used
to expand or compress the current tonal range. The Histogram represents the tonal
range of the image and measures how many pixels are colored with each of the tones
between 0 (black) and 255 (white) (see Histogram on page 344 for more explanation).
Access the Levels command in the Adjust sub-menu under Image.
332 Photopaint
In the “Levels” dialog you can set the following:
•
Set the channel in Channels, choosing from Luminosity (red, green and blue
combined), Red, Green, or Blue. Note that the histogram changes to reflect your
setting.
•
The Input Level boxes display values for shadows and highlights, thereby
determining the range of pixels that will be turned black or white. You set these
values by dragging the sliders just below the boxes.
For example, if you use the left-hand slider, which adjusts the shadow value in the
left-hand box, to set a value of 60, then all pixels with a brightness value of 60 or less
will become black. Likewise, using the right-hand slider to set a highlight value of 200
in the right-hand box causes all pixels with a brightness value of 200 and higher to
become white. The range of values is from 0 to 255.
The middle box and slider control the brightness of the mid-tones. The default value
is 1 and the range through which you can move the slider is 0.09 at the right side to
10 at the left side. Moving towards the lower value darkens and towards the higher
value lightens all the tones of the image that aren’t either black or white (these parts
of the image stay the same).
•
The Output Level slider and boxes are used to compress the tonal range. This is
done by restricting the darkest and lightest tones, hence causing a decrease in the
333 Photopaint
number of possible tones in between the new darkest and lightest tones. The effect
of this is to decrease the contrast in the image.
Set the shadow value by moving the left-hand slider to the right: a value of 50
reduces the darkest tone to 80.4% of black i.e. 0 is black and 255 white, so a setting
of 50 represents a reduction of 19.6%. Set the highlight value by moving the righthand slider to the left: a value of 200 increases the darkness of the lightest tone to
21.6% of black (alternatively, 78.4% of white). The tonal range is adjusted to fit in
between the new limits of 50 and 200, there being nothing outside of this range in the
0 to 255 scale.
Any changes you make are immediately applied to the image on screen. Click on Cancel
to cancel these changes and exit the dialog; otherwise click on OK.
Note that the Levels command isn’t as accurate or powerful as the Curves command
(see Curves on page 333).
Curves
The Curves command (Image/Adjust) enables you to change the pixel values of an
image. It allows you to focus with greater precision on certain tonal areas and is therefore
more powerful than the Levels command (see Levels on page 331).
The “Curves” dialog consists of a tonal graph on a grid background. The tones of the
image are altered by manipulating this graph in conjunction with the tonal range
represented by a particular square or squares. The graph can take either of two forms:
one which allows you to manipulate the graph by using points or markers, the other which
enables you to draw a curve freehand. The two forms of curve can easily be converted
into one another.
334 Photopaint
The “Curves” dialog contains the following options:
•
Channels: Choose to edit one of the individual channels - Red, Green or Blue - or
all the channels combined - Luminosity.
•
Tone Graph: This is a diagonal straight line by default. It represents the spread of
tones throughout the image. Pixel values are altered by manipulating this graph. The
four-by-four grid against which the graph is set allows you to focus your changes on
particular tonal areas. The horizontal bar at the bottom of the graph represents the
gradual changing of the tonal range from black to white. So, if you would like to make
the lighter tones darker you should concentrate on the squares towards the upper
right-hand corner, but if you’d like to make the darker tones lighter concentrate on the
squares towards the bottom lower left-hand corner. The square markers at the
extreme ends of the graph represent the tonal end-points. It is not necessarily the
case that the image contains these tones, so, for example, to alter the darkest tones
in the image you may have to concentrate on a square that is further along the graph
from the bottom left-hand square.
The tones can be changed by clicking on the graph in the square that contains the
relevant tones e.g. shades, mid-tones, highlights. A marker will appear on the graph
335 Photopaint
at this point. There are two functions of markers. The first is to make tones lighter or
darker by dragging the marker upwards or downwards respectively. The straight line
graph will adjust to form a curve, using the marker as its point of origin, and the
image will dynamically darken or lighten to reflect the new graph. With only one
marker in place the whole graph bends into a curve and therefore affects the whole
tonal range. Since you will usually want to concentrate on a limited range of tones,
the second function of the markers is to anchor the graph, therefore restricting the
curvature whenever you reposition a particular marker. To do this put several
markers in place along the graph at regular intervals and then move the relevant
marker up or down as required. Only a small section of the graph will be affected and
hence only a small part of the tonal range will be altered. Note that the graph will
attempt to form the smoothest curve possible between the markers when the
Smooth curve option is set (see below for the difference between Smooth and Free
curves).
You can place up to fourteen markers on the graph. Reposition a marker by dragging
it along the graph in the required direction. Remove a marker by dragging it
horizontally till it disappears (dragging vertically alters the graph itself, of course).
Usually you will only need to make small adjustments to the graph, anything greater
altering the image tones radically.
•
Smooth and Free: The default setting is Smooth. This ensures that the curve is
adjusted smoothly i.e. no “sharp corners”, therefore causing the tonal alteration in the
image to be smoother too. Markers can be added only to smooth curves. The Free
option removes any existing markers, including the end-points, and allows you to use
your mouse to draw a “curve” freehand, without the rest of the graph being adjusted
to remove sharp corners. You can switch between these at will. Note, though, that
switching back to Smooth from Free smoothes out the curve and adds ten markers at
key intervals i.e. it doesn’t return the markers that you may previously added while in
Smooth mode.
If you continually click on Smooth you will notice that the curve gradually straightens
out, eventually returning to its original diagonal form.
•
Reset: This resets the graph to its original straight diagonal form and removes any
markers, apart from those at the end-points. The image dynamically reverts to its
original state.
Once you are satisfied click on OK to save the changes and exit the dialog; otherwise
click on Cancel to exit without saving.
Color Balance
The Color Balance command in the Adjust section of the Image menu allows you to
make adjustments to colors by altering their position in the Red Green Blue (RGB)/Cyan
Magenta Yellow (CMY) color scale.
336 Photopaint
Each of the colors is linked with its complement on the color scale, for example, Cyan
with Red, and connected by an adjustment slider. The Color Levels boxes just above the
sliders display the current color values, reading from left to right, for the top, middle and
bottom sliders respectively. The range of possible values lies between -100 and 100. The
default is 0. Note that your adjustments should usually be small i.e. within about 5 units
either side of 0, so that the color balance is not radically altered.
In the “Color Balance” dialog you can adjust the colors as follows:
•
Color is added (or subtracted) by moving the slider towards (or away from) the color
to be added (or subtracted). So, to add green move the middle slider towards the
green end of the Magenta/Green scale. To subtract blue move the slider away from
the blue end towards the yellow end of the Yellow/Blue scale, this in effect being the
same as adding yellow.
•
There are three Tone buttons which allow you to concentrate change over
approximate tonal ranges in the image. The selected button guides the changes
towards the relevant tonal range, hence helping concentrate the changes. The tones
are:
a. Shadows for tones over 75%
b. Midtones for tones between 25% and 75%
c.
Highlights for tones below 25%
•
337 Photopaint
The Preserve Luminosity button helps keep the current luminosity - or lightness - of
the image. When this is unchecked the tonal values of the image are altered along
with the colors.
The changes you make will be implemented while you are still in the dialog. Click on
Cancel if you want to cancel these; otherwise click on OK to keep the changes and close
the dialog.
Brightness/Contrast
Use the Brightness/Contrast command - among the Adjust commands in the Image
menu - to alter the overall brightness or contrast of the image.
The brightness of an image is a measure of its overall lightness; the contrast is a
measure of the difference between lighter and darker tones. Both values are set by
sliders in the “Brightness/Contrast” dialog. Sliding to the right increases the
brightness/contrast; sliding to the left decreases them. The current value for both
brightness and contrast is shown as 0 before any changes are made. You can set the
value for each at anything between -127 and 128, these being relative to the current
value.
Note that as you move the sliders the changes immediately take effect on screen. If you
would like to cancel the changes just click on Cancel to exit the dialog and return to the
previous state. Otherwise click on OK to close the dialog and keep the changes.
Since the Brightness/Contrast command acts on all channels at once, that is you can’t
make changes to individual color elements within the image (red, green, blue, for
instance), you may want to look at Curves on page 333 .
Hue/Saturation
The Hue/Saturation command in the Adjust section of the Image menu allows you to
edit colors using the Hue Saturation Brightness (HSB) model.
338 Photopaint
Basically, you can take either all the image colors together or select a single color, then
change the hue, saturation or brightness accordingly.
In the “Hue/Saturation” dialog there are sliders for the hue, saturation and lightness
(brightness). The setting is always 0 for each of these when you first enter the dialog.
You can move the sliders through -180 to 180 for Hue, and between -100 and 100 for
Saturation and Lightness. These are measured relative to the current setting. (Note that
the Hue values can be imagined as being degrees on a circle, so that -180 and 180 result
in the same color being selected.)
On the left of the dialog there is a list of all the colors in the RGB and CMY scales. Any
one of these can be selected and changed in its hue, saturation or brightness. The
default setting is Master, that is , all the colors of the image are changed together.
•
The Hue slider takes a selected color - or all the colors together - through the range
of colors in the RGB/CMY scales. Once the slider position is set the relevant image
colors change to reflect the new hue settings. Note that when you next enter the
dialog the color list is returned to its normal setting, ready for you to make more
changes should you need to.
•
The Saturation slider increases or decreases the intensity of colors (or a selected
color). Decreasing the saturation causes color to become grayer; increasing the
saturation causes color to become brighter.
•
The Lightness slider increases or decreases the brightness of colors (or a selected
color). Decreasing the lightness causes color tones to become darker; increasing
lightness causes them to become whiter.
339 Photopaint
All the changes you make in the “Hue/Saturation” dialog are immediately applied to the
image on screen. Click on OK to exit the dialog and keep the changes; otherwise click on
Cancel to close the dialog and abandon the changes.
Desaturate
The Desaturate command in the Adjust section of the Image menu causes all colors in
an image to become gray. This is the equivalent of setting the Saturation slider to 0 while
using the Hue/Saturation command (see Hue/Saturation on page 337).
Note that the command is immediately implemented without your needing to access a
dialog.
Invert
The Invert command in the Adjust section of the Image menu inverts all the pixel values
in an image, that is changes them to their opposite value. More exactly, it calculates a
new value for each pixel by taking the current value and subtracting it from 255. The new
value then determines the brightness of the pixel, and therefore the brightness of all the
colors in the whole image.
Note that the command is immediately applied once selected. If you would like to revert
to the original brightness it is usually safe to do a reverse inverse by just selecting Invert
again. However, in some circumstances it is often safer to select Undo from the Edit
menu.
Equalize
The Equalize command (in the Adjust section of the Image menu) is used to redistribute
the tones in an image. It accomplishes this by examining the image for the lightest and
darkest pixels and then changing the lightest to white and the darkest to black. The
remaining pixels are adjusted so that their tone is spread between the new limits.
Posterize
The Posterize command (in the Adjust section of the Image menu) is used to reduce
the number of tonal levels in an image. This is useful in creating a silk-screen effect, as in
some of Andy Warhol’s pictures.
In the “Posterize” dialog set the new number of levels in the Levels box (the default is 4,
the maximum 255). The number you enter is used to give an average for the 256 levels
making up each of the color channels. With a low number of levels the effect of
posterization is to display conspicuous bands or areas of color, while with a high number
the changes are much less obvious. At 255 the image remains the same.
340 Photopaint
Any changes you make are immediately applied to the image, so you should click on
Cancel if you want to abandon the changes and exit the dialog. Otherwise click on OK to
keep the changes.
Threshold
The Threshold command (in the Adjust section of the Image menu) converts all the
colors in an image to just two: black and white. The threshold is a limit value above which
tones become black and below which they become white. Therefore you can decide how
much of the image becomes black and how much white.
In the “Threshold” dialog use the slider to set a threshold value anywhere between 0 and
255. Towards the upper end of the scale the image becomes darker and is completely
black at 255; towards the lower end the image becomes lighter and is completely white at
0. The current threshold is displayed numerically in the Threshold Level box. The default
threshold is 127 when you first enter the dialog i.e. half way between black and white.
The histogram represents the distribution of image tones and can be used as a rough
guide to help you set the threshold.
The command is immediately applied when you enter the dialog, initially using the 127
default threshold value and then any other value you may set with the slider. To cancel
these changes and return to the original image click on Cancel, otherwise click on OK to
exit the dialog and keep the changes.
Once you have applied the Threshold command you can only get back to the original
colored image by selecting Undo Threshold from the Edit menu.
341 Photopaint
Duplicate image
The Duplicate command in the Image menu copies the open image to another window.
The duplicate is given the title Copy of (name of open image) but can be renamed
when you save it.
The duplicate is in every way the same as the original and can be edited in all the usual
ways, including the addition of layers. To switch between the duplicate and the original
click on the Window menu and select the relevant name at the bottom of the menu.
Image size
The Image Size command in the Image menu allows you to alter the size of the open
image.
In the “Image Size” dialog there are several ways to do this:
•
Type the new dimensions into the Width, Height and Resolution boxes in the
Image size group box. Note that just above this the amount of space needed to store
the image is displayed. The original measure is recorded in brackets. You can force
342 Photopaint
the dimensions of the image to change in proportion by selecting the Preserve Ratio
box, that is, typing a figure in Width will automatically cause the figure in Height to
change in proportion.
•
The Scale group box allows you to select from one of the displayed fractional scales:
1/4, 1/3, 1/2, 2, 3.
•
The Interpolation group box allows you to determine how the image will be affected
when the size or resolution is changed. Since changing the dimensions of an image
results in pixels being either added or removed, there needs to be a method of
working out what color values the new pixels will have. Each of the interpolation
values is used to spread color over a given range of pixels, in an attempt to maintain
the appearance of the original image. The available interpolation values are: Nearest
Neighbor, Linear, Quadratic, Cubic, Quartic, Quintic, 6th Order, 7th Order. The
higher the order the better the result, although it takes more time of course.
Once you are satisfied with your settings, click on OK to effect the changes. If you would
like to reverse a resizing it is best to use the Undo command in the Edit menu, although
you can of course resize in the opposite direction e.g. half the image size after a previous
doubling.
Canvas size
The Canvas Size command in the Image menu allows you to alter the dimensions of an
image. However, unlike the Image Size command, this is done without changing the
resolution. In effect, when the width or height is reduced the image is cropped, and when
it is increased transparent pixels are added to fill up the extra space. (Note that the image
canvas is usually surrounded by a gray area if the canvas is smaller than the image
window. This gray area is inaccessible to the Photopaint tools. Increasing the canvas size
creates a newly accessible area, hence allowing you to add a caption, say, to the bottom
of a scanned photograph.)
343 Photopaint
1. In the “Canvas Size” dialog you can make changes in the Width and Height boxes.
Note that the amount of space required for the image is shown just above.
2. In the Anchor box there is a grid of nine squares which helps you to choose where
the image will be located on a resized canvas. Since changing the canvas size
results in either a cropping or expansion of the canvas, there are two basic uses of
the anchor grid:
•
Use the grid to preserve a part of the image when cropping. For instance, if you
are reducing the height by two units (of some scale) but wish to preserve the
bottom of the image, you should click one of the bottom squares to ensure that
the two units are cropped from the top of the image. Clicking on one of the
middle (horizontal line of) squares will result in one unit being cropped from the
top and one from the bottom of the image. The same principles can be applied to
cropping from the left and right sides of the image. (Note that you can also crop
using the Crop tool on the Tools bar - see Crop on page 277 .)
•
Use the grid to determine where in an expanded canvas the original image
should appear. For instance, if you are adding two units to the width and height
of the canvas and you would like these to be distributed evenly around the
image, then click on the center square to create a one-unit band around the
image. If you click the lower-left square, two units are added to the top and two to
the right side of the image.
Once you are satisfied with the width, height and anchor grid setting click on OK to
implement the changes.
344 Photopaint
Rotate
The Rotate command in the Image menu allows you to turn the image through an angle
set by you. (Note that, in effect, the image canvas is rotated and therefore the image
along with it. This is different from the rotate commands in Transform Image - see
Transform Image on page 283 - which turn a selection of the image without turning the
canvas and therefore allow images to be “cropped” once they are outside the canvas
area.)
There are set options for rotating through 90 degrees clockwise (90 CW), 90 degrees
counter-clockwise (90 CCW) and 180 degrees. In addition, you can flip the image either
horizontally or vertically. The most versatile command is Arbitrary, with which you can
specify an exact angle of rotation, anywhere between 0 and 360 degrees, and choose to
rotate either clockwise or counter-clockwise.
Histogram
The Histogram option in the Image menu is purely there for informational purposes. It
displays in graphical form the tonal values of the image, according to which of the
channels you select. You can choose to see a histogram for either the Red, Green or
Blue channel, or for all of them together by selecting Luminosity.
The graph represents the darkest to lightest pixel values (reading horizontally from left to
right) between 0 and 255. There are 256 lines representing 256 possible tones. The
height of the line indicates the number of pixels in the image that have that particular
tone. If a tone is not present in the image it will have no associated line in the histogram.
For instance, if there is no pure black in the image there will be no line at the left-hand
side of the histogram, and if there is only a small number of black pixels the line will be
short. The same is true of the rest of the tonal range.
This information can be useful in guiding you in your color correction strategy.
345 Photopaint
The Tools menu
The Tools menu contains commands through which you can create or edit gradients,
patterns and brushes. The following sections show you how to do this:
Gradient Editor on page 345
Brush Editor on page 349
Patterns Editor on page 353
Gradient Editor
Although Photopaint already contains several default gradients, which are explained in
Gradient Fill on page 301, it is useful to be able to create new gradients - or edit existing
ones -to your own design. This can be done through the Gradient Editor.
You can access the Gradient Editor in the Tools menu. (Alternatively, click on the Edit
button at the bottom of the “Gradient Fill” box after selecting Gradient Fill on the Tools
bar.)
Once in the “Gradient Editor” dialog you can set the following:
•
Create a new gradient by clicking on the New button. In the Gradient Name box
enter a name or leave the default name and click on OK. The gradient name is
displayed in the top box. Any gradient you create will be displayed here and will
appear each time you enter the Gradient Editor.
•
Change the name of a gradient by first selecting the gradient name and then clicking
on Rename. Change the name in the Gradient Name box.
•
Remove a gradient by selecting the gradient name and clicking on the Remove
button. The Gradient will be deleted from the list.
•
Copy a gradient by clicking on the Duplicate button. Give the duplicate a name in the
Gradient Name box. Duplicates are useful if you plan to edit a gradient but also want
to retain its original form.
•
If you are creating many gradients you may wish to put them into a separate file. Use
the Save button to either create a new file or save to an existing file. Likewise if you
want to use gradients stored in an separate file, use the Load button to load the file.
When you first create a new gradient, it will have no distinguishing properties (all new
gradients are shown as a solid line of color in the Gradient Bar). To begin creating the
gradient proper, first make sure it is selected in the list of gradient names.
346 Photopaint
In the body of the Gradient Editor you need to select colors and transparency values for
the gradient, as follows:
There are two Adjust checkboxes:
•
Color enables you to determine the color of the gradient.
•
Transparency enables you to determine the opacity of the gradient.
1. First select Color (it should be selected by default anyway).
The long box just below the Adjust commands is called the Gradient Bar. This
represents the gradient itself, namely how its color content is spread out when you
create the gradient on screen. By default it will be a solid block of color until you
design the gradient.
Just below the Gradient Bar there are two Color Markers, one at either end of the
Gradient Bar. Just above and half way along the bar, there is a Color Midpoint
Marker.
The Color Markers determine which colors the gradient will start and finish with; the
Color Midpoint Marker marks the point where the two colors are equally blended.
Select a color for the left-hand side of the Gradient Bar by clicking on the left-hand
Color Marker. The little triangle on top of the marker will become black to show that it
has been selected.
347 Photopaint
Next, click on the Color box just below. The Select Color dialog is opened. Select a
color for the marker (you can read about selecting colors in Color selection on page
271). Both the Color box and the left-hand marker are changed to the selected color.
Set the color for the right-hand of the gradient in the same way.
Note that the gradient runs through from the first color to the second with the Color
Midpoint Marker showing where the two colors are equally blended. Initially this is
half way along - select the marker and the Location box will read 50%. You can alter
the location of the Color Midpoint Marker by dragging it either left or right. The point
of equal blending between the two colors will be situated at the new location, which
will be reflected in the Location box. Note that the Location box shows the position of
the currently selected marker (the Color Markers are at 0 and 100% respectively).
You are not restricted to just two Color Markers. To add another, click just below the
Gradient Bar. A new marker is displayed. You can add several markers in the same
way. If you would like to remove a marker just drag it away from the Gradient Bar and
it will disappear.
There are two important points you should note:
•
As soon as you add a Color Marker an extra Color Midpoint Marker is
automatically added above the Gradient Bar.
•
This new Midpoint Marker is placed half way between the new Color Marker and
an adjacent Color Marker. The rest of the Midpoint Markers are shifted along to
take account of the new Color Marker.
348 Photopaint
Once you have added a Color Marker you can proceed to create gradient sections
between Color Markers, leaving the rest of the gradient unaffected. Moreover, you
can drag any Color Marker, except the end markers, to a new position and thereby
expand or contract particular sections of the gradient. Likewise, by dragging the
Midpoint Markers you can alter the point of equal blending in any particular section.
Note that when you click on a Color Marker its location is always displayed as a
percentage of the whole Gradient Bar in the Location Box. However, with the
Midpoint Markers the location is displayed as a percentage of the section between
two Color Markers. If you have previously dragged a Midpoint Marker so that it is,
say, 80% of the distance between the adjacent Color Markers, then it will retain this
percentage distance no matter how many markers are added, until you choose to
drag it to a new location.
The gradient is also displayed in the Preview Bar at the bottom of the box.
2. Initially the opacity of the gradient is 100%. To alter this, click on Transparency.
Note that the Color box changes to the Opacity box and the Gradient Bar becomes
solid black. Opacity and transparency are set in a similar way to color, using the
same tools.
As with color, you can add Markers (below the Gradient Bar) and therefore Midpoints
(above the box). Between any two markers there is one midpoint which indicates the
half way point between the opacity of the two markers.
Set the opacity for a marker by clicking on it and typing a percentage value in the
Opacity box. 0% is totally transparent, 100% is totally opaque.
349 Photopaint
You can set a transparency for the section between any two markers in the following
way: Drag the midpoint to relocate the half way point between the markers. A marker
of, say, 30% and one of, say, 70% will have a midpoint value of 50%. You can drag
any marker, except the end markers, to a new position and thereby expand or
contract particular sections of the gradient. The Location box works in the same way
as for color, with midpoints being measured between adjacent markers and markers
being measured along the Gradient bar as a whole.
The gradient, with both its color and transparency values, is displayed in the Preview
box.
Once you are satisfied with your settings, click on OK to save the gradient and close the
Gradient Editor.
Apply the gradient by selecting Gradient Fill from the Tools bar. The new gradient will
appear among the old gradients in the Gradient drop-down box in the “Gradient Fill”
dialog. Apply the gradient by dragging the Gradient Pointer across the image window, as
explained in Gradient Fill on page 301 .
Brush Editor
Although Photopaint comes with a full set of brushes for use with the various paint tools,
you may sometimes find it useful to be able to create your own brushes. The Brush Editor
enables you to add, delete and edit brushes.
Open up the “Edit Brush” dialog by selecting the Brush Editor command in the Tools
menu.
350 Photopaint
In the Brushes box there is a list of all the existing brushes. The currently selected brush
is displayed in the Preview box below. Note that unless you have already created a
brush all the listed brushes will be the standard ones displayed by default in the
“Brushes” dialog (see Brushes on page 294). You cannot edit or delete a standard brush.
Create a new brush to your own design in the following way:
Click on New to open up the “Brush Options” dialog.
351 Photopaint
There are three basic brush types:
•
Elliptical: rounded and elliptical brushes.
•
Rectangular: rectangular brushes, which can be solid or hollow.
•
Bitmap: bitmap brushes, which can be created from the images in a separate bitmap
file (use the Load Bitmap button to locate and load your bitmap images).
Select one of these types before proceeding to create the brush.
Once you have selected a brush type, various tools for determining the brush’s shape
and size become available. The set of tools that can be used to create or edit a brush
depends on the particular brush type.
•
Use the Radius slider to set the radius of the brush (only Elliptical and
Rectangular) between 1 and 30 pixels. The radius is defined as half the maximum
length of the brush. A long thin elliptical brush will therefore take as its diameter the
distance between the extremities rather than the shorter distance.
•
The Hardness slider determines how soft (0%) or hard (100%) the brush (Elliptical,
Rectangular or Bitmap) will be: the lower the value the fuzzier the brush, the higher
the value the more defined the brush’s edges.
•
The Spacing slider determines the amount of space between the brush marks
(Elliptical, Rectangular or Bitmap) when you use the paint tools. Note that the paint
tools apply a series of identical brush marks in rapid succession, thereby creating the
352 Photopaint
illusion of a solid line. If the spacing is set high enough the individual brush marks
become visible. The spacing can be set at anything from 1 to 999%. This value is a
relative measure of the spacing when compared to the radius of a brush shape.
Anything below 100% will produce a continuous stroke; anything above will produce
a stroke with space in between the brush marks. Note that the effects of spacing are
more apparent when the brush stroke is applied quickly. If the application is slow the
stroke will be solid even though the spacing is high, although the edges of the stroke
will be “bumpy”.
•
The Width slider works only with the Rectangular selection and determines the
thickness of the borders of the rectangle. The higher the width the thicker the border
and the less space visible in the center of the rectangle. The width can be set at any
value from 1 to 30 pixels.
You can keep a check on your adjustments by looking at the changing display in the
bottom right-hand Preview box.
In addition to the above you can determine the roundedeness and angle of the brush
(Elliptical or Rectangular only):
•
The Roundedness box determines the shape of the brush. Use the arrows to reduce
the value from 100% (or type in a value directly). A value of 100% indicates that the
shape is a circle (using Elliptical) or square (using Rectangular). As the value is
reduced towards 0% the shape becomes flatter in one direction and therefore
appears elongated. (Note that the Radius setting is not affected. This can only be
changed by using the Radius slider and is always based on a shape’s maximum
length.)
•
The Angle box determines the direction of the shape. Use the arrows to increase the
angle from 0 to anything up to 360 degrees (or type in an angle directly). Increasing
the angle rotates the shape anti-clockwise.
•
You can also set values for roundedness and angle in the Roundedeness and
Angle box at the bottom left-hand corner. An outline of the shape is displayed, along
with a direction-arrow and handles for adjusting the shape. Click anywhere on the
boundary of the shape to set a new direction. Hold down the mouse and drag till the
arrow is pointing in the direction you want (you can check this by glancing at the
Angle box, in which the angle changes to match). Alter the roundedness by dragging
one of the handles in or out. Likewise, the value in the Roundedness box will reflect
your changes.
Again, your changes can be viewed in the Preview box.
Once you’ve designed your brush you can give it a name in the Brush Name box at the
bottom of the dialog.
353 Photopaint
Click on OK to return to the “Edit Brush” dialog. The new brush is displayed at the bottom
of the Brushes box. Select it to see it displayed in the Preview box.
If you now click on Close and select any of the paint tools on the Tools bar, the new
brush will appear in the “Brushes” dialog, ready to use.
The following are the remaining options available in the “Edit Brush” dialog:
•
You can edit a brush shape by selecting the Edit button. This opens up the same
“Brush Options” dialog that is used to create a new brush. The process of editing is
similar to creating a new brush. All the techniques explained above can be used to
edit an existing brush.
•
Delete a brush by selecting the brush in the Brushes box and then clicking on
Remove. The brush is deleted from the list.
•
Copy a brush by selecting the brush in the Brushes box and then clicking on
Duplicate. It is a good idea to use this command when you want to use a standard
brush as the basis for a creating a new brush.
•
Use Save to save all your current brushes, including new and edited brushes, to a
separate file. Use Load to access brushes stored in a separate file.
Once you have made all the changes you want click on Close to exit the dialog.
Patterns Editor
The Patterns Editor displays all your current patterns and enables you to access
patterns that are stored in separate files.
354 Photopaint
•
New enables you to access a pattern from a separate file and display it in the
“Patterns Editor” dialog as a new pattern.
•
Rename allows you to change the name of a selected pattern.
•
Remove deletes a selected pattern from the current list.
•
Load accesses patterns stored in a separate file.
•
Save enables you to save the current patterns to a separate file.
Note that unless you load patterns from a separate file, you will have to create them from
within Photopaint. See Pattern brush on page 288 for details on how to create a pattern.
Image file formats
As with other image editing programs, Photopaint can only use a file if it is saved in a file
format that Photopaint recognizes. Photopaint recognizes a range of image file formats,
including all the most important ones. If the file you want to open belongs to a format
within this range you can open and save it directly in its own format, save as a native
Photopaint file, or change it to any of the other formats that Photopaint supports.
Why are there different image file formats? The short answer is that the different
technical requirements of the chief graphics media require appropriate formats. For
instance, if you wish to print an image the most common formats are TIFF and EPS. Web
graphics are commonly held as GIF, JPEG or PNG. Multimedia graphics use PICT (for
Macintosh) and BMP (for Windows). It is obviously useful to be able to transfer images
between the various standard formats and between these and Ability Photopaint’s own
format (apx).
Some of the file formats display a dialog when you try to save an image in a new format.
This is to enable you to set certain criteria for how the image will be saved, for example,
the number of bits per pixel, whether the file is to be compressed, and so on.
When considering how large an image file will be, there are two factors you need to take
into account: The dimensions of the image, that is, the height times width in pixels, and
the amount of information stored for each pixel within the image. The latter is measured
in bits per pixel, the higher the number the greater the amount of information e.g. 8 bits
per pixel allows a color palette of 256 colors, which will therefore give a more “accurate”
image than an image stored as 4 bits per pixel. The way an image is stored is therefore
determined by the extent of the information on each pixel, the dimensions of the image,
and the degree of compression applied to the image.
The full list of image file formats supported by Photopaint, along with their extensions, is
as follows:
Ability Photopaint (apx) on page 356
355 Photopaint
Adobe tagged (tif) on page 356
Alias/Wavefront (pix) on page 357
Amiga IFF (iff, ilbm) on page 357
Bitmap (bmp, dib, rle) on page 357
Compuserve GIF (gif) on page 358
JPEG Images (jpg, jpeg) on page 359
Macintosh PICT Images (pct, pic, pict) on page 360
Portable Bitmaps (pnm, ppm, pgm, pbm) on page 361
Portable Network Graphics (png) on page 361
Raw Images (raw) on page 361
Targa (tga) on page 362
ZSoft Paintbrush (pcx) on page 363
No matter where it comes from, the image has to belong to one of the above formats if
you are to be able to open or save it in Photopaint.
To save an image file of one format as an image file of another format, do the following:
1. Open the file e.g. File/Open and then locate the file in the Open dialog. The file will
be opened in its own format i.e. with the extension that already belongs to it.
2. Next, to save the file in another format, select File/Save As. In the Save As dialog,
select the format you wish to convert the image to from the Save as type drop-down
menu. The name of the file will already be displayed in the File name line, although
you can change it here if you like. Use the Save in box to locate the folder where
you’d like the file to be saved. Click on Save.
3. At this point, depending on the file format you’re saving to, either the save will
immediately be implemented and the image in its new format displayed on screen, or
another dialog will appear. The dialog allows you to determine certain features of the
image before it is saved to its new format. Note that most of the dialogs are identical
or almost so, with only a few being different.
4. Once you’ve made your choices in the dialog, click on OK to save the image in the
new format. At the top of the window, the file extension will change to the new
extension. However, the changes to the new file will be visible only when the file is
356 Photopaint
closed and opened again (this allows you to do further format changes and saves on
the image as it appeared in its original format).
Note: The original image file remains unaffected (i.e. unedited and in its original format)
by the Save As command.
Ability Photopaint (apx)
Ability Photopaint (*.apx) is Ability’s native image format. This format stores the maximum
amount of information from the original file, that is, 24 bits per pixel and with no
compression of the image.
There is no dialog associated with this format, the image being saved straightaway.
Adobe tagged (tif)
Adobe Tagged Image File Format (*.tif) is the main format for transferring an image on to
paper or film, although it handles only pixel-based information.
The dialog allows you to set the bits per pixel i.e. how many colors are to be used to
constitute the image: 1-bit for 2 colors (typically black and white), 4-bits for 16 colors, 8bits for 256 colors, etc.
If you click on 8-bits, and make sure Color and User palette are selected, the Define
button is activated. Click on this to enter the Color Table box. You can choose from a
variety of color ranges from the drop-down list in the Table line at the top of the box:
Custom, Black Body, Grayscale, Macintosh System, Spectrum, Windows System,
Web. Each of these presents a different color palette, the image itself using only the
colors that are available to it from the chosen palette.
The Dither Type i.e. either Color or Gray, refers to how the image format tries to
simulate the colors when moving from a more highly defined image format (i.e. greater
bits per pixel) to a less highly defined one (i.e. fewer bits per pixel). For instance, a patch
of turquoise may be rendered by a combination of blue and green pixels as an
approximation. If you select Gray the dithering will use gray-scale values instead.
357 Photopaint
Alias/Wavefront (pix)
Alias/Wavefront Images (*.pix)
There is no dialog associated with this format, the image being saved straightaway.
Amiga IFF (iff, ilbm)
Amiga IFF Images (*.iff, *.ilbm)
There is no dialog associated with this format, the image being saved straightaway.
Bitmap (bmp, dib, rle)
The Bitmap Images (*.bmp, *.dib, *.rle) format is compatible with the Windows bitmap
editing program that comes with Windows. It is useful for when images are to be edited or
presented by someone using Windows-based software.
The dialog allows you to set the bits per pixel i.e. how many colors are to be used to
constitute the image: 1-bit for 2 colors (typically black and white), 4-bits for 16 colors, 8bits for 256 colors, etc.
If you click on 8-bits, and make sure Color and User palette are selected, the Define
button is activated. Click on this to enter the Color Table box. You can choose from a
variety of color ranges from the drop-down list in the Table line at the top of the box:
Custom, Black Body, Grayscale, Macintosh System, Spectrum, Windows System,
Web. Each of these presents a different color palette, the image itself using only the
colors that are available to it from the chosen palette.
The Dither Type i.e. either Color or Gray, refers to how the image format tries to
simulate the colors when moving from a more highly defined image format (i.e. greater
bits per pixel) to a less highly defined one (i.e. fewer bits per pixel). For instance, a patch
358 Photopaint
of turquoise may be rendered by a combination of blue and green pixels as an
approximation. If you select Gray the dithering will use gray-scale values instead.
Compuserve GIF (gif)
Compuserve GIF (*.gif) format takes up a small amount of space in comparison to most
other formats, thereby becoming the standard for on-screen web graphics. GIF files use a
palette of fewer than 256 colors and are compressed. This means they are more suitable
for images with areas of “flat” color, for example, as is usually the case in the typical
company logo.
The dialog allows you to set the bits per pixel i.e. how many colors are to be used to
constitute the image: 1-bit for 2 colors (typically black and white), 4-bits for 16 colors, 8bits for 256 colors, etc.
If you click on 8-bits, and make sure Color and User palette are selected, the Define
button is activated. Click on this to enter the Color Table box. You can choose from a
variety of color ranges from the drop-down list in the Table line at the top of the box:
Custom, Black Body, Grayscale, Macintosh System, Spectrum, Windows System,
Web. Each of these presents a different color palette, the image itself using only the
colors that are available to it from the chosen palette.
The Dither Type i.e. either Color or Gray, refers to how the image format tries to
simulate the colors when moving from a more highly defined image format (i.e. greater
bits per pixel) to a less highly defined one (i.e. fewer bits per pixel). For instance, a patch
of turquoise may be rendered by a combination of blue and green pixels as an
approximation. If you select Gray the dithering will use gray-scale values instead.
359 Photopaint
JPEG Images (jpg, jpeg)
JPEG Images (*.jpg, *.jpeg) format is ideal for images that are to be used on the web.
Since it uses average color values taken from groups of adjacent pixels to compress the
image, it is not suitable for high-quality printing. However, on the web the diminution of
image quality is more than made up for by the speed of download that compression
allows. Typically, a download of several minutes is reduced to just a few seconds.
Note that the format works best with images that have some tonal subtlety, such as
photographs of people, rather than ones with large areas of block or flat color (use GIF
format instead for these).
Before saving as a JPEG file you can choose some options in this dialog:
360 Photopaint
1. The Quality slider and boxes at the top of the dialog allow you to determine the size
and quality of the image. Basically, the smaller the file the lower the quality, the larger
the file the higher the quality. The slider and the boxes are automatically adjusted
together. Quality runs from 1-100 and can be set in the Quality box. File size can be
set anywhere between Small file and Large file using the slider (or use the Size box
to select from Low, Medium, High and Maximum).Typically a quality rating of
between 40 and 50 will provide a satisfactory file size together with a decent image.
2. The Baseline options (in the Format Options section) cause the image to appear one
line at a time in your web browser, starting from the top. Optimized slightly reduces
the file size when compared to Standard (the default). Note that Baseline JPEGS are
becoming rarer, since viewers get impatient with the amount of time it takes to see
the whole image.
3. The Progressive option causes the image to appear in your web browser in a series
of “passes”. These allow you to see the image straightaway, albeit in faded form,
before the image is fully refreshed. The number of passes is set in the Scan box: the
higher the number the quicker the image begins to refresh, although the longer the
refreshing takes to complete. Note that at present only a few browsers support
Progressive JPEGS, though the situation should improve in the near future.
Macintosh PICT Images (pct, pic, pict)
The Macintosh PICT Images (*.pct, *.pic, *.pict) format is used for images that are to be
displayed on-screen on the Macintosh platform.
361 Photopaint
There is no dialog associated with this format, the image being saved straightaway.
Portable Bitmaps (pnm, ppm, pgm, pbm)
Portable Bitmaps (*.pnm, *.ppm, *.pgm, *.pbm)
There is no dialog associated with this format, the image being saved straightaway.
Portable Network Graphics (png)
Portable Network Graphics Format (*.png) is an alternative to GIFs for web graphics.
Although at present the format is not supported by many of the major browsers, this
should change in the future.
The format comes somewhere between JPEG (which is smaller because of compression)
and GIF (which has a smaller color palette). PNG format is therefore useful for images
that have smaller dimensions but are richer in tones and detail.
There is no dialog associated with this format, the image being saved straightaway.
Raw Images (raw)
Raw Images (*.raw) format is typically used for images stored on mainframe computers.
Raw images are stored only as strings of code.
This dialog appears when you save the image to the Raw format:
This dialog appears when you open the image in the Raw format:
362 Photopaint
Targa (tga)
The Targa (*.tga) format enables images to be combined with digital video sequences
driven by video boards from a number of manufacturers.
The dialog allows you to set the bits per pixel i.e. how many colors are to be used to
constitute the image: 1-bit for 2 colors (typically black and white), 4-bits for 16 colors, 8bits for 256 colors, etc.
363 Photopaint
If you click on 8-bits, and make sure Color and User palette are selected, the Define
button is activated. Click on this to enter the Color Table box. You can choose from a
variety of color ranges from the drop-down list in the Table line at the top of the box:
Custom, Black Body, Grayscale, Macintosh System, Spectrum, Windows System,
Web. Each of these presents a different color palette, the image itself using only the
colors that are available to it from the chosen palette.
The Dither Type i.e. either Color or Gray, refers to how the image format tries to
simulate the colors when moving from a more highly defined image format (i.e. greater
bits per pixel) to a less highly defined one (i.e. fewer bits per pixel). For instance, a patch
of turquoise may be rendered by a combination of blue and green pixels as an
approximation. If you select Gray the dithering will use gray-scale values instead.
ZSoft Paintbrush (pcx)
The ZSoft Paintbrush (*.pcx) is one of the original graphics formats.
The dialog allows you to set the bits per pixel i.e. how many colors are to be used to
constitute the image: 1-bit for 2 colors (typically black and white), 4-bits for 16 colors, 8bits for 256 colors, etc.
If you click on 8-bits, and make sure Color and User palette are selected, the Define
button is activated. Click on this to enter the Color Table box. You can choose from a
variety of color ranges from the drop-down list in the Table line at the top of the box:
Custom, Black Body, Grayscale, Macintosh System, Spectrum, Windows System,
Web. Each of these presents a different color palette, the image itself using only the
colors that are available to it from the chosen palette.
The Dither Type i.e. either Color or Gray, refers to how the image format tries to
simulate the colors when moving from a more highly defined image format (i.e. greater
bits per pixel) to a less highly defined one (i.e. fewer bits per pixel). For instance, a patch
of turquoise may be rendered by a combination of blue and green pixels as an
approximation. If you select Gray the dithering will use gray-scale values instead.
364 Photopaint
See:
Image file formats on page 354
Vector tools
Please note that Vector tools are not available in the "standard" version of Ability
Photopaint. Please see http://www.abiity.com/ for more information.
Most Photopaint images, whether scanned or created from scratch, are laid out much like
any other image, for example, photographs and paintings. Basically there is a surface
with an arrangement of colors, represented in Photopaint by combinations of pixels.
Whenever you want to edit the image you have to use various techniques to change
selected pixels within the whole image. In effect this is what happens whenever you use
the normal paint tools to add or remove color, and the selection tools to concentrate on a
limited area of the image which you may want to edit, move, scale, or transform in some
other way. All of these techniques are relatively cumbersome and inexact, in that it is
sometimes difficult to select precisely the area you want to edit. With vector tools you can
create areas of color which are treated as objects in their own right. Although these
objects are part of the image, in that they are “superimposed” on it, they can also be
regarded as independent of the image, therefore easily editable in a variety of ways.
The Photopaint Vector tools use what are called vector paths to create vector objects.
Each vector object has a sharply defined shape which encloses a color or range of
colors. Vector objects are treated independently of other vector objects and of any image
created through normal bitmap technology. Essentially a vector object can be understood
as a set of coordinates with various attached attributes. The advantage in using vector
objects is that they are easy to manipulate, and therefore easy to scale, move, rotate, etc.
as whole objects. None of these operations is easily accomplished with normal bitmap
images.
Whenever you create a vector object it is not added to an existing layer but placed above
all the layers. If the object is 100% opaque you will not be able to see through to the
images on the layers below. However, it is easy to edit any object so that it is transparent
in some degree.
The following sections will show you how to create and edit vector objects.
Creating a vector object on page 364
Editing vector objects on page 369
Creating a vector object
Once you have read about vector objects (see Vector tools on page 364) it is a simple
step to creating your own.
365 Photopaint
First, you need to open up the Vector tools box by clicking on the Vector tool
on the
). The Vector
Tools bar (this is paired with and next to the Vector Preview Mode
Tools Box is displayed with all the tools necessary to create and edit vector objects.
There are various options for creating objects:
Vector Line on page 365
Vector Rectangle on page 366
Vector Round Rectangle on page 366
Vector Oval on page 366
Vector Polygon on page 366
Bezier Curve on page 367
Vector Free Hand Objects on page 368
Vector Text on page 368
Vector Line
Click on the Vector Line tool
in the Vector tools box.
Drag the pointer till the line is the required length and then release the mouse.
The line will be given the color of the current background color.
366 Photopaint
You can read about how to edit vector objects in Vector objects: Modifying on page 373.
Vector Rectangle
Click on Vector Rectangle
in the Vector tools box.
Drag the pointer vertically and horizontally till the rectangle is the required size and then
release the mouse.
The rectangle will be filled in with the current foreground color.
You can read about how to edit vector objects in Vector objects: Modifying on page 373.
Vector Round Rectangle
Click on Vector Round Rectangle
in the Vector tools box.
A dialog box will be displayed. Use the Radius slider to change the “roundedness” of the
corners. You can set any value between 0 and 50. A radius of 0 produces a normal
rectangle.
Drag the pointer vertically and horizontally till the round-cornered rectangle is the
required size and then release the mouse.
The rectangle will be filled in with the current foreground color.
You can read about how to edit vector objects in Vector objects: Modifying on page 373.
Vector Oval
Click on Vector Oval
in the Vector tools box.
Drag the pointer till the oval is the required size and then release the mouse.
The oval will be filled in with the current foreground color.
You can read about how to edit vector objects in Vector objects: Modifying on page 373.
Vector Polygon
Click on Vector Polygon
in the Vector tools box.
367 Photopaint
The “Polygon” dialog will be opened. You can create either a Polygon or a Star by
clicking on the appropriate button. Set the number of sides for the polygon or radiating
points for the star, between 3 and 16 inclusive, in the Number of Sides box.
In the case of the star you can use the slider to set the Attitude.
Drag the pointer till the polygon or star is the required size and then release the mouse.
The polygon or star will be drawn using the current background color. Only the outline will
be drawn, with the body of the shape hollow.
You can read about how to edit vector objects in Vector objects: Modifying on page 373.
Bezier Curve
Bezier curves enable you create vector objects by using a series of curves, lines and
control points to draw vector paths. Each point has an associated axis which can be used
to increase the length and degree of curvature of a section of the vector path. The final
shape of the vector object is created when you close off the curve. There are various
ways of doing this, as you will see.
Click on Bezier Curve
in the Vector tools box.
There are two basic techniques to remember when using the mouse to draw curves and
lines:
•
Curves: Click once and keep the mouse button depressed to create a curve point,
marked by a control point. An axis centered on this point is displayed along with two
handles, one at either end of the axis. Drag the handles to extend and rotate the axis,
thereby changing the length of the curve and the degree of curvature. Release the
mouse button to set the curve. After setting a curve, moving the pointer will create
another curve until you click again.
•
Lines: Click once and release to create a control point. Move the pointer to draw a
straight line, which becomes fixed as soon as you click again. After setting a line,
moving the pointer will draw another line until you click again, at which point you can
create a curve if you keep the mouse depressed (as described above) or another line
if you click and release.
To complete a curve you must right-click to define the finish point and open a submenu
with the following options:
•
Open Curve: draws the curve using the current background color without joining the
start and finish points.
368 Photopaint
•
Smooth Closed Curve: draws and fills in the curve with the current foreground color,
the start and finish points being joined together with a smooth curve.
•
Glue end points: draws and fills in the curve with the current foreground color, the
start and finish points being pulled towards one another.
•
Close with line: draws and fills in the curve with the current foreground color, the
start and finish points being joined with a straight line.
The best way to learn how to create vector objects using Bezier curves is, as always, to
experiment. You can always edit or delete the results later on.
You can read about how to edit vector objects in Vector objects: Modifying on page 373.
Vector Free Hand Objects
This option enables you to draw vector objects freehand using your mouse.
Click on Vector Free Hand
in the Vector tools box.
Drag the mouse pointer to draw the required shape and then release the button. A
submenu is displayed, giving you the choice of any of the following for completing the
curve:
•
Open Curve: draws the curve using the current background color without joining the
start and finish points.
•
Smooth Closed Curve: draws and fills in the curve with the current foreground color,
the start and finish points being joined together with a smooth curve.
•
Glue end points: draws and fills in the curve with the current foreground color, the
start and finish points being pulled towards one another.
•
Close with line: draws and fills in the curve with the current foreground color, the
start and finish points being joined with a straight line.
You can read about how to edit vector objects in Vector objects: Modifying on page 373.
Vector Text
This option enables you to add vector text to an image, selecting from all the usual fonts,
sizes and styles.
Click on Vector Text
in the Vector tools box.
369 Photopaint
The mouse pointer turns to a T-symbol. Move this to the point where you want the text to
appear and click once to open up the “Vector Text” dialog.
In the main box of the dialog type your text.
All the usual font options for the text are available through the Font button. These include
font type, style, and size. (Note that changing any of the font characteristics will affect the
contents of the whole of the “Vector Text” dialog. If you would like to mix font
characteristics in a piece of text, it is necessary to open up the dialog separately for each
change.)
The text will take the color of the current Background Color box i.e. the lower box in the
Tools bar.
In the Alignment box you can choose either Horizontal or Vertical for text to run either
across or down the image window respectively.
There are two ways you may want to edit vector text:
•
firstly, treating it purely as text, you can select the Vector Text button
in the
Vector tools box and click on the vector text you want to edit i.e. using the mouse
pointer T-symbol. This opens up the “Vector Text” dialog again, with the relevant text
selected. Edit the text as you would normally e.g. you can change the style, size and
font, and remove or add letters. Click on OK to close the dialog box and apply your
changes.
•
secondly, you may treat the vector text as both text and shape, as with any other
vector object. In this case, you can use the normal procedures for editing vector
objects, which you can read about in Vector objects: Modifying on page 373.
Editing vector objects
There are several ways in which you might want to edit the vector objects you have
created (see Creating a vector object on page 364).
These fall into three categories:
•
Adjustment of the object’s size, position, shape and alignment.
•
Changing the color, transparency, border properties, etc. of the object.
•
Manipulating, adding and deleting control points to change the shape of the object.
Before you can proceed with editing you must select one or more of the vector objects.
To do this click on the Select Curves tool
in the Vector tools box.
370 Photopaint
Various dialogs and tool boxes are displayed. (These will be dealt with later.)
Select one (or more) of the vector objects by dragging your mouse around the relevant
object (or objects) and then releasing the mouse. Alternatively, move the cross pointer till
it turns to a hand over the object and then click once. Since you will often have several
objects in close proximity, or even overlapping, this latter method is a useful way of
pinpointing the object to be selected. A box is placed round the object to indicate that it
has been selected. You can now edit proceed to edit the selected object in various ways.
For information on how to edit an object’s size, position and shape, see Vector objects:
size, position, shape on page 370.
For information on how to alter color properties, see Vector objects: Fill options on page
376.
For information on how to manipulate control points to alter the shape of the object, see
Vector objects: Modifying on page 373.
Vector objects: size, position, shape
Once you have selected a vector object (see Editing vector objects on page 369), you
can make changes to its size, position and shape. This is achieved by making
adjustments to the transformation box which has been placed around the object.
The Vector tools box contains the following options, which are accessible by clicking on
the relevant tool:
Free transform
. This allows you to move, scale and rotate the object. The pointer
becomes an arrow inside the box, a cross while placed over any of the handles, and a
curved double-headed arrow outside the box.
•
To move the object, place the pointer inside the box and drag the arrow to a new
position.
•
To stretch the object, place the pointer over the relevant handle (or handles) and
drag the cross to a new position.
•
To rotate the object, move the pointer anywhere outside the box and drag-rotate the
curved double-headed arrow to a new position. Note that the object rotates about the
star-like symbol at the center of the box. You can move this symbol by clicking on it
and dragging. The object will henceforth rotate about the new position.
The above operations are together known as Free Transforms, that is they are applied
by you by hand, using the mouse, and are all available simultaneously. You can restrict
the range of transforms to any one of these or to one of the other options. In choosing
371 Photopaint
one of these options, you automatically make the others unavailable. For instance, while
scaling you will be unable to rotate the selection.
To access the other options click on the relevant tool or right-click and make a selection
from the displayed menu.
The options include:
Scale
Stretch the object either horizontally or vertically by
dragging the handles of the transformation box. The
object will be scaled to match the new box dimensions.
Rotate
Rotate the object by dragging the double-headed arrow
outside the transformation box. The object will rotate
with the box. Note that the star-like symbol acts as the
center of rotation and can be dragged to a new position.
Skew
Skew the object by dragging a center-of-line handle in
either direction along the line of the transformation box
on which it is situated. The object will adjust to fit the
skewed box. Note that dragging a center-of-line handle
moves the whole of the line.
Move
Move the object by dragging the transformation box to a
new position.
Mirror
Mirrors the object when the transformation box is
dragged to an adjacent position: left or right, the object is
reflected in a vertical “mirror”; up or down, the object is
reflected horizontally; diagonally, the object is reflected
vertically and horizontally. Note that Mirror moves the
object to its mirror-image position.
Reset
Resets the original position, size and shape of the object
i.e. returns it to its state when first selected. Note that
Reset is available only through the right-click menu and
not the tool box.
In addition to the above you also have the option to align vector objects in a variety of
ways: see Vector objects: aligning on page 371.
Vector objects: aligning
The Align tool box gives you the power to arrange objects in a variety of ways.
372 Photopaint
Since vector objects can overlap in the image window, it is useful to be able to decide
which position each object will occupy in relation to the others in the “hierarchy”, and
therefore which objects will be completely visible and which partially hidden. In addition,
Align gives you options for adjusting the height, width and position of selected groups of
objects.
If you have two or more overlapping objects, you may want to change the order of one or
more of the objects. Select the object you would like to re-align. It is best to use the handpointer and then click once (see Editing vector objects on page 369). For these tools to
become active you must select one and only one object (with the exception of grouped
objects - see below).
In the Align tool box there are four options highlighted:
Bring to Front
The selected object will be
brought in front of all the objects it
overlaps.
Send to Back
The selected object will be sent to
the back of all the objects it
overlaps.
Bring Forward
The selected object will be
brought in front of the overlapping
object one place ahead.
Send Backward
The selected object will be sent
behind the overlapping object one
place behind.
The above options work with a single selected object. However, you can select several
objects and then turn them into a single Group. The boxes surrounding the individual
objects are turned into one big box around all the selected objects. To create a group
drag the pointer round the relevant objects and then release. The individually selected
. The above four
objects can now be turned into a group by clicking on the G tool
options are highlighted. You can now proceed to move the group to the front or back,
forwards or backwards. To Ungroup and return to the individually selected objects, just
click on the U tool
.
To activate the rest of the align tools you need to select at least two of the objects. Drag
the pointer round the objects you want to align and then release the mouse button. Each
of the objects is surrounded by its own box. Note that if you attempt to move one of these
objects they will all move together.
373 Photopaint
After you have made your selection the rest of the options in the Align tool box become
available. Each of the following commands applies to the currently selected objects (nonselected objects are ignored):
Align Left
Objects are lined up with the object
furthest to the left.
Align Right
Objects are lined up with the object
furthest to the right.
Align Top
Objects are lined up with the top of the
current highest object.
Align Bottom
Objects are lined up with the bottom of
the current lowest object.
Align Vertical
Objects are lined up along a vertical
axis.
Align Horizontal
Objects are lined up along a horizontal
axis.
Space Evenly Vertically
Spaces three or more objects evenly in
vertical direction.
Space Evenly Horizontally
Spaces three or more objects evenly in
horizontal direction.
Make all same width
Makes all objects the same width.
Make all same height
Makes all objects the same height.
Make all same size
Makes all objects the same height and
width.
Vector objects: Modifying
In normal viewing mode vector objects are displayed as colored shapes, curves or lines.
As explained in Editing vector objects on page 369 it is possible to do basic editing when
still in this mode. However, for more sophisticated editing of an object’s shape it is best to
go into Preview mode. The objects then appear in their basic outline without color, that is
as vector paths, and the main control points can be seen.
374 Photopaint
The control points mark the key places along the vector path and are used for altering the
shape of the vector object. This is done by manipulating the axis that runs through each
control point.
The following section shows you how to modify various types of vector object, for
example, a Vector Rectangle on page 366 and a Bezier Curve on page 367.
To modify a vector object two actions must be performed beforehand:
Click on the Modify tool
on the Vector tools bar. This displays the Modify Tools
Bar, which contains these tools:
Modify Control Points
Sharp Corners
Add Control Point
Remove Control Point
Next, click on the Preview mode tool
displayed as vector paths.
on the Tools bar. The vector objects are then
on the
Make the control points visible by clicking on the Modify Control Points tool
Modify Tools Bar and then clicking on the vector object you would like to modify. There
will be four control points, one at each corner, for a rectangle; two for an oval, one at the
top and one at the bottom; one for each “joint” in a Bezier Curve, that is, at each of the
points where you clicked when creating the curve; and so on.
Notes on control points and axes
1. Each control point (except for those described in 7 below) has an axis running
through it in a particular direction (sometimes the axis is not visible i.e. when the
control point is at a corner the axis is folded up). The axis is centered on the control
point, with the two halves being equal in length.
2. At either end of the axis there is a handle. Handles are used to turn the axis around
the control point, which acts as the center of rotation, and to alter the length of the
axis. Changing the direction or length of an axis changes the vector path that runs
through the relevant control point. Note that the axis through a control point situated
on a curve of the vector path is always at a tangent to the vector path at that control
point (if the path at that point is a corner the axis is folded up, and if it is a straight line
the axis runs along the line).
375 Photopaint
3. As a line is lengthened the vector path around the control point is stretched into a
wider curve; as it is shortened the vector path is contracted until it finally becomes a
sharp corner when the line is of zero length (as with a square).
4. Whatever you do with one handle is mirrored by the other handle, that is, the handles
act in opposing ways - turning one handle downwards will tilt the opposite handle
upwards, dragging one handle outwards will cause the other handle to move an
equal distance in the opposite direction, and so on.
5. The handles can be moved or rotated by dragging with the mouse. Note that you can
also drag the control point itself and the line will move as a whole without altering its
length or direction.
6. Alterations in the vector path are restricted to the sections between the adjacent
control points on either side of the control point that is being edited.
7. Some vector objects – especially those that are “open curves”, or polygons without a
fill color – have start and finish points that “float free”. These do not have the normal
control point and axis, but either a point without an axis or a one-length axis i.e. there
is no mirror axis acting in an opposed way.
Apart from modifying vector objects by dragging control points and handles, you can also
add and remove points and turn curves into sharp corners:
•
Since the vector path is only affected between adjacent control points on either side
of the edited control point, you may wish to add or remove control points to restrict or
increase the editable range. To add a control point click on the Add Control point
tool
on the Modify Tools Bar. Next, click on the relevant vector object to active
all the current control points. Move the mouse pointer over the point on the vector
path where you want the new control point to appear and click once. A control point
and axis will be added to the path at this point. The segment of vector path that is
affected when editing will thus be reduced. The new control point can be used to alter
the vector object, as described in the previous paragraph.
•
Contrariwise, if you would like to remove a control point, click on Remove Control
on the Modify Tools Bar and then click on the relevant vector object.
point
Next, click once on the control point you would like to remove. The control point will
disappear and the segment of vector path that is affected when editing will thus be
increased.
Note that after adding or removing a control point you must once again click on the
Modify Control point tool
and then the vector object to be able to modify the
vector path, as described above.
376 Photopaint
•
The Sharp Corners tool
enables you to convert a control point on a curved
vector path into a sharp corner. The axis running through the control point will be
reduced to zero length, although you can stretch it out again by dragging in the usual
way (the sharp corner will then become a curve again). Convert a control point into a
sharp corner by clicking on the Sharp Corners tool and then clicking on the relevant
object to activate the control points. Next, click on the control point you would like to
convert to a sharp corner.
When you have modified the vector objects to your satisfaction, click on the Preview
mode tool
on the Tools bar again to switch it off and return to the normal vector
object view, with colors restored.
Vector objects: Fill options
Vector objects can be filled in with color, using either Solid Fill, Gradient Fill or Pattern
Fill.
in the Vector tools
To make these available you must first click on Select Curves
box. Next, you need to use your mouse to select one of the objects (see Editing vector
objects on page 369). The Fill tools box and Bezier Options boxes are displayed (as
well as the Align box - see Vector objects: aligning on page 371).
Choose from these options:
Vector objects: Solid Fill on page 376
Vector objects: Gradient Fill on page 378
Vector objects: Pattern Fill on page 379
Vector objects: Solid Fill
You can fill a vector object with a solid color by clicking on Solid Fill
box (see Vector objects: Fill options on page 376).
in the Fill tools
Before clicking on Solid Fill you need to select a vector object. The “Fill” dialog is then
displayed:
In the Color box select the Fill color from:
•
Foreground: the current foreground color
•
Background: the current background color
377 Photopaint
•
Black: solid black
•
50% Gray: half white, half black
•
White: solid white
•
Custom Color: select a color in the Select Color dialog
Note that the Fill color is displayed in the Preview box.
In the Blending box set the Mode and Opacity. The Mode works in a similar manner to
blending between layers, except that blending is restricted to the selected vector object,
rather than applied to the whole vector object “layer” (see Vector objects: blend modes on
page 379).
Once you have set the Color, Opacity and Mode click on OK to apply the Fill.
The particular Solid Fill applied will now appear in the Bezier Options box. Here you can
edit the Fill in a number of ways:
1. First, click on one of the Solid Fills listed in the top box. (Since you can set many of
these for the same object, there may be more than one listed. For each of them the
relevant details will be displayed in the rest of the box.)
2. In the Border Size box you can set a border value between 0 and 50.
3. Click on the Border Color box to open up the Select Color dialog to select a new
color.
4. In the Mode box select a mode from the drop-down list (see Vector objects: blend
modes on page 379).
5. Use the Opacity slider to set a value between 0 and 100%.
6. Finally, click on the Fill Color box to open up the Select Color dialog, where you can
select another color.
The changes you make will take effect immediately.
At the top of the box there are some Move buttons. These allow you to move through the
saved Solid Fills:
Move operation up
Move operation down
378 Photopaint
Move operation first
Move operation last
As you click on these you will see the selected object change to display the properties of
each of the chosen Solid Fills. If you would like to delete a particular Solid Fill, make sure
it is selected and then click on Delete operation
. The Solid Fill will be deleted from
the list and the next one down in the list applied to the selected vector object.
You can create many Solid Fills for the one vector object, as well as Gradient Fills on
page 378 and Pattern Fills on page 379.
Vector objects: Gradient Fill
You can fill a vector object with a gradient by first selecting a vector object and then
tool in the Fill tools box (see Vector objects: Fill options
clicking on the Gradient Fill
on page 376). The Bezier Options box is then displayed.
To activate the Gradient Fill options in the Bezier Options box, you must first drag the
gradient pointer – a hand symbol – a short distance across the selected vector object.
Release the mouse and the Gradient Fill option is listed in the box at the top of the Bezier
Options box.
Select Gradient Fill to make the normal gradient options visible. You can now proceed to
set the Border Size and Border Color, and the Mode and Opacity (see Vector objects:
blend modes on page 379).
Next, select from the available gradients in the Gradient box and gradient types in the
Gradient type box below. For information on using gradients and some examples, see
Gradient Fill on page 301 . However, bear in mind that in this case you are using gradient
fill with vector objects and not with normal selections or layers.
Any selections you make in the Gradient and Gradient type boxes, as well as in the
Border Size and Color and Mode and Opacity boxes, are immediately implemented in the
selected vector object.
Note that the extent of the gradient is in accordance with the distance you initially
dragged the gradient pointer. You can alter this by making all your gradient selections, as
described above, and then clicking on the Set Vector button at the foot of the box. This
turns the pointer to the gradient hand-pointer again: drag this the required distance
across the vector object and then release the mouse. The gradient is applied across this
distance.
Note that every gradient you use with this particular object is listed in the box at the top of
the dialog, along with any Solid Fills and Pattern Fills you may have created.
379 Photopaint
Vector objects: Pattern Fill
You can fill a vector object with a pattern.
1. First select a vector object and then click on Pattern Fill
Vector objects: Fill options on page 376).
in the Fill tool box (see
2. The pointer becomes a paint tin. Move this over the selected object and click once.
3. In the first instance the object will be filled with a gray color. However, a Pattern Fill
option will now appear in the Bezier Options box. Click on this option to display the
rest of the Pattern Fill options.
4. Drag the slider to change the Border Size of the object.
5. Change the color of the border by clicking on the Border Color box to open up
Select Color.
6. Set the blend mode of the object in Mode and the degree of transparency in Opacity
(see Vector objects: blend modes on page 379).
7. To fill the vector object with a pattern, do the following:
a. Click anywhere in the Fill Pattern box. This opens up the Pattern Editor.
b. In the Pattern Editor you will find a display of all the patterns you have previously
saved. (If the Pattern Editor is empty you need to create a pattern before you can
proceed. Do this by making a selection of the part of an image that contains the
pattern you want to use, and then select Make Pattern from the Select menu.
The selected pattern is then made available to all tools that use patterns.)
8. Click on the pattern you want to use and click OK.
The selected vector object will be filled in with the chosen pattern. To change the pattern
fill for the object just select another pattern. You can have many pattern fills attached to
the same vector object.
Vector objects: blend modes
The following examples show you how to apply the blending techniques discussed in
Vector objects: Fill options on page 376 . Bear in mind that the whole point of blending is
to be able to work out what color values will be displayed when an image is composite,
that is, made up of various layers and objects, with some colors overlapping one another.
Blending with vector objects is similar to blending between layers, but with these
differences:
380 Photopaint
•
•
All the vector objects belonging to an image can be regarded as occupying a layer of
their own. This layer is positioned above all the normal image layers.
The effect of blending with vector objects is worked out by taking the color of the
selected vector object, along with its mode and opacity, and calculating a final color
from a combination of this, the color of the underlying image layer, and the color of
any other vector objects that overlap with the selected object.
Photopaint has to calculate, for each pixel, the resultant color from a combination of the
base color (the color of the layer below the vector object “layer” or the color of the object
that overlaps with the selected object) and the blend color (the color of the selected
vector object). The particular blend mode used determines, of course, the way the
resultant color is calculated.
The default value for the blend mode is Normal, as you can see in the Mode box.
Another important concept when selecting a blend mode is that of opacity, which is set in
the Opacity box. For some blend modes an effect becomes apparent only if the opacity
is set at less than 100% e.g. Dissolve.
The main blend options, which you can select in the Mode box, are:
•
Normal
The resultant color is the same as in the currently selected object (subject to the
amount of transparency set in the Opacity box, therefore visibility through to the lower
layer). In effect, the base color is not used to help calculate the resultant color where
the base and blend colors overlap.
•
Dissolve
An object with less than 100% opacity is converted - “dissolved” - to 100% opaque
randomly scattered pixels. The effect is of a rough brushstroke, containing a mixture
of blend and base pixels, rather than an evenly transparent one.
•
Multipy
The brightness values of the base and blend colors can be combined to create a
darker tone. This is done by multiplying the two brightness values when they are
expressed as fractions. For example, white has a brightness value of 255 (the
maximum) and is represented as 255/255 or 1; black has a brightness value of 0 (the
minimum) and is represented as 0/255 or 0. All other brightness values are
represented as fractions between 0 and 1 e.g. 150 is represented as 150/255; 100 as
100/255. Therefore, using Multiply we get the result (100 * 150) / (255 * 255), which
works out at 59/255. You can immediately see that the resultant brightness will
always be lower than (or equal to) the brightness of either one of the multiplied
381 Photopaint
fractions. This intuitively fits in with our experience of placing one transparent sheet
on top of another, where the result is always darker.
Note that the above means that if the blend color is white, the resultant color is the
same as the base color. If the base color is white, the resultant color is the same as
the blend color. If either the base or the blend color is black, the resultant color is
black. If the base color is transparent, the result of blending any color is black (since
a transparent layer counts as 0, that is, the same as black).
•
Screen
This mode has the opposite effect to Multiply, combining the base and blend colors to
create a lighter tone.
These are some of the more important options, but there are many others:
Behind, Overlay, Difference, Addition, Subtraction, Darken Only, Lighten Only,
Hue, Saturation, Color, Luminosity, Divide, Color Burn, Color Dodge, Hard Light,
Soft Light
Remember that you can always cancel or change the effect of a blend mode by selecting
another one, especially the Normal blend mode.
If you would like to make the blending operations using vector objects permanent, then
you should select Flatten Image from the Layers menu. See the relevant notes in Merge
operations with layers on page 326 for more information.
Plug-ins
Please note that Plug-ins not available in the "standard" version of Ability
Photopaint. Please see http://www.abiity.com/ for more information.
A powerful feature of Photopaint is the ability to use "plug-ins". A plug-in is a miniprogram that extends the operation of a parent program. To be used with Photopaint, the
plug-in must be Adobe Photoshop™ compatible. A plug-in usually behaves in a similar
way to a built-in filter.
Many design studios and freelance designers make their plug-ins available on the web.
Although you will have to pay a fee to download some of these, there is still a huge
number that you can download for free. Since most plug-ins are written to be compatible
with Adobe Photoshop, you can begin your web search for suitable plug-ins by searching
for something like: Photoshop plug-ins. Plug-ins are also available from time-to-time with
computer magazines.
Installing and running plug-ins
382 Photopaint
1. Follow the instructions that come with the plug-in. Usually, this will simply be a case
of unzipping a compressed file into the correct target folder. Sometimes, the plug-in
will come with its own setup program. In all cases, make sure the plug-in is installed
in the Photopaint plug-in folder, which is typically:
\Program Files\Ability Office 2002\Plug-ins
In Photopaint, select Options from the Tools menu and view the General tab of the
dialog to check and set the plug-in folder.
2. Exit Photopaint and then restart it to activate the plug-in.
3. To run the plug-in, make a selection on the current image (or select all of the image)
and select Plug-ins from the Filter menu. A sub-menu is displayed showing all the
available plug-ins.
4. Pick a plug-in. Depending on the plug-in, either it will be applied immediately to the
open image in your window or a filter dialog box will open. In the latter case you will
be able to edit the settings for the filter. There will usually be a preview box to display
the results before you apply the filter.
Note that some of the plug-ins act as true filters, that is they alter an image on the basis
of those colors that comprise the image. However, there are plug-ins which overwrite the
current image.
383 Draw
Draw
Draw is a graphical applet that is called on by the main Ability applications - Write,
Spreadsheet and Database - whenever they need to use vector drawing tools.
Draw can be used on its own to create and save graphical designs such as letterheads,
logos, and emblems. These can be reused later by Write or Spreadsheet.
With Draw you can create lines, shapes and text boxes, and insert pictures from other
applications.
Starting Draw
To start Draw, follow these steps:
1. Click the Start button on the Windows Taskbar
2. Select Programs
3. Select Ability Office
4. Select Ability Draw
Draw will open with a new document, ready for adding graphics.
Parts of the Draw window
The Draw window consists of standard toolbars (for operations such as opening files and
cutting shapes), a set of rulers, and the draw document itself. You can have many draw
documents open at once.
There are three toolbars that are specific to Draw: the draw toolbar, the color toolbar and
the align toolbar.
These toolbars will also appear in other Ability applications that use Draw (for example, in
Database when designing a form, or in Write or Spreadsheet when a drawing is inserted).
To help work with draw objects, the Draw window also has rulers and gridlines.
The tools bar
The tools bar is a set of drawing tools which provide the main method of adding any
element to your document.
384 Draw
For more details, see Adding a shape on page 386.
The color toolbar
The color toolbar is a palette of colors.
You use the color bar to choose the colors you want to use when drawing with a tool or
changing the color settings of an existing draw object.
•
Click on a color to set the back-color (the color of the insides of a shape).
•
Right-click on a color to set the fore-color (the color of the lines in a shape).
•
Click on the Custom color button to define your own mix of colors.
For more details, see Setting the color of draw objects on page 391.
The align toolbar
The Align toolbar allows you to align, size and center multiple draw objects.
385 Draw
For more details, see the following sections:
Working with groups of objects on page 394
Spacing objects on page 395
Aligning objects on page 394
Resizing objects together on page 394
The rulers and gridlines
Across the top and down the left of the document window are the rulers.
As you move the mouse pointer across the screen, you will see the gridlines - markers on
the rulers - moving as well. These indicate your exact position.
You can choose not to display the rulers - select the Ruler command from the View
menu.
The grid
When snap control is turned on, any objects you create, resize or move will jump or
‘snap’ to align themselves with the grid divisions. This is usually the best way of working
with Draw, as it is easy to create and align objects manually.
To control the grid, select Grid Setup from the Tools menu and then:
•
In the Horizontal box, type the number of horizontal grid points you want per unit of
measurement.
•
In the Vertical box, type the number of vertical grid lines you want per unit of
measurement.
•
Use the Always Snap To Grid checkbox to turn snap on and off.
When grid snap is on, it may be useful to view the grid points. Select the Grid button
or select Grid from the View menu. Note that Draw may only display every other grid
386 Draw
point (or every third or fourth), if the number of grid points per unit of measurement is too
high to display on screen without crowding. In this case, movement will still obey the
underlying grid settings.
If you've drawn and positioned an object when grid snap is turned off, you can align it to
the grid by selecting it, right-clicking and selecting Align to Grid (or use Align to Grid
from the Format menu).
Creating a drawing
When you start Draw, you are automatically given a new document.
on the toolbar to create a new drawing. Alternatively, select
Click on the New button
the New command from the File menu.
Now use the draw tools bar to add draw objects (lines, shapes and text) to the drawing.
The following sections show you how to add draw objects, and also how to move, size
and format them.
Adding a shape
Shapes can be added to your draw document by using the tools bar. The following
sections show you how to add lines, polylines, squares, rectangles, ellipses, circles, arcs
and polygons to your drawing.
Drawing a line
To draw a line:
1. Select the Line button
.
2. Press the mouse button (without releasing it) to start the line, drag the mouse, and
release the button to complete it.
Drawing a polyline
A polyline is two or more lines joined together. You could make the letter "W" using the
polyline tool.
To create a polyline:
1. Select the Polyline button
.
387 Draw
2. Click at the start of the line, move the mouse, and click again when you wish to start
a new segment of the line. Continue moving the mouse and clicking to draw
connected lines.
3. Double-click with the mouse to finish the polyline.
You can also use the polyline tool to draw a freehand line, by dragging the mouse but
without depressing the mouse button.
Note: Unlike the Polygon Tool, double-clicking on the end point does not close the
shape, unless you manually join the start and end points. You cannot fill a closed polyline
with a color.
Drawing a square or rectangle
To draw a square or rectangle:
1. Select the Rectangle button
.
2. Press the mouse button to start the rectangle, drag the mouse, and release the
button to complete it.
Use the Rounded Rectangle button
rounded corners.
instead to draw a square or rectangle with
Drawing an ellipse or circle
To draw an ellipse or circle:
1. Select the Ellipse button
.
2. Press the mouse button to start the ellipse, drag the mouse, and release the button
to complete it.
Drawing a polygon
To draw a polygon (a many-sided shape):
1. Select the Polygon button
.
2. Click to start the polygon, move the pointer and click again to finish the first edge.
3. Repeat step 2 to create as many edges as you want.
388 Draw
4. Double-click to complete the shape - Draw automatically joins the first and last points
with a straight line.
You can also use the polygon tool to draw a freehand shape, by dragging the mouse but
without depressing the mouse button.
Drawing an arc
To draw an arc, that is, a segment of a circle:
1. Select the Arc button
.
2. Press the mouse button (without releasing it) to start the arc, drag the mouse, and
release the button to complete it. The direction in which you drag determines which
quadrant you draw.
3. Use the handles midway along each edge of the arc to adjust the angle:
Drawing a text box
To put text into a drawing, you need to add a text box. A text box can contain a word, a
line or several paragraphs.
To add a text box:
1. Click on the Text box button
in the toolbar.
2. Press the mouse button (without releasing it) to start the text box, drag the mouse to
the end point, and release the button. Alternatively, just click on the page - a defaultsized text box will be added.
3. Type the text you require, and then press enter to finish.
The text will wrap to fit the width and depth of the text box you draw – you can fit more
text into the box by increasing its size (see Resizing a draw object on page 390).
389 Draw
You can put several paragraphs in a single text box – type the first line or paragraph and
then press ctrl+enter to start a new line. This works in the same way as the enter key
does in Write.
If you want the text to appear without any background or border, set these styles to None
(see Line and fill styles on page 391).
Inserting pictures
To insert a picture into a drawing:
1. Select Picture from the Insert menu. The “Open” dialog box is displayed. Select the
picture file you wish to use, and click on the OK button.
2. Position the picture by clicking on the page where you would like it to appear.
You can also use the clipboard to paste pictures into a drawing. For example, press ALTPrint Screen to get a snapshot of any window, and then select the Paste button
insert it into Draw.
to
Selecting, moving and resizing draw objects
The following sections show you how to select single and multiple draw objects, and also
how to move and resize them.
Selecting a single object
To select a single object, click on the Select button
and then click on the object.
Black “handles” will appear to indicate that the object has been selected:
Selecting multiple objects
Click on the Select button
•
and then do one of the following:
Click outside the objects in question, and drag a selection box around them all. When
the box is surrounding the shapes you require, release the mouse button. All the
objects within the selection will now display their handles.
390 Draw
•
Click on the first object and then click on subsequent objects with the Shift key held
down.
•
Choose the Select All command from the Edit menu to select every object in the
drawing.
When a group of objects has been selected, "handles" will appear on every selected
object:
Moving a draw object
To move a draw object (or objects) do the following:
1. Select the object (or objects).
2. Drag it (or them) to a new location.
Resizing a draw object
To resize a draw object:
1. Select the object (see Selecting a single object on page 389).
2. Drag a handle to a new location.
To force a rectangle into a square or an ellipse into a circle, select the object, right-click,
and select the Set as Square or Set as Circle command.
For resizing multiple objects, see Resizing objects together on page 394.
Formatting a shape
All draw objects have common properties that you can change:
391 Draw
Line and fill styles (see Line and fill styles on page 391)
Colors (see Setting the color of draw objects on page 391)
In addition, text boxes have three other properties:
Text alignment (see Text alignment on page 393)
Text box border style (see Text box border style on page 392)
Fonts in text boxes (see Fonts in text boxes on page 393)
Line and fill styles
A draw object has a line-pattern and width, and, for solid objects, a fill-pattern. By default
these are solid line, 1 point in width, and solid color, respectively. You can change these
styles for one or more objects, as well as changing the default setting.
1. Select the object or objects (see Selecting multiple objects on page 389 for more
details).
2. Right-click and select Properties.
3. Select the Style tab.
As an alternative to steps 2 and 3, select the Style command from the Format menu.
Next, choose from the following:
•
Select Brush Style to see the range of available fill patterns. This sets the pattern of
the interior of the object. If you want a simple color (the default) select Solid. If you
want the shape to be transparent, select None.
•
Select Pen Style to see the range of available line styles. This sets the style for the
outline of the shape. If you don’t want an outline to appear around a shape, select
None.
To change the default settings for new objects, make sure no objects are selected (to do
this, click in a blank area of the drawing), right-click and select Defaults from the shortcut
menu. Follow the instructions for pen and brush style as above.
Setting the color of draw objects
Shapes - rectangles, ellipses, polygons and text boxes - have two color properties: forecolor and back-color. Fore-color is the color of the lines and back-color is the color of the
inside area of the shape. Only lines have a fore-color.
392 Draw
To set these colors:
1. Select the object or objects (see Selecting multiple objects on page 389 for more
details).
2. Click on a color on the color toolbar to set the back-color (see Color toolbar on page
384).
3. Right-click on a color on the color toolbar to set the fore-color.
As an alternative to steps 2 and 3, select the Color command from the Format menu.
To change the default settings for new objects, make sure no objects are selected (to do
this, click in a blank area of the drawing) and use the color toolbar to set the colors you
want.
Note that setting the back-color to white is not the same as having a transparent object.
To do this, set the fill style to None instead - see Line and fill styles on page 391.
Text box border style
Text boxes have a border property, in addition to the usual properties of draw objects.
To set the border property:
1. Select the object or objects (see Selecting multiple objects on page 389 for more
details).
2. Right-click and select Properties.
3. Select the Border tab.
As an alternative to steps 2 and 3, select the Border command from the Format menu.
Next, choose from the following:
•
None. Turns off the border altogether.
•
Standard. Plain border in accordance with the pen style (see Line and fill styles on
page 391).
•
Sunken. Creates a 3D sunken effect. To see this effect properly, you need to set the
text box back-color (see Setting the color of draw objects on page 391) to be the
same as the page background (and this should not be white).
•
Raised. Creates a raised effect. To see this effect properly, apply the same
conditions for Sunken, as above.
393 Draw
•
Shadowed. Puts a dropped shadow around the text box.
•
Double. Same as Standard but a double line box is drawn.
Note that you can create the effect of a rectangle having a border property, by adding a
text box but without entering any text.
Fonts in text boxes
A text box can use any font and font style. Fonts cannot be mixed within a text box.
To set the text font within a text box:
1. Select the text box or boxes (see Selecting multiple objects on page 389 for more
details).
2. Right-click and select Properties.
3. Select the Font tab.
As an alternative to steps 2 and 3, select the Font command from the Format menu.
In the Font box, choose the font you require. Choose the style in the Font Style box and
the size in the Size box. A preview of your choices is shown in the Sample box.
Text alignment
To set the alignment of text within a text box:
1. Select the text box or boxes (see Selecting multiple objects on page 389 for more
details).
2. Right-click and select Properties.
3. Select the Align tab.
As an alternative to steps 2 and 3, select the Text Align command from the Format
menu.
Choose from:
•
Left
•
Center
•
Right
394 Draw
Working with groups of objects
You can work with groups of objects to resize, align and space the objects together. In
addition, you can form objects into groups and manage drawings that have overlapping
objects. The following sections show you how to work with groups of objects.
Resizing objects together
To evenly size two or more objects, first select them (see Selecting multiple objects on
page 389) and then use any of the following buttons:
Make Same Width. All the selected objects are adjusted to have the same width.
Make Same Height. All the selected objects are adjusted to have the same
height.
Make Same Size. All the selected objects are adjusted to have the same height
and width.
All these commands are also available under Same Size in the Format menu.
Overlapping objects
Even the simplest drawing can contain overlapping objects, so you need control over the
order in which objects appear in the drawing.
•
To bring an object (or selection of objects) to the front of a drawing, right-click and
select the To Front command (also available from the Format menu).
•
To send an object (or selection of objects) to the back of a drawing, right-click and
select the To Back command (also available from the Format menu).
Aligning objects
To align two or more objects, first select them (see Selecting multiple objects on page
389) and then use any of the following buttons.
Align Left. Aligns the left edges of all selected objects to the left edge of the leftmost selected object.
Align Right. Aligns the right edges of all selected objects to the right edge of the
right-most selected object.
395 Draw
Align Top. Aligns the top edges of all selected objects to the top edge of the topmost selected object.
Align Bottom. Aligns the bottom edges of all selected objects to the bottom edge
of the bottom-most selected object.
Center Vertical. Aligns vertically the center points of all selected objects, around
the center point between the outer edges of the highest selected object and the
lowest selected object.
Center Horizontal. Aligns horizontally the center points of all selected objects,
with the center point between the outer edges of the left-most selected object and
the right-most selected object.
All these commands are also available under Align in the Format menu.
Spacing objects
To evenly space three or more objects, first select them (see Selecting multiple objects
on page 389) and then use any of the following buttons.
Space Down. Adjust the space between all the selected objects, so that it is
vertically the same.
Space Across. Adjust the space between all the selected objects, so that it is
horizontally the same.
Both of these commands are also available under Space Evenly in the Format menu.
Grouping draw objects
Once you have determined the relative positions of several draw objects, you can group
them together so that Draw treats them as a single object. In this way, you can prevent
accidental movement of one of the elements.
To group objects together:
1. Select all the objects (see Selecting multiple objects on page 389).
2. Right-click and select Group from the shortcut menu. The Group command is also
available from the Tools menu.
396 Draw
When objects are grouped they can be moved and formatted as normal, but they cannot
be resized.
To split a group back into its individual objects, first select the group and then select the
Ungroup command from either the shortcut menu or the Tools menu.
Draw object
A draw object is any drawing, shape or line created from the tools bar (see The Tools bar
on page 383) - a line, rectangle, rounded rectangle, polyline, polygon, arc or text box.
Creating, editing and manipulating draw objects will be your primary task in working with
Draw.
397 Integration in Ability
Integration in Ability
Integration is a term used to describe how different applications work together and
especially how they share data.
There are three main ways Ability can share information:
1. Copy and paste (see Copy and paste on page 397) – a simple copy of data from one
application to the next.
2. Linking through fields (see Linking through fields on page 400) – sharing data
through field links. Data remains live, so that when the source is changed the linked
field or fields change also. Mail Merge is the most obvious example of field level
integration.
3. Embedding and linking documents (see Object embedding on page 409) – whole
documents, or a selected part of a document, can be inserted into another
application. For example:
•
Include spreadsheets and charts in Write
•
Include drawings in Write and Spreadsheet
•
Include Write documents in Spreadsheet
There is a special link function called Hyperlink that allows documents to refer to other
documents (or web pages) and provide a clickable jump to load that document. See the
hyperlink function on page 581 for more details.
See also:
Fields - an introduction on page 413
Mail merge on page 86
Copy and paste
In general, you can select any text, data or formulas and make a copy for insertion into
another – or the same – document. Ability has commands that enable you to Copy,
Paste and Cut data. If you want to copy data to another location without retaining the
original source data, then use Cut instead of Copy. Here are the basic steps:
1. Select the data you wish to copy, using either the mouse or cursor keys. This might
be the contents of an individual cell or range in a spreadsheet or database, whether
text, data or formulas, or an area of a Write document.
398 Integration in Ability
2. Click on the Copy button
copies to the Clipboard.
or select Copy from the Edit menu. This command
3. Switch to the application that contains the document to which you wish to copy.
4. Click on the Paste button
or select the Paste command from the Edit menu.
This copies from the Clipboard to the target document.
Once the Paste command has been issued, there is no further link between the copied
data in the target document and the contents of the clipboard or the source of the data. It
is as if you have retyped the data, but much quicker. The contents of the clipboard
remain unchanged until you copy some other data to it.
Most of the Ability applications –Write, Database, Spreadsheet – support rows and
columns. When you copy data from one application to another, the rows and columns are
preserved. This is obvious with Database and Spreadsheet, which are defined in term of
fields and cells, but less so with Write, in which a row is represented by a paragraph and
a column by a tab stop. For example,
Jan
12
Feb
13
Mar
9
Apr
7
has four columns (since the months and numbers are each separated by pressing the
Tab key) and two rows.
See also:
Examples of copy and paste on page 398
Copy and paste in dialogs on page 399
Examples of copy and paste
Here are some examples of what you can do with Copy and Paste:
•
Database Î Spreadsheet
Select the rows and columns (the range of fields) you want to copy from the database
and copy and paste into a spreadsheet. Ability will preserve the order of the rows and
columns and every field from the database will appear in a different spreadsheet cell.
•
Database Î Write
Select the rows and columns (the range of fields) you want to copy from the
database, and copy and paste into a Write document. Each column is separated by a
tab stop and each row begins on a new line.
399 Integration in Ability
If the database row is too long to fit on a single line in the Write document and "wraps
around" onto the next line, try bringing the tab stops closer together and/or reducing
the font size.
•
Write, Spreadsheet Î Database
This is the reverse of the above two operations. Ideally the number of columns in
Spreadsheet – or the number of tab separated columns in Write – should match the
number of fields (columns) in your database (if not, you may find that fields from
different records merge into a single record).
•
Write Î Spreadsheet
Select the text you wish to copy. This can be a word, a line or several paragraphs.
When you paste into Spreadsheet, tabs will begin new columns and paragraphs new
rows. Use Paste Special from the Edit menu and select Unformatted Text.
See also:
Copy and paste in dialogs on page 399
Copy and paste in dialogs
As well as using copy and paste to transfer data between applications, you can copy and
paste into dialog boxes and formula entry lines. You will need to make use of the shortcut
keys to do this:
Ctrl+C
Copy
Ctrl+V
Paste
For example, in the text of a Write document, there appears the name of another
document - a spreadsheet called Figures, say. To copy and reuse the word "Figures":
1. Select it by double-clicking on it.
2. Press Ctrl+C to copy it.
3. Switch to Spreadsheet.
4. Click the Open button
.
5. Press Ctrl+V to paste it into the File name box.
400 Integration in Ability
Linking through fields
One of the most powerful features of Ability is the capacity for a field in one document or
application to refer to a field in any other Ability document or application. Such a
relationship is called linking and can take two forms: one-way linking and two-way linking:
1. A one-way link (see One-way links on page 136) is used to access data that is
located in another document, from the current document. The data can be displayed
or used in a formula, but cannot be changed unless you open the original document.
A one way link can be made between documents in different applications.
2. A two-way link (see Two-way links on page 407) allows you to change data at either
end of the link. This means that the original document is updateable from the target
document, though two-way links cannot be used in formulas.
Linking can be used to connect these documents:
•
Cells in a spreadsheet to another spreadsheet, write document or database form.
•
Fields in a database to a spreadsheet or write document.
•
Fields in a write document to another write document, spreadsheet or database form.
For a general discussion on fields, see Fields - an introduction on page 413.
Links can also be set up between cells in the same spreadsheet or fields in the same
Write or database document (see One-way links in a spreadsheet on page 136 and Twoway links in a spreadsheet on page 136).
One-way links
To create a one-way link, you need to know the name and the location of the document
to which you want to link. With a Write document or spreadsheet you need to know the
name of the field or cell address whose value you want to access. If you want to link to a
database you also need to know the table or query name, along with the field name and
record number.
The link is created using one of the Remote functions. The remote functions you will
most often need are:
WPGET(document_name, reference)
Retrieve field from Write
SSGET(document_name, reference)
Retrieve field from Spreadsheet
DBGET(database_name,
source_table, field_name, record)
Retrieve field from Database
401 Integration in Ability
When you enter a remote function in a field in the current document, you need to specify
the following:
1. Name and path of the remote document or database (otherwise the current folder will
be searched).
2. Name of the field, in the remote document, whose value is sought.
3. When linking to a database, you will additionally need to supply the table name, field
name and record number.
As well as returning single values, all field links can be used to return ranges, which can
then be used to provide range totals, maximums, minimums, and so on.
The following examples should be studied. Also, for more on Remote functions, see
Remote functions on page 568.
Linking two spreadsheets together
To create a one-way link from a spreadsheet called accounts to a cell, say B10, in a
spreadsheet called sales, follow these steps:
1. Select a cell in accounts where you'd like the value from sales to appear, say A1.
2. Click in the formula entry line.
3. Click on the Insert Function button
to bring up the “Insert Function” dialog.
4. Click on the Remote tab and scroll through to select the SSGET function.
5. Select OK to pick the function.
6. Enter the function parameters so that the formula appears as follows:
=SSGET ("sales", "B10").
7. Click
to finish the formula.
Ability will display the value from the sales spreadsheet inside the accounts spreadsheet.
Once the link has been made, the cell can be referenced like any other. For example, the
formula
=A1 * 2
402 Integration in Ability
anywhere in the accounts spreadsheet will simply display the value from A1, originally
from sales, doubled.
You can also use the SSGET function directly as part of a formula. For example:
=(10 + SSGET("sales", "B10"))/2
Note that the function parameters must be placed in quotation marks. Also, the example
assumes that the two spreadsheet documents are in the same folder. If they are not, then
you must specify the full document path. For example,
=SSGET("c:\my documents\sales", "B10")
if sales is stored in the default document folder.
Any change made to B10 in sales will automatically be reflected in A1 of accounts.
However, since this is a one-way link, the attempt to enter a value in A1 of sales will
overwrite the link formula and hence destroy the link (see Two-way links on page 407 to
find out how to set up two-way links).
Linking two Write documents together
To create a one-way link between a field, say janprofits, in a Write document called
report, and a field, say monthtotal, in a Write document called annuals, where the link
is from report to annuals, follow these steps:
1. You first need to create a field in report. Select Field from the Insert menu. Enter
janprofits for the field name (which is obviously more descriptive than the default
name of Field1), click the Next button, and enter 1276.34 as the field contents in the
Formula entry line. Click the Finish button.
2. Switch to annuals and click where you want the field to appear. Select Field from the
Insert menu. Enter monthtotal for the field name and click the Next button. Click the
Functions button and select WPGET from the Remote function category. Enter the
document name and field name into the function, so that the formula appears as
follows:
=WPGET("report", "janprofits")
Click the Finish button.
3. The field will appear in the document. Click outside the field to activate the one-way
link. The value from the report document, 1276.34, will appear in the document.
Note that the example assumes that the two documents are in the same folder. If they
are not, use the full document path of the source document. For example,
403 Integration in Ability
=WPGET("c:\my documents\report", "janprofits").
Linking from a Write document to a spreadsheet
Suppose you have a sales spreadsheet with monthly sales figures. You want to include
the highest monthly figure and the total sales for the year in a Write document. The
spreadsheet is called sales97 and the figures you will need run from C1 to C12. The
figures need to appear in the middle of a paragraph like this:
"The average monthly sales for 1997 was $xxxx.xx with the highest single month
topping out at $xxxx.xx."
Follow these steps to link from the Write document and extract these figures:
1. In the Write document, type the text of the paragraph. Leave a space where the fields
need to be inserted.
2. Position the cursor between the words "was" and "with".
3. Select Field from the Insert menu.
4. Click the Next button (if you want you can enter a more meaningful field name on the
first page of the wizard).
5. Enter the following formula:
=AVG(SSGET("sales97", "C1..C12"))
6. Click Finish.
7. Position the cursor at the end of the paragraph and repeat steps 3 through 6, using
the following formula:
=MAX(SSGET("sales97", "C1..C12))
Note that the example assumes that the two documents are in the same folder. If they
are not, use the full document path of the source document. For example,
=MAX(SSGET("c:\my documents\sales97", "C1..C12"))
Linking from a spreadsheet to a database
Suppose you have a database called accounts, containing a table called invoices.
Among other fields in the database table, there is a field for the total of the invoice,
invtotal, one to identify the customer, custid, and two more for the date of the invoice
and the date it was paid, invdate and paydate. The particular customer you are
404 Integration in Ability
interested in has a custid entry of 1024. In a spreadsheet, you want to analyze his
payment history, perhaps plotting a graph to show the payment trend. Follow these steps:
1. Display the first invoice total: Enter the following formula:
=DBSQLFILTER("accounts.adb", "invoices", "custid=1024", "invtotal", 1)
Let’s explain this in some detail. The first two parameters to this function are simply
the database name and the table name – note you need to include the document
extension with the database name (adb). The table contains invoices to many
customers, so you have to identify which customer you want to return values for. This
is done with the third parameter to the function – "custid=1024". Next, we specify
which field is to be returned with the third parameter – invtotal. The function actually
returns all the fields matching the condition, so we need to say which one is to be
displayed. The final parameter says "display record 1".
2. Display the invoice and payment dates. In the cells to the right of the invoice total,
enter the following two functions:
=DBSQLFILTER("accounts.adb", "invoices", "custid=1024", "invdate", 1)
=DBSQLFILTER("accounts.adb", "invoices", "custid=1024", "paydate", 1)
3. Repeat steps 1 and 2 for the rows below, incrementing the record number (the fifth
parameter) by one each time, until all the matching invoices are displayed.
4. You can now analyze the data in several ways. Here are two examples:
Produce an average payment period by subtracting the invdate column from the
paydate column and dividing by the number of invoices.
Plot a bar chart of the number of days it takes to pay each invoice (again by first
subtracting the invdate column from the paydate column).
There are a number of ways this example can be improved and made more general (so it
will work easily for other customers).
Refining database links
The Database is ideal for storing information, but Spreadsheet is the best place to
perform calculations. Using the database links, you can combine these tools in an
efficient and powerful way. For an example of how to make links to database, see Linking
from a spreadsheet to a database on page 403. The notes below show how the example
can be refined.
1. The number of matching records can be calculated in advance, using the following
formula:
=ROWS(DBSQLFILTER("accounts.adb", "invoices", "custid=1024", "invtotal"))
405 Integration in Ability
2. If there are many matching invoices, the ROW function can be used to propagate the
formula. For example, supposing record one was entered in row 10, you could use
the following:
=DBSQLFILTER("accounts.adb", "invoices", "custid=1024", "invtotal", ROW()9)
When this cell is copied down the spreadsheet, the appropriate record is displayed.
3. It could be more efficient if some of the parameters are entered separately in
spreadsheet cells. For example, cells A1 through A5 could contain the following
text/formulae:
Once A5 is copied down and across (with the correct field names), you can enter a
new customer ID in cell A3 and analyze a different customer.
4. Taking step 3 a bit further, you could insert a mail merge field that will step through
each customer and so print out a "payment history". To do this follow these steps:
a. Select Field from the Insert menu.
b. Enter custfield as the field name. This is actually the name of the new field, not
the database field to be linked to, so you can choose any name you like.
c.
Select the Database radio button and then click Next.
d. Make the link: pick the accounts database, the invoice table and the custid field
and click Finish.
e. Substitute the following formula for cell A4 (in step 3 above):
=SSGET("spread1", "custfield")
where spread1 is the name of the current spreadsheet and custfield is the new
field.
f.
Select the Mail Merge button
menu.
or the Mail Merge button from the Tools
g. Select Print to finish the mail merge.
406 Integration in Ability
Using one-way links in formulas
One-way (but not two-way) links can be used as part of a standard formula. In addition,
because the link functions can return ranges as well as individual cells, you can apply
any function that has a range as a parameter directly to the link. For example, using the
following spreadsheet called quarter:
When building a formula in another spreadsheet or a field in a Write document, treat the
link function like any other. For example:
=10+SSGET("Quarter", "B3") / 2
To count the number of records, and to find the total, average and maximum volume,
refer to the range and use these built-in functions:
=ROWS(SSGET("Quarter", "B2..B5"))
=TOTAL(SSGET("Quarter", "B2..B5"))
=AVERAGE(SSGET("Quarter", "B2..B5"))
=MAX(SSGET("Quarter", "B2..B5"))
The same ideas can be applied to a database table. Consider the following invoice table
in an accounts database:
The table information can be referred to in the following ways:
=10+DBGET("accounts.adb", "invoices", "invtotal", 3) / 2
to re-use the invoice total field from row 3 (that is the value 8.50) in a formula; and
407 Integration in Ability
=ROWS(DBGET("accounts.adb", "invoices", "invtotal"))
=TOTAL(DBGET("accounts.adb", "invoices", "invtotal"))
=AVERAGE(DBGET("accounts.adb", "invoices", "invtotal"))
=MAX(DBGET("accounts.adb", "invoices", "invtotal"))
to find the number of records, and the total, average and maximum of the invoice totals.
Two-way links
A two-way link is a connection between the current field and a field in another – or the
same – document. If you change the value of either field, the value in the other field will
also change.
A two-way link cannot be used as part of a formula, unlike a one way-link (see Using oneway links in formulas on page 406). Apart from this, you build two-links in the same way
as one-way links, as follows:
1. Create a normal one-way link (see One-way links on page 136 for more details).
2. Turn the edit source property on:
•
In a spreadsheet, use the Edit Source button
property in the Format/Attributes dialog.
•
In a Write document, double-click on the field, select Attributes from the Field
menu and select the Edit Source property.
or select the Edit Source
For example, consider the following database table, called invoices:
1. In a spreadsheet cell, enter the following formula:
=DBGET("accounts.adb", "invoices", "invtotal", 3)
2. The result of the formula - 8.5 - is displayed.
3. Click on the Edit Source button.
408 Integration in Ability
4. You can now enter a new value in the cell, and the database will be updated.
Linking and embedding documents
On some occasions, you may find you need to insert a chart or part of a spreadsheet (or
both) into a report you are creating in Write. It could be that you want to create a new
spreadsheet that will only exist within the current document, or you may want to insert a
spreadsheet that you've already created. Further, you may want the document to
automatically update should the original spreadsheet change.
These are all examples of a standard Windows technique called Object Linking and
Embedding (or OLE for short), which Ability uses to enable such documents to be
created. In this case, the Object is the spreadsheet, Embedding refers to the inclusion of
an object within the current document (as in the first two examples above), and Linking
refers to the "live" display of external data (as in the final example above).
All the Ability applications support OLE to some extent, as do many other non-Ability
applications (meaning that Ability can share data with other applications).
Here’s a list of what can be inserted and where:
Application
Write
Spreadsheet
Database OLE field
Draw (and Database forms)
External programs (non -Ability
applications supporting OLE).
Include objects from
Spreadsheet (including charts), Draw, and
any external applications that support
OLE
Write, Draw, and any external applications
that support OLE
Spreadsheet (including charts), Write,
Draw, and any external applications that
support OLE
Spreadsheet, Chart, Write, and any
external applications that support OLE
Write, Spreadsheet, Chart, and Draw.
The following sections tell you all about object linking and embedding, as well as giving
some examples.
Object linking
When an object is linked, the source data continues to reside physically wherever it was
initially created. Only a reference, or link, to the object is kept with the compound
document (along with appropriate presentation data). Linked objects cannot "travel" with
documents to another machine; they must remain within the local file system or be copied
explicitly.
Linking is efficient and keeps the size of the compound document small.
409 Integration in Ability
You may choose to link when the source object is owned or maintained by someone else,
so that a single instance of the object’s data can serve many documents.
Changes made to the source object are automatically reflected in any compound
documents that have a link to the object.
To link an object:
1. Select Object from the Insert menu.
2. Select the Create from File radio button.
3. Make sure the Link box is checked.
4. Select the Browse button to locate the source object (for example, if you are
embedding an Ability spreadsheet, you should be looking for a document with an
AWS extension).
5. Select OK to insert and link the object.
Object embedding
When an object is embedded, a copy of the original object is stored physically in the
compound document, along with all the information needed to manage the object. As a
result, the object becomes a physical part of the document. A compound document
containing embedded objects will be larger than one containing the same objects as
links.
However, embedding offers several advantages that may outweigh the disadvantages of
the extra storage overhead. For example, new objects can be inserted as needed, and
compound documents with embedded objects may be transferred to another computer
and edited there.
To embed an object, select Object from the Insert menu and do one of the following:
•
Create and embed a new object
1. Select the Create New radio button.
2. Select the object type – this can be Ability Spreadsheet, Write or Draw, or an
object from any other listed application.
3. Click OK to embed the new object.
•
Embed an existing object
1. Select the Create from File radio button.
410 Integration in Ability
2. Make sure the Link checkbox is clear.
3. Select the Browse button to locate the source object (for example, if you are
embedding an Ability spreadsheet, you should be looking for a document with
an AWS extension).
4. Click OK to embed the object.
Inserting a spreadsheet into a Write document
To insert a spreadsheet into a Write document, position the cursor in the Write
document at the point where you want the spreadsheet to go and do one of the
following:
•
Insert a new spreadsheet
Select Spreadsheet/Chart and then New from the Insert menu. A standard
spreadsheet will appear, ready for entering data.
•
Insert an existing spreadsheet
1. Select Spreadsheet/Chart and then From File from the Insert menu.
2. Browse to the spreadsheet you want to insert.
Once the spreadsheet, whether new or old, has been inserted, you can display a
selected part of the spreadsheet or a certain area of rows and columns. In edit and
display mode, you can use the zoom buttons to make the cells − and hence the data
within them − display larger or smaller. In scaling mode, you can scale the spreadsheet to
fit more neatly into your Write document.
•
On the standard spreadsheet view, that is in edit mode, use the handles to resize the
spreadsheet and the scroll arrows to bring the relevant part of the spreadsheet into
view. In this way you can determine the rows and columns that will be displayed
and/or a particular cell or group of adjacent cells. Use the zoom buttons on the
and Zoom out
, to increase or decrease the size of the
toolbar, Zoom in
spreadsheet cells and their data. Note that the inserted spreadsheet object (or view)
will itself remain the same size until you use the handles to resize it, so you may
need to resize in conjunction with zooming.
•
Click once outside the spreadsheet to go to display mode. The spreadsheet will
retain the form you set for it in edit mode, that is the same rows and columns or
group of cells will be displayed. In this mode you can’t edit the data or resize the
spreadsheet, and the row and column bars are not visible. You can however use the
zoom buttons to increase or decrease the size of the displayed cells and their data.
•
411 Integration in Ability
Click once again inside the spreadsheet to go to scaling mode. The spreadsheet is
displayed with its handles visible. Use the mouse to drag these handles and hence
resize the rows and columns. Dragging horizontally only will increase/decrease the
column width for all the columns. Dragging vertically only will increase/decrease the
row height for all the rows. Dragging diagonally, using the handle at the bottom right
corner, will increase/decrease both the column width and row height for all rows and
columns.
•
Double-click inside the spreadsheet to return to the standard spreadsheet view (edit
mode).
•
Note that when printing a Write document with an inserted spreadsheet, the
spreadsheet object is printed without the row and column bars, that is to say, it is
printed as if it is in display mode, even if the current screen view happens to show the
spreadsheet in edit mode.
If you wish to insert a chart, based on a spreadsheet, into a Write document, see
Inserting a chart into Write on page 411 for more information.
Inserting a chart into Write
Since a chart is always attached to a spreadsheet, you insert a chart into a Write
document by first inserting the spreadsheet and then selecting or creating the chart to
display (see Inserting a spreadsheet into a Write document on page 410 for details on
how to insert the spreadsheet).
Immediately after insertion the spreadsheet will be in edit mode. This means you can
make changes to the spreadsheet rather than the document. If you drop out of edit mode
(by clicking in another part of the document, for example), double-click on the
spreadsheet again to make it active.
The next step depends on whether you're creating a new chart or displaying an existing
chart, as follows:
•
Creating a new chart
Select the figures you want to chart (or type them in if it's a new spreadsheet).
Select As New View from the Insert / Chart menu. Follow the steps in the chart
wizard to create the appearance you want. See Chart on page 151 for more details
on how to create charts.
•
Displaying an existing chart
Once a spreadsheet has been inserted, you can choose which view you'd like to
show in the document. Select Sheet from the View menu to display the normal
spreadsheet grid. Select Chart from the View menu to view the chart. If there is
more than one chart, you will be prompted to make a selection.
412 Integration in Ability
See also:
Linking and embedding documents on page 408
Inserting a Draw document into Write or Spreadsheet
To insert a Draw document into a Write document or spreadsheet, position the cursor at
the point where you want the Draw document to appear and do one of the following:
•
Insert a new draw document
Select Picture/New Ability Drawing from the Insert menu. A standard draw
document will appear, ready for creating a new drawing – see Draw on page 383 for
more details on how to create a drawing.
•
Insert an existing draw document
1. Select Picture/From File from the Insert menu.
2. Click on the Browse button to choose the draw document.
See also:
Linking and embedding documents on page 408
Inserting an image into Write or Spreadsheet
An image (or picture) can be inserted directly into a Write document or spreadsheet.
An image is a file in one of the following formats:
BMP
WMF
DIB
TIF
GIF
TGA
PCX
JPG
Windows Bitmap
Windows Meta File
Device Independent Bitmap
Tagged Image File Format
CompuServe™
Targa
PC Paintbrush™
Jpeg
Inserting the picture:
1. Select Picture/From File from the Insert menu.
2. Double-click on the image you want (or first browse to the folder where the image
resides, if necessary).
413 Integration in Ability
3. Once inserted, you can scale the image to the size you need by dragging the
picture's handles.
Note: both Spreadsheet and Write support the pasting of images via the clipboard.
See also:
Linking and embedding documents on page 408
Fields – an introduction
Fields are common throughout Ability. The most obvious example of a field is a cell in a
spreadsheet – it can contain plain text, numbers or dates, or it can display the result of a
formula. The same is true of formula fields in Write documents and Database forms and
reports.
Fields share common properties – fonts, borders, colors, numeric formatting, alignment –
throughout the Ability applications.
There are other properties that depend on the particular type of field. For example, a
mail-merge field in Write (also called a database field elsewhere in Ability) allows
database information to be browsed and merge printed in Write, Spreadsheet and
Database. To do this it accesses a source database, table and field. See Inserting fields
on page 414 .
Another powerful property of fields is their ability to refer to, or link to, fields in other
documents and applications – see Linking through fields on page 400 .
Here are some examples of fields:
Application
Write
Description
Date and time field
Mail merge field
Formula field
Database field
Spreadsheet
Cells
Floating field i.e. a database or
formula field that can be
dragged and dropped
Created through
Insert/Date and Time
Insert/Mail Merge Field
Insert/Field – this is the
standard field, which
can be used for
formulas and links
Insert/Field – this field
allows you to browse or
change data held in a
database table
Standard spreadsheet
cells – always present
Insert/Field – select
either the Formula or
Database field type in
414 Integration in Ability
Database
anywhere in spreadsheet. You
can mail merge or browse
database information, or
separately store information in
addition to the standard
spreadsheet cell, as well as
show the results of formulas
Formula field in forms and
reports – equivalent to a
standard field in Write.
Lookup Summary field – joins
the current table to another
table to provide summary
information.
Database field – browse
information from another
database table
Date and Time
Page Number
the field wizard.
Insert/Formula Field
when in design mode in
forms or reports.
Insert/Lookup Summary
Field – available in both
forms and report design
mode.
Insert/Database Field –
available in design
mode in forms and
reports
Insert/Date and Time
Insert/Page Number
– available in design
mode in forms and
reports
Inserting fields
Wherever you are working in Ability, whether in Write, Spreadsheet or Database, you will
often find it useful to insert fields. Various types of field are available and some of them
are common to all the applications. Among the options there are fields for date and time,
page number, formulas, mail merges, database lookup, linking, and others. Moreover,
when inserting fields you can also control their appearance and content and how they will
be editable, using the various format and control type options (see Control types on page
416).
Inserting a date and time field
You can insert a date and time field in Write, Spreadsheet, and Database.
In Write, follow these steps:
1. Place the cursor where you want the field to appear
2. Select the Date and Time command from the Insert menu
415 Integration in Ability
3. In the “Date and Time” dialog select a date and/or a time format
4. If you want to insert both the date and time, click on the Date + Time checkbox
5. If you want the day of the week to appear, click on the Include Day of Week
checkbox – click again to get the intermediate state e.g. Tue instead of Tuesday
6. Leave the Update Automatically box checked if you want the date and time to
update automatically (a “live” field will be inserted), otherwise uncheck it if you just
want to insert the current date and time (this will be inserted as text rather than as a
field)
7. Click on OK
In Spreadsheet, follow these steps:
1. To insert a date and time into the body of the spreadsheet you can use the standard
Ability functions, NOW and TODAY (see Date functions on page 486).
2. To insert the date and time into a header or footer, see Headers and footers on page
144 for more information.
In Database, you can insert the date and time into either a form or a report − see
Inserting the date and time into a form or report on page 248 .
Inserting a page number field
You can insert a page number field in Write, Spreadsheet, and Database.
•
In Write, see Inserting page numbers on page 79 .
•
In Database, see Inserting a page number into a form or report on page 247 .
•
In Spreadsheet, see Adding a header and footer on page 144 .
Inserting formula and database fields
You can insert formula and database fields in Write, Spreadsheet and Database.
•
In Write, see Inserting a field on page 78 .
•
In Spreadsheet and Database see Inserting formula fields on page 240 and
Inserting database fields on page 81 .
416 Integration in Ability
Control types
When you create formula and database fields in Write, Spreadsheet and Database, you
can also decide how you want the fields to be editable. This is done through the control
type that you set for the field. There are six standard control types:
•
Edit box (see Edit box control type on page 416)
•
Check box (see Check box control type on page 416)
•
List box (see List box control type on page 417)
•
Combo box (see Combo box control type on page 418)
•
Spin edit (see Spin edit control type on page 418)
•
Radio group (see Radio group control type on page 418)
These can be used with formula and database fields in all the applications.
After you have set the control type for your field, and hence how the field will be
editable, you can, if you want, set options for how the field will operate. There are four
choices:
•
The Edit Source option allows you to change data from either side of a two-way link.
•
The Hide Zeros option allows you to hide any zeros, displaying a blank field instead.
•
The Hide Errors option allows you to hide any error messages, displaying a blank
field instead.
•
The Show as control if inactive option allows you to show the control type itself,
even when the field is not currently selected (“inactive”).
Edit box control type
The Edit box control type allows you to enter any data you like. For instance, if you have
created a Formula field that contains a formula, you can edit it so that it applies to new
data, or change the formula to another one, or replace the formula with any other data or
none at all (this can be done in the formula entry box).
Check box control type
The Check box control type allows you to insert a box that can be checked on or off so
that the field shows True (Yes or 1) or False (No or 0). Typically you use this control type
when you insert a blank formula field into your document and you want to use it to
indicate that some other field has or has not a certain value. Alternatively you may insert
417 Integration in Ability
a database field, say of customer names from a database table, and want to indicate that
you will contact them over the next month (e.g. when checked the check box displays
Yes) or not (e.g. when unchecked the check box displays No).
In addition to the True, Yes, 1 and False, No, 0 values, there are also available @Empty
and @Not Empty. Set these in the Checked and Unchecked boxes (selecting the type of
check in one of these will automatically select the opposite check in the other) after
selecting the Check box control type. You should then type in the display value in the
Display choices box.
For example, if you want to insert a blank field with check box control type into your
document, so that it will display True when checked and False when unchecked, follow
these steps:
1. Select Field from the Insert menu to go into the “Insert Field Wizard”
2. Select Formula in the Field Type box
3. Leave the Formula box empty
4. Select Checkbox in the Control Type box
5. Click on the arrow to select True,Yes,1 in the Checked box (the Unchecked box will
automatically show False,No,0)
6. Type in the Display choices:
•
True in the Checked line
•
False in the Unchecked line
7. Click on Finish to return to your document
To activate the inserted field, double-click on it. You are now free to switch the check box
on or off by clicking on it. Click once outside the field to show the display value i.e. True if
the check box is switched on.
List box control type
The List box control type allows you to choose from a pre-defined list that you have
typed in or from the entries in an already existing database field. When you attempt to
enter data in the box in your document, it will only accept data that is in the list you
typed or in the field that you selected, otherwise it will display the first entry in the list if
you try to enter invalid data. The List box is useful if you want to restrict the data
displayed to a pre-set selection. If you sometimes want the option to enter data that is
not in a pre-set list, then it is better to use the Combo box i.e. combination box, control
type.
418 Integration in Ability
Example
1. When inserting a formula field you can set the Control Type at List box.
2. On the next page of the “Insert Field Wizard”, select Use Choices in the Control
Source box, and then type your list choices (one per line) in the Choices box.
3. Alternatively, if you click on Lookup Choices you can use a pre-set list contained in a
database field.
Combo box control type
The Combo box control type allows you to choose from a pre-defined list or from a
selected database field and to type in entries that are not chosen from either of these. In
this respect it is more versatile than the List box control type, which only allows entries
from a pre-defined list or database field.
Example
1. When inserting a formula field you can set the Control Type at Combo box.
2. On the next page of the “Insert Field Wizard” select Use Choices in the Control
Source box, and then type your list choices (one per line) in the Choices box.
3. Alternatively, if you click on Lookup Choices you can use a pre-set list contained in a
database field.
Once the field is inserted into your document, you can choose from the pre-set choices
or entries in a database field, or type in new entries which do not occur in the list.
Spin edit control type
The Spin edit control type allows you to scroll up and down through a list of numeric
values, where these values are usually held in a particular database field. Alternatively
you can use your own choices, rather than look up pre-existing choices. Using the arrows
on the right side of the inserted field, with spin edit control type, you can select the values
you want displayed for each of the records in your database table. You would do this in
either forms or reports.
Radio group control type
The Radio group control type allows you to select an option from several that you have
set yourself, by clicking on a particular radio box. The radio boxes are mutually
exclusive, so selecting one will turn off any other that is already selected. In this way
you are able to determine the contents of a field, from a restricted number of choices, in
one easy click of your mouse.
419 Integration in Ability
Once you have selected the Radio group option, you should select Use Choices in the
Control Source box of the Group page. You can then enter your group choices in the
Choices box (one per line). Each of these will be displayed to the right of its own radio
group box in your document.
Example
You want to insert a database field into a form so that you can choose which entry, from
a group of entries, will appear for each record in a particular field.
1. When in Design mode, select Database Field from the Insert menu.
2. In the “Insert Field Wizard”, select a field from the database table in the Data field
box. This is the field that will contain whatever you choose from the radio group
choices.
3. On the next page select Radio group.
4. Finally, select Use Choices and type in the names that are to form the radio group
in the Choices box, making sure that each choice occurs on its own line.
5. Select Finish and use the mouse to adjust the size of the field box before returning
to Browse mode.
As you browse through the records in your form, you can click on one of the radio group
choices to insert it into the field you selected from the underlying table. Obviously you
can insert different values for different records. If there is already a value in the field for
a particular record, it will be replaced by any radio group value you decide to choose.
Note that if you intend to insert a radio group database field later on, it is a good idea to
design a table with this in mind. More often than not the field should be set as a
character field, in order to make sure that your radio group choices are of compatible
data type.
420 WriteFX - a text effects tool
WriteFX - a text effects tool
WriteFX (a sort of shorthand for Write Effects) is a text effects tool that creates highly
stylised text for inclusion in Write and Spreadsheet.
Amongst the types of effects that can be added to text include:
•
Gradient fills
•
Text rotation
•
Shadows
•
Borders
•
Shapes
•
Background patterns
Once inserted, WriteFX behaves like any other object – you can move it around by drag
and drop and can insert a frame around to allow more control over positioning and
interaction with the text on the page.
Using WriteFX
WriteFX can be run from within Write and Spreadsheet. Select WriteFX Object from the
Insert menu. The WriteFX dialog is displayed. A brief description of each tab of the
WriteFX dialog now follows. But, really, the best way to understand it is to actually try the
tool out – it's easier seeing how the changes made in the dialog affect the way the text
looks in an interactive manner.
Template
A selection of pre-built designs. Templates are a combinations of all the other
attributes – selecting a template replaces any existing choices you've made in
the other tabs.
Text
The actual text you want to display. Also control over the font and text rotation
(specified in degrees), if any.
Shadow
The shadow sits behind the text. You can control the color, position and
blurring of the shadow.
Border
The border around the text can be positioned inside, outside or centered on
the text boundary. You'll need to experiment to see how this effects the look.
Borders also have a color, width and blur control.
421 WriteFX - a text effects tool
Texture
A textured pattern can be selected for both the text and the background. Note
that this is an alternative to specifying the Colors.
Colors
Set a color for the text and the background. Both can be set to a gradient fill
(one color gradually mixing with another)
Shape
Shape is the contour of the text. Choose from a set of in-built shapes.
Shadows
The shadow behaves as though the text was lifted a small distance from the background
and a light source was shone onto the text. Set the attributes of the shadow as follow:
Offsets (X and Y) – use the slider controls to change the gap, measured vertically (X
Offset) and horizontally (Y Offset), between the text and its shadow. A setting of 0, 0
means the shadow falls directly behind the text.
Color of the shadow – pick from the color palette or select "More" to mix your own color.
Darkness of the shadow – use the slider to set the intensity of the shadow. Slide to the
top for no shadow (i.e. turn the shadow off) and slide to the bottom for maximum
intensity.
Blur – shadows tend to be less well defined around the edges. Slide the blur control to
the top for a "perfect" shadow, not normally seen in nature. Slide it to the bottom for
maximum blur
Borders
The text can be drawn plain (no border) or with a border. If you imagine a giant, red, letter
M on a piece of paper, you could trace an outline in blank ink on the inside of the letter,
on the outside of the letter or actually on the letter edge. This is how the WriteFX border
control works. There is also control over the color of the border, the width of the border
and the border blur.
Width – use the width control to set how heavy a border you want. Set it to zero to turn
off the border effect.
Color – pick the color for your border. Select "More" to mix your own color. Note: if the
border color is set the same as the text color, you will see no effect if the border is
positioned inside the text.
Position of the border – set to Inside, Center or Outside.
422 WriteFX - a text effects tool
Blur – blends the border into the background (slider to the right) or draws a sharp border
(slider to the left).
Texture
A texture can be set for the background, the text or both. Textures are pre-set bitmap
patterns that fill the background or text. If a texture is set, the Colors tab will be
overridden
Use the Background radio button and then pick a texture to set a background pattern.
Use the Body radio button and then pick a texture to set a pattern for the text.
To turn off a texture, set the pattern to "None".
Colors
The text color settings work in the same way as the background settings.
Start Color – either the solid color or, if using a gradient fill, the first color used for the
gradient.
Gradient Direction – set to None for a plain, solid, single color fill. Use any other setting
for a gradient fill. When a gradient fill is selected, the End Color button becomes active.
In addition when Angle is selected, a checkbox to allow the angle to be specified
becomes available.
End Color – (not available if Gradient Direction is set to None). The second color to be
used in the gradient fill.
Angle – (only available when Gradient Direction is set to Angle). A gradient fill blends
two colors in a particular direction. Set the direction in degrees.
Editing an existing WriteFX object
To change the properties of an existing WriteFX object, including the actual text
message, click on the WriteFX object and use the right-click menu to bring-up the Write
FX dialog (see WriteFX dialog on page 420 for more details).
To change the size of the WriteFX object, click on it and move the mouse pointer over
one of the corners or middle points and then stretch it in any way you want.
When using WriteFX in conjunction with Write, it is sometime beneficial to put the
WriteFX object into a frame. First select the WriteFX object (i.e. click on it) then select
Insert and Frame from the menus. Using frames enables you to position the object any
where on the page.
423 WriteFX - a text effects tool
To delete a WriteFX object, click on it and press the Del key.
424 Macros
Macros
The macro capability in Ability is based on VBScript. To be a little more exact, Ability is
an ActiveX Scripting Host. Other examples of Scripting Hosts include Microsoft's Internet
Explorer, Internet Information Server and the Windows Scripting Host that ships with
Windows 98 and Windows 2000.
VBScript can be thought of as a lightweight version of Visual Basic for Applications.
Ability itself is programmable through an OLE automation interface.
What it all means
You don't really need to be familiar with all the above terminology. It's what you can do
with it that counts. The "macros" in Ability will allow you to control the Ability applications
for such tasks as adding standard text to documents and looking up a user's name and
address for a letter. In addition, because it is based on industry standards, you can easily
communicate with other software packages that use the same standards (which includes
nearly all new application software from Microsoft).
For example, you can create a macro that takes an email address out of a database and
uses Microsoft Outlook to send the email. The same is true in the opposite direction - you
can use an external environment to program Ability (for example, Windows Scripting
Host, Visual Basic, Delphi and any other application that supports OLE automation).
What you need
To run the Ability macros, you'll need to have the Microsoft script engine installed. This
will already be installed if you have Windows 98 (or later) or if you've installed Microsoft
Internet Explorer 4.0 (or later).
If you haven't got the script engine, or are not sure if you have it, or you want to get the
latest version, you can download it from the Microsoft web site:
http://www.microsoft.com/msdownload/vbscript/scripting.asp
Note the link is above is liable to change – if it is out of date as you read this, try
searching on the Microsoft web site for "vbscript" or try the scripting home page:
http://msdn.microsoft.com/scripting/
Getting started
To create and edit macros, use the Tools/Macro command from the menu.
425 Macros
Use the Macro dialog (Tools/Macro/Macros) to organize your macros and create new
ones and the Macro Editor (Tools/Macro/Macro Editor) to edit your existing macro. For an
introduction to this process see the Quick tutorial on page 432 for a Write macro.
To program Ability, you'll need to know two things:
1. The commands to drive Ability
See how to program each module: Write on page 426 , Database on page 439 and
Spreadsheet on page 435.
Use the Class Browser to examine the object model of Ability – to see this, select
Tools/Macro/Macro Editor and use the Class Browser button
.
See the Example macros on page 445 for real life, fully working macros.
2. The programming language (VBScript)
See the VBScript introduction on page 458 .
How the macros are created, stored and executed
To create a macro in Ability, use the Tools/Macro command. Macros can either be stored
in a particular file (i.e. a Write document, spreadsheet or database) or in a globally
accessible file. Global macros are available whenever you run that particular application
(Write, Spreadsheet, Database) and can be found, for back up purposes, in the following
locations:
c:\progam files\ability office\abwite.abd
c:\progam files\ability office\abspread.abd
c:\progam files\ability office\abdata.abd
The above assumes you installed Ability into the default location.
Some macros will be a series of steps requiring no user interaction - you just run it and it
does the job in the same way each time. With others, you will need to get feed back from
the operator. Ability allows sophisticated forms to be created that can deal with user
input. The forms are activated by macros and can themselves contain scripting
instructions to intelligently process the user selections.
Once the macro has been created, it can be run in one of five ways:
•
Directly from the menus using Tools/Macros
•
From the shortcut menu (set the "Quick Macro" attribute in the Tools/Macros dialog)
426 Macros
•
From a keyboard shortcut (set this under Tools/Customize)
•
From a button on the toolbar (also set using Tools/Customize)
•
Externally (as you start an application or from an external program)
Write macros
The most common need for macros in Write is to manipulate text - add text, change
fonts, copy text and so on. There are two main objects that can be used for dealing with
the text of a document:
•
The Text collection on page 426 - gives access to the entire text of a document
•
The Selection object on page 428 - gives access to text, fonts, paragraph attributes,
tab settings and styles of the current selection
For some tasks (inserting text, deleting text) you could use either the text or the selection
object. If you want to specify any font or paragraph settings, the Selection object must be
used. If you want to check the entire text of a document for a particular word then the
Text object is the one to use.
There are also objects and collections to allow you to manipulate (create, open, print)
documents - see Working with documents on page 430 .
Working with the text collection
The text collection contains the details of every character in a document. This includes
special characters such as the Enter key and the Tab key. The easiest way to picture the
text collection is as a single long, continuous stream of characters. You can reference,
insert, and delete characters anywhere in this text stream.
Counting the characters
Consider a new document. The operator types "Hello" on line 1 and then presses the
Enter key and types "?" on line 2 so the document looks like this:
Hello
?
How many characters does the document contain? Easy, just use the Count property of
the text box. For example:
MsgBox ActiveDocument.Text.Count
427 Macros
displays the answer 7 (that is, 5 for hello + 1 for the question mark + 1 for the Enter key).
Note that ActiveDocument is needed before the Text object can be referenced. It doesn't
need to be the current document - any document object will do.
Examining each character in a document
Any character in a document can be referenced directly. Consider a document that
contains nothing more than the following text on lines 1 and 2:
Hello
?
This code will access individual letters within the document:
MsgBox ActiveDocument.Text.Item(0)
MsgBox ActiveDocument.Text.Item(1)
MsgBox ActiveDocument.Text.Item(2)
' returns 72
' returns 101
' returns 108
What's going on?
The Text object is actually returning a number code. So "H" = 72, "e" = 101 and "l" = 108.
Anyone familiar with ASCII codes may recognize these numbers. Fortunately, you don't
need to remember what the codes translate to - there's a built-in function to VBScript
function, Chr(), that does this for you. For example:
MsgBox Chr(ActiveDocument.Text(0)) ' returns H
Note that the "Item" has been dropped - it's not necessary since Item is the default
property of the Text object.
So let's examine the entire document:
For i = 0 to ActiveDocument.Text.Count - 1
MsgBox "Character number: " & i & ", code: " & ActiveDocument.Text(i) & ", text: "
& Chr(ActiveDocument.Text(i))
Next
This will produce the output:
Character number: 0, code: 72, Text: H
Character number: 1, code: 101, Text: e
Character number: 2, code: 108, Text: l
Character number: 3, code: 108, Text: l
Character number: 4, code: 111, Text: o
Character number: 5, code: 13, Text:
Character number: 6, code: 63, Text: ?
Note there is no actual character to represent the Enter key (the output is blank).
A better way of coding the above is to make use of the With....End With VBScript
statement so you don't have to keep writing ActiveDocument.Text repeatedly.
428 Macros
With ActiveDocument.Text
For i = 0 to .Count - 1
x = .Item(i)
MsgBox "Character number: " & i & ", code: " & x & ", text: " & Chr(x)
Next
End With
Dealing with document chunks
If you know the start and end position of the text you want, you can simply get at it using
the Mid function, which has the general form:
Mid(start, length)
For example:
MsgBox ActiveDocument.Text.Mid(0, 10) ' returns the first 10 characters of the
document
i = ActiveDocument.Text.Count
MsgBox ActiveDocument.Text.Mid(0, i) ' returns all the characters of the document
MsgBox ActiveDocument.Text.Mid(10, 20) ' returns 20 characters starting at
position 10
Inserting Text
To insert text in a document, just specify a starting position. For example:
ActiveDocument.Text.Insert(0, "The start") ' puts the text at the beginning
i = ActiveDocument.Text.Count
ActiveDocument.Text.Insert(i, "The end") ' puts the text at the end of the
document
Deleting Text
To delete text from a document, specify a starting point and a length. For example:
ActiveDocument.Text.Delete(10, 3) ' deletes 3 characters, starting at position 10
i = ActiveDocument.Text.Count
ActiveDocument.Text.Delete(0, i) ' deletes the entire document contents
Working with the Selection object
The selection object refers to the currently selected text, that is the text that is
highlighted. If no selection is current, the selection object still functions and works with
the current cursor position.
The selection object is an application level object so can be used without any qualifiers
(like ActiveDocument).
Here are some of the more important properties and methods:
Properties
Document
Read only; the document to which the
429 Macros
selection object is associated.
End
Set or read the ending position of selection.
Start
Set or read the starting position of selection.
Font
Merged font of the selection, represented by
Font object
Paragraphs
Collection of paragraphs in the selection.
Methods
Collapse(Direction)
Turn selection back into a cursor. Possible
directions are abForw & abBack.
Copy()
Copies it to the Clipboard.
Cut()
Moves it to the Clipboard.
Delete()
Delete the selection.
InsertBefore(String)
Insert text before the selection and adds it to
the selection.
InsertAfter(String)
Insert text after the selection and adds it to the
selection.
The selection object makes it easy to insert text at the current cursor position. For
example:
Selection.InsertAfter("Inserted text")
After text has been inserted it will itself be selected. This makes it easy to adjust the font
properties. For example:
Selection.InsertAfter("Inserted text")
With Selection.Font
.Bold = True
.Italic = True
.Underline = True
.Size = 18
.Name = "Times New Roman"
End With
Selection.Collapse(abForw)
The last line returns back to a normal cursor.
If you want to work with a specific part of a document, use the Start and End properties.
For example, the following copies the first 10 characters of a document to the clipboard
and then tells the user how many characters he has copied:
Selection.Start = 0
Selection.End = 9
Selection.Copy()
MsgBox "You copied " & _
Selection.End - Selection.Start + 1 & _
" characters"
430 Macros
Or if you want to insert text at the end of a document, use the selection object in
conjunction with the text object:
Selection.End = ActiveDocument.Text.Count
Selection.InsertAfter "End of document"
Selection.Collapse(abForw)
Working with documents
Macros can be used open, close, create and print documents. Documents can be
manipulated on two levels:
Documents collection
With the documents collection you can open and create documents and refer to particular
documents by name or number.
For example:
Documents.Add("NORMAL")
The above line creates a new document based on the normal template and makes it the
current document. This is exactly the same as selecting the New button on the toolbar.
Set mydoc = Documents.Add("NORMAL")
This has the same effect but also save a reference to the new document in a variable
called mydoc. Mydoc is a Document object (see Document object on page 431 for
details) and you can use it, for example, to add text and print:
To open an existing document, use the Open method. As with the Add method, you can
choose to save a reference to the document or not (which would depend on the other
requirements of your macro):
Documents.Open("c:\my documents\myfile.aww")
or
Set mydoc = Documents.Open("c:\my documents\myfile.aww")
If you are opening several files in the same directory (or just want to change the current
directory) you can use the following:
ChangeFileOpenDirectory("c:\my special folder")
The documents collection contains useful information about open documents as the
following macro demonstrates:
MsgBox "There are " & Documents.Count & " documents, names to follow."
For each doc in Documents
MsgBox doc.GetTitle
Next
Individual documents can be referred to by name or number. Suppose you had opened
two documents, Write1.aww and Write2.aww, in that order then:
431 Macros
Documents(0).Activate
Documents("Write1.aww").Activate
are equivalent, as are:
Documents(1).Print
Documents("Write2.aww").Print
Document object
Here is a summary of the most important properties and methods of the document:
Properties
Selection
Paragraphs
Text
Styles
Frames
Fields
The Selection Object on page 428
The Paragraphs collection.
The Text collection on page 426
Styles collection.
Frames collection.
Fields collection.
Methods
Activate
GetTitle
Copy
Cut
Print star, end, copies,
collate
Paste()
Makes the document the current one.
Returns title of the document.
Copies selection to the Clipboard.
Moves selection to the Clipboard.
Prints the document.
Copies Clipboard to the current position of the
Document; Deletes selection if any.
The easiest way to "get hold of" a document is to use ActiveDocument to refer to the
current document. For example:
MsgBox ActiveDocument.GetTitle
would show the name of the current document. ActiveDocument can be used with any of
the above properties and methods.
432 Macros
You can also refer to the active document when creating or opening documents. See
Documents collection on page 430 for more details. For example, to create and print a
document:
Set mydoc = Documents.Add("NORMAL")
mydoc.Text.Insert 0, "hello from a macro"
mydoc.Print 1, 9999, 1, False
A Write macro tutorial
This tutorial will show how to build a macro for a standard way of closing a letter (the
"yours sincerely" bit).
1. In Write, create a new macro: select Tools/Macro/Macros
2. Type in "LetterClosing" in the "Macro Name:" box.
3. Click on the Create button.
You are now presented with the following:
Sub LetterClosing()
' Put macro code here
End Sub
Sub is short for subroutine and the name you entered follows it. This is the standard way
of declaring a macro. The very last line of your subroutine is "End Sub". An error is
generated if this is missing.
The line in-between begins with an apostrophe. You can put as much descriptive text into
the macro as you want - just begin the line with an apostrophe. For now, you can delete
the "Put macro code here"
Let's start with the simple problem of inserting some text, somewhere.
The macro command for inserting text is simply "Insert". But this is not enough on its
own. You need to know that "Insert" belongs to something called "Text", which is the
entire text of your document. How about "which document" - you could have several
documents open so you need to specify which one. You could do this by name, but this
would make the macro rather too specific. What you really want is to have it work with the
currently active document. The way to refer to this is "ActiveDocument". So a command
to insert text is as follows:
ActiveDocument.Text.Insert
What we've been describing is part of the "object model" for Ability.
To finish off, you need to specify what to insert and where to insert it, in the format:
ActiveDocument.Text.Insert position, text
433 Macros
where position is the number of characters from the beginning of the document and text
is the actual text to insert. So:
ActiveDocument.Text.Insert 0, "Hello from Ability"
would insert "Hello from Ability" at the start of your document (the reference to position is
zero based) and your complete macro will now look like this:
Sub LetterClosing
ActiveDocument.Text.Insert 0, "Hello from Ability"
End Sub
Lets run the macro to see what happens:
1. Select a Write document (use the Windows menu).
2. Select Tools/Macro/Macros.
3. You'll see "LetterClosing " as a named macro - click on it to select it.
4. Click on the "Quick macro" checkbox so a tick appears (we'll see why in a minute).
5. Click the Run button to execute the macro.
The text should appear at the start of your document. In step 4. above, we asked Ability
to remember the macro as a "Quick macro" - this means it will appear on the shortcut
menu as follows:
1. Put the mouse pointer over the document and right-click.
2. Select Macros.
3. You'll see the LetterClosing macro available - select it.
The text will be inserted again at the beginning of the document.
Refining the macro to make it more useful
The text we want to insert should be at the end of the document rather than the
beginning. So we need a way of working out where the end of the document is. One way
is to ask Ability for the total number of characters in a document as follows:
ActiveDocument.Text.Count
So the following macro would always insert the text at the end of the document:
Sub LetterClosing
pos = ActiveDocument.Text.Count
ActiveDocument.Text.Insert pos, "Hello from Ability"
End Sub
434 Macros
Notice that we assigned a variable to count the number of characters in the document.
Strictly speaking, it is not really necessary and we could have written it as a single line
instead:
ActiveDocument.Text.Insert ActiveDocument.Text.Count, "Hello from Ability"
But the first way is easier to read (which is a good rule of thumb to apply when creating
macros).
Supposing you had lots more similar commands you wanted to issue. Do you have to
keep writing "ActiveDocument.Text" all the time? The answer is No. You can ask Ability
to perform a series of tasks using the same "thing" (or you can call it object if you want).
For example, the following macro gives identical results to the previous one:
Sub LetterClosing
With ActiveDocument.Text
pos = .Count
.Insert pos, "Hello from Ability"
End With
End Sub
There are some important points here. When using the With statement, the . (dot or
period) must precede any items that refer back to the object being referred to. So it
reads: "pos equals dot count" and "dot insert equals....". Also note that it is good practice
to indent macro commands within "block" statements. This makes it easier to read.
Now let’s make the macro put some real text in.
Sub LetterClosing
With ActiveDocument.Text
pos = .Count
.Insert pos, vbCr & "Yours sincerely" & vbCr & vbCr & vbCr & vbCr & "Philip Roach"
& vbCr & "Technical Manager"
End With
End Sub
What's happening! Imaging you were typing the text in real life - after the "Yours
sincerely", you'd press the Enter key. You'd probably press it once (or twice) before you
started "Yours sincerely" as well. This is what the vbCR does. It's short for "visual basic
carriage return" and is a constant built-in to the VBScript language.
Also, the above example shows how to combine text strings using the "&" operator.
Having long strings of text combined in a single line as in the above example is not good
practice (it's hard to read later). Here is a neater way of laying it out:
Sub LetterClosing
With ActiveDocument.Text
pos = .Count
.Insert pos, vbCr & "Yours sincerely" & String(4, vbCr) & _
"Philip Roach" & vbCr & _
"Technical Manager"
435 Macros
End With
End Sub
Instead of repeatedly chaining vbCr's together, we can use a built-in function (built-in to
the VBScript language that is) called "String" that takes a character and repeats it any
number of times. Also notice that the long line is split into 3 with an underscore used as a
"continuation" character at the end of lines 1 and 2.
Spreadsheet macros
Most of the macros you will be writing for Spreadsheet will involve fetching and setting
the values, formulas and formats for cells within a spreadsheet. You'll also need to know
how to open and create workbooks and deal with worksheets.
Working with cells
When working with cells in a worksheet, you'll usually need to work with a known specific
cell (e.g. A1) or work with a cell relative to the current cell (e.g. the cell to the right of the
current cell). Well begin with the current cell itself (a special case of the second type).
Using the active cell
The active cell is just the current cell - wherever you move to, or click on, in the
worksheet. The way to address the active cell is, not surprisingly:
ActiveCell
A cell has lots of properties - a font, value, a formula, background color and so on. Here
are some of the more important properties:
ActiveCell.Value - The simple text or number or date of a cell (as it is displayed in the
sheet). If the cell contains a formula, then Values displays the results of the formula. For
example:
If ActiveCell.Value = "0" Then
ActiveCell.Value = "Zero"
Else
MsgBox "Cell has value: " & ActiveCell.Value
End If
This converts a current cell containing "0" to "zero" and displays the value of current cell
if it does not contain zero.
In a similar way, the current cells formula can be determined or set using:
ActiveCell.Formula
The Formula property returns either the formula (for example "=a1 + a2") or, if the cell
does not contain a formula, the value.
Here are some more properties:
436 Macros
ActiveCell.NumberFormat
ActiveCell.Font
(for example)
ActiveCell.Font.Bold
ActiveCell.Font.Italic
ActiveCell.Font.Name
ActiveCell.Font.Size
Cut, copy and paste etc
As well as setting the properties of the cell, there are methods to perform cut, copy and
paste, just like the Edit menu:
ActiveCell.Clear ()
ActiveCell.ClearContents ()
ActiveCell.ClearFormats ()
ActiveCell.Copy ()
ActiveCell.Cut ()
ActiveCell.Paste ()
Note that you need to include the brackets to execute these methods.
Working with a specific cell
To refer to a specific cell within the spreadsheet, use the Range object as follows:
Range("a1")
This is equivalent to the ActiveCell in terms of it's properties and methods, so all of the
following are valid:
Range("a1").Value
Range("a1").Formula
Range("a1").Cut()
Working with cells relative to the active cell
Suppose you wanted to take the contents of the current cell, do something with it and
then put the result in the cell to the right of the current cell. The target cell's address is
neither set in advance nor the active cell. So how do you refer to it? The answer is that
you use a Cells property that treats the active cell as 1, 1 and refer to other cells by it's
relative co-ordinates.
This is best seen by example. Suppose the current cell was C3, then:
ActiveCell.Cells(1, 1)
ActiveCell.Cells(1, 3)
ActiveCell.Cells(3, 1)
ActiveCell.Cells(0, 0)
ActiveCell.Cells(-1, 0)
refers to C3 (i.e. itself)
refers to E3
refers to C5
refers to B2
refers to B1
437 Macros
Here's an example routine that takes the current cell and adds 1 to it and puts the result
in the cell immediately to the right:
ActiveCell.Cells(1, 2).Value = ActiveCell.Value + 1
Of course, this code assumes that the active cell contains a number and if contains text
instead, a run time error will be generated. Later we'll see a general technique for dealing
with such errors.
Because the ActiveCell.Cells(row, col) notation returns an equivalent object to ActiveCell,
all the same properties and methods can be applied. These are all valid:
ActiveCell.Cells(2,
ActiveCell.Cells(2,
ActiveCell.Cells(2,
ActiveCell.Cells(2,
2).Cut()
2).Formula = "=a1 + a2"
2).Font.Bold = True
3).Paste()
Ranges
Quite simply, a range is one or more cells. In fact there's no such thing as a "cell" object
and all the previous examples for dealing with a single cell are really manipulating the
properties and methods of a "range" object. The only difference in your treatment of a cell
and a range is that you can read and write a cell value and formula but you can only write
values and formulas with a range.
Specifying a range
Here are the most important ways of identifying ranges (there are other ways!)
Selection
The current selection (highlighted area)
Range("a1..a10")
A specific range, defined by cell references
Range("myrange")
A specific range, defined a named range
ActiveCell.Range("a1..a10")
The first 10 cells below and including the active cell. In this
case, the "a1..a10" reference is relative to the current cell.
Cells
The entire worksheet
Since all the above return a range, they all support the same methods and properties. For
example:
Sub TestRange
Selection.Font.Bold = True
Range("a1..a10").Font.Underline = True
Cells.Font.Size = 10 ' the whole sheet!
Range("b1..b10").Value = "test"
Range("c1..c10").Formula = "=a1 * 10"
End Sub
438 Macros
Note the last line of the example specifies a formula. This does not increment cell
references down the column (e.g. cell c2 will contain "=a1 * 10" just like cell c1). If you
want to increment the references, do the following:
Range("c1").Formula = "=a1 * 10"
Range("c1").Copy()
Range("c2..c10").Paste()
This results in cell c2 containing "=a2 * 10".
Working with a range to the left and/or above the active cell
This has to be done in two stages, first to change the active cell and then second specify
the range relative to the new active cell. For example:
ActiveCell.Cells(-1, -1).Activate()
ActiveCell.Range("a1..a5").Select()
This is necessary because there is no way to specify a range like Range("-a1, -a10").
Working with individual cells in a range
Once you've got hold of a range, you might want to do something with each cell
individually. For example, to check the contents of each cell.
There are two notations, a (row, col) coordinate or the nth item in the range. The row, col
notation is convenient if you are working with a set range. For example:
MsgBox
MsgBox
Range("a1..b5")(1, 1).Value
Range("a1..b5")(2, 2).Value
'displays contents of cell a1
'displays contents of cell b2.
The alternative notation takes a range from left to right, top to bottom and numbers it from
1 to n. So the exact equivalent of the above is:
MsgBox
MsgBox
Range("a1..b5")(1).Value
Range("a1..b5")(2).Value
'displays contents of cell a1
'displays contents of cell b2.
But really this notation is more useful when you don't know in advance the extent of a
range (for example, dealing with a selection). You can be sure to see every item in a
range using the following:
For i = 1 to Selection.Count
MsgBox Selection(i).Value
Next
A brief note on the Item property of a range
To give you a fuller picture, the previous methods of working with cells within a range use
a shorthand notation. All ranges have an "Item" property that allows you to reference an
individual cell. Since "Item" is the default property, it is not necessary to actually write it
out. For example, the following are identical:
Range("a1..b5")(1, 1).Value
439 Macros
Range("a1..b5").Item(1, 1).Value
and if you happened to start a selection on a1 then these are identical with each other as
well as the above:
Selection(i).Value
Selection.Item(i).Value
Working with worksheets and workbooks
The spreadsheet application can have none, one or many workbooks open at one time
and each workbook can have one or more worksheets. All of these are part of a
straightforward hierarchy:
Workbooks ' all the workbooks in an application
Workbooks.Count ' how many workbooks do we have open
Workbooks(0) ' the first open workbook
Workbooks("myspread") ' the workbook called myspread
Once you've got hold of a workbook, you can examine it's name, count it's worksheets
and refer to individual worksheets:
Dim wb, ws
Set wb = Workbooks(0)
MsgBox "Name is " & wb.Name & ", and has " & wb.Worksheets.Count &
"worksheets."
Set ws = wb.Worksheets(0) ' or alternatively Set ws = wb.Worksheets("mysheet")
Msg "First worksheet is called: " & ws.Name
There can be only one active (or current) workbook however. Also, there can be only one
active sheet and one active cell.
ActiveCell
Returns the current cell in the current worksheet in the current
workbook.
ActiveSheet
Current worksheet.
ActiveWorkbook
Current workbook.
Database macros
Database macros can be stored in one of two ways in: global or local. The following table
explains the differences:
Stored
in
Global macros
Database specific macros
Global database macro file
(abdata.abd). The file is in the
program directory ("c:\program
files\ability office\" by default)
The database it was created in.
440 Macros
Create
using
Tools/Macros menu.
File/New/Macro from menu (a
database must be open).
Run by
Tools/Macros menu – can also be
run from a button on the toolbar or
by keyboard shortcut.
Double-click directly from Database
Manager.
Notes
Identical operation to global macros
in Spreadsheet and Write.
Can contain one or more subroutines
or functions – the first one in the file
will be the default (i.e. double-click will
run the top most macro).
Database shares the same database engine as Microsoft Access and some users may
already be familiar with automation using DAO. Ability allows access to two of the
fundamental DAO objects. See Using DAO automation on page 442 for more details.
Working with Databases
Naturally enough, there is a collection called Databases that opens and creates
databases and a Database object that contains the tables of information you'll want to
work with. The following summarizes the most important properties and methods:
Databases collection
Open(path to file, Exclusive)
Open an existing database.
Create(path to file)
Create a new database.
Database object
Close
Close the database.
Admin
Access to DAO Database property
Tables
The collection of tables belonging to the database
Forms
The collection of forms belonging to the database
Reports
The collection of reports belonging to the database
Queries
The collection of queries belonging to the database.
Since the database can only use one database at a time, you can use the Databases
collection to create and open a database and then use ActiveDatabase, which is itself
just a database object, to do the rest.
For example to open and use a table from a database:
Databases.Open("c:\my documents\mydata.adb", False)
ActiveDatabase.Tables.Open("mytable")
Note the second parameter of the open command is False, which means open the
database in shared mode. True would be exclusive (i.e. lock every other user out for that
session).
441 Macros
Working with tables
To open a table in the current database, use the following command:
Set mytb = ActiveDatabase.Open("mytable")
The variable mytb now allows access to the table object. Here are the most important
methods and properties of the table object:
Activate
Make the table the current one (bring it to the front).
Fields
The collection of fields – field information and data.
MoveFirst
Go to the first record.
MoveNext
Go to the next record.
MovePrev
Go to the previous record.
MoveLast
Go to the last record.
Close
Close the table.
EditRecord
Allow changes to be written back to the current
record. Puts the table into an "Edit" state.
AddNewRecord
Allow changes to be saves as a new record. Puts
the table into an "Append" state.
UpdateRecord
Write any pending to changes to the table and turn
off Edit or Append state.
Here's how to move open and move around the table:
Set mytb = ActiveDatabase.Open("mytable")
mytb.MoveFirst
MsgBox "First Record"
mytb.MoveNext
MsgBox "Second Record"
.....and so on.
Instead of supplying a specific name for the table, it's sometimes useful to work with the
current table (which could be any table). Here's some code that does the same as above:
Set mytb = ActiveDataObject
mytb.MoveFirst
etc.
Working with fields
The Fields collection contains the all the fields for a table. An individual field has the
following properties:
Value
Contents of the field.
Name
Name of the field.
442 Macros
For example, for quick look at the contents of record 1 in a table:
Set mytb = ActiveDatabase.Open("mytable")
mytb.MoveFirst
s = ""
For Each fld In mytb.Fields
s = s & fld.Name & ": " & fld.Value & vbCr
Next
MsgBox "The first record looks like this: " & vbCr & vbCr & s
To update a record, you should really know a little about the type of fields you are using.
For example, updating two fields, one called email and the other tel:
With mytb
.EditRecord
.Fields("email").Value = "[email protected]"
.Fields("tel").Value = "01234 5678"
.UpdateRecord
End With
Note that you always have to set the table into an "edit" state with the EditRecord
command and complete the edit with UpdateRecord.
Adding a new record would be very similar:
With mytb
.AddNewRecord
.Fields("email").Value = "[email protected]"
.Fields("tel").Value = "01234 5678"
.UpdateRecord
End With
Using DAO automation
Database provides direct access to two important DAO objects:
•
DAO Database object on page 443
•
DAO DBEngine object on page 442
These are made available for experienced users. Full documentation on how to use them
is beyond the scope of this help guide.
DAO.DBEngine
DBEngine is the top level object in the DAO object model – all DAO objects and
collections are available through DBEngine. For example, from outside Ability Database
(e.g. in Spreadsheet or Write):
Set dbapp = CreateObject("AbilityDatabase.Application")
MsgBox dbapp.DBEngine.Version
443 Macros
Inside an Ability Database macro, DBEngine is accessible directly:
MsgBox DBEngine.Version
The Version property simply shows the version of DAO in use.
Another example of using DBEngine is to compact a database. Although this is available
from the Tools menu, one of the options in compacting a database is to set a version
number.
DBEngine.CompactDatabase "c:\my documents\mydata2.adb", _
"c:\my documents\mydata3.adb", _
32
The code above creates the file mydata3.adb from mydata2.adb and at the same time,
compacts the file and converts the version number from 2 to 3. It is the last parameter (32
is equal to the DAO constant dbVersion30) that tells DAO to convert the version number.
Note that Ability creates JET databases using version 2. When creating databases in
Microsoft Access 97, the JET version is 3. As far as Ability is concerned, there is no
difficulty using either version whereas Microsoft Access will always want to "update" the
version if opening version 2.
DAO Database
The DAO Database object is accessible through the Admin property of an Ability
Database. For example:
Set dbapp = CreateObject("AbilityDatabase.Application")
dbapp.Databases.Open("c:\my documents\mydata.adb", False)
Set db = ActiveDatabase
Set dbdao = db.Admin
Note that the first two lines would not be necessary if you were creating a macro inside
Ability Database and already had a database open.
The above code creates a variable dbdao which is equivalent to the standard Database
object in the DAO object model.
Automating Ability from other programs
Any program that supports OLE automation can run the Ability application "from outside".
For example, you may have a custom database application and want to press a button
that launches Write with a letter and insert the address block from the details in the
current record.
The exact syntax to use depends on your development environment. For an application
that supports VBScript (for example, all the Ability applications and WSCRIPT.EXE and
CSCRIPT.EXE that ship with Windows 98) you can use the following commands to start
an Ability application:
444 Macros
Set app = CreateObject("AbilityDatabase.Application")
Set app = CreateObject("AbilitySpreadsheet.Application")
Set app = CreateObject("AbilityWrite.Application")
Note: the Set statement is part of the VBScript language and allows you to create a
reference to an object. In the above case, CreateObject creates an instance of the
named application and the Set statement makes the variable app point to the application
object. If you used this syntax instead:
app = CreateObject("AbilityDatabase.Application")
the implication would be that you are trying to make a copy of an application (i.e. your
computer memory would be holding two separate running applications) and this is not
allowed.
Now the application has been started, you'll need to something useful, like create a new
document or open a database.
Automating Write
As an example, let's assume Write needs to be started from another application (e.g.
Spreadsheet – but it could be any application that supports OLE automation) and a you
want to create and print some text. Here's the code:
Set app = CreateObject("AbilityWrite.Application")
app.Activate
Set mydoc = app.Documents.Add("NORMAL")
myDoc.Text.Insert 0, "This is a simple document"
myDoc.Print 0, 99, 1, False
The second line "app.Activate" causes the application to become visible to the user
(otherwise the application would run in the background and not be visible). Next, a new
document is created, based on the normal template, and a reference to the document is
saved in a variable mydoc.
The rest of the macro adds text to a document and prints it.
Note: The Print function takes four parameters: start page, end page, number of copies
and "collate" (or not).
Automating Spreadsheet
As an example, let's assume Spreadsheet needs to be started from another application
(e.g. Write – but it could be any application that supports OLE automation) and a you
want to create a new worksheet. Here's the code:
Set app = CreateObject("AbilitySpreadsheet.Application")
app.Visible
Set mywb = app.Workbooks.Add
Set myws = mywb.Worksheets(0)
myws.Cells(1, 1).Value = "A big hello to Spreadsheet"
445 Macros
The second line "app.Visible" causes the application to become visible to the user
(otherwise the application would run in the background and not be visible). Next a new
workbook is created and a reference to the first worksheet in it is saved as myws. Finally,
some text is written into the cell A1.
Automating Database
As an example, consider opening a table within a database. The following code would
work in a macro inside Write or Spreadsheet (or any application supporting OLE).
Set app = CreateObject("AbilityDatabase.Application")
app.Visible = True
app.Databases.Open "c:\my documents\mydata.mdb", False
Set mydb = app.ActiveDatabase
Set mytb = mydb.Tables.Open("PhilData")
MsgBox mytb.Fields(0).Value
The second line "app.Visible" causes the application to become visible to the user
(otherwise the application would run in the background and not be visible). The next three
lines open a named database and creates a reference to a specified table in mytb. The
last line displays the data from the first field in record 1.
Macros – examples
Write macros
Printing multiple copies on page 445
Printing the selection on page 446
Inserting a database address into Write on page 446
Sending email from Write on page 452
Database macros
Making a letter from the current record on page 454
Miscellaneous macros
Opening a web page inside Ability on page 457
Getting information on the script engine on page 458
Printing multiple copies
Not all printer drivers have the capability to print multiple copies. Here is a very simple
Write macro that provides a work around for such printers.
446 Macros
Sub MultipleCopies
Dim ncopies, startpage, endpage, collate
startpage = 1
endpage = 9999
collate = False
ncopies = InputBox("Number of copies required?", "Print current document", 2)
If ncopies = "" Then
Exit Sub
End If
ActiveDocument.Print startpage, endpage, ncopies, collate
End Sub
You can specify whatever you want for startpage, endpage and collate (or even prompt
the user). Setting endpage = 9999 will print every page for most documents.
Printing the selection
The following macro prints out the current selection (this is not supported in the Write
print dialog – sometimes macros can be used as work-arounds for non-existent product
features!)
Sub PrintSelection
Set currdoc = ActiveDocument
Selection.Copy()
Set tempdoc = Documents.Add("NORMAL")
tempdoc.Paste()
tempdoc.Print 1, 9999, 1, False
currdoc.Activate
End Sub
The macro first sets a reference to the current document (so it can re-display it at the
end). Next, it copies the current selection to the clipboard.
The third line of the macro creates a new document, based on the normal template. This
will be used as a temporary store for the selected text, which is pasted and printed.
Lastly, the macro returns to the original document using the Activate command.
Inserting a database address into Write
This example assumes you are writing a letter and you want to insert an address held in
a database. Although you could use mail merge to perform this task, it can be convenient
at times to do this with a macro.
Each section of the macro will be broken down and explained. The full source listing can
be found here on page 450.
1. Start the macro, declare and initialize some variables
447 Macros
Sub InsertDBAddress
Dim app, mydb, mytb, srchtxt, dbpath, tbname, srchfld, qrytxt
dbpath = "c:\my documents\mydata.adb"
tbname = "mytable"
srchfld = "Lastname"
All the variables used in the macro are declared locally – this is good practice as it safes
any possible confusion over whether a variable is local or global.
Insert your own details for database name (including path), the table name and the field
you want to search on. In this case, we're allowing records to be found by lastname – not
always practical with large tables.
2. Open the database
Set app = CreateObject("AbilityDatabase.Application")
app.Databases.Open dbpath, False
Set mydb = app.ActiveDatabase
Creates the database application object, opens a database and sets a reference, mydb,
to it.
3. Get the input from the user
srchtxt = InputBox("Enter " & srchfld & ":", "Ability Message")
If Len(srchtxt) = 0 Then
Exit Sub
End If
This prompts the user to enter some data to search for. As a refinement, if the user
enters nothing (or selects the "Cancel" button) then the macro will terminate with the "Exit
Sub" statement.
4. Open a query
qrytxt = "SELECT * FROM " & tbname & " WHERE " & srchfld & "='" & srchtxt & "'"
Set mytb = mydb.Admin.OpenRecordset(qrytxt)
The first line creates a query, based on the whatever the user entered. For example if the
table was called "contacts" and your were searching on a company name field for "Ability
Software" the variable qrytxt would contain:
SELECT * FROM contacts WHERE company ='Ability Software'
Which is slightly more readable. Note the use of single apostrophes surrounding Ability
Software – these are in the code but only just visible since they are next to double
quotes. Without these single apostrophes, the macro would fail!
The second line uses a property of the database object called Admin – for users familiar
with DAO, Admin is exactly equivalent to a DBEngine.Database object. The end result is
that we've opened a query that contains only the record(s) matching the search text.
448 Macros
5. See if there are any records found
If mytb.BOF Then
MsgBox "No matching records"
Exit Sub
End If
BOF stands for beginning of file (EOF being end of file). When the query was opened, if it
contains no records, BOF will be true, and if so, a message is displayed and the macro
terminates with "Exit Sub"
If there are records BOF will be false, and we will be positioned on record 1.
6. One or more records?
mytb.MoveNext
If mytb.EOF Then
mytb.MoveFirst
Selection.InsertAfter BuildAddBlock(mytb.Fields)
Selection.Collapse(1)
End If
Assuming we're on record 1, a call to move to the next record will cause EOF to be true
only if there is only one record. That is, the user entered some search text and there is
only one matching record, and we've found it. No ambiguity, so we can paste the data
into the Write.
Inside the If Then statement, the first thing to do is head back to record 1. Next, the
Selection.InsertAfter command pastes the text into the current Write document, where
the text is generated by the BuildAddBlock function (described below).
Selection.Collapse(1) turns of selected text.
7. More than one record, so browse
Logic tells us that if there is at least one record (part 5 above) and not exactly 1 record
(part 6. above) then there must be two or more matching records. This could easily
happen searching for the lastname of Smith for example. In this case, we can browse
through the records until the user picks one.
mytb.MoveFirst
Do
ret = MsgBox("More than one record - Select this record " & _
"With the Yes button or choose No For Next " & _
"record" & vbCr & vbCr & BuildAddBlock(mytb.Fields), _
vbYesNoCancel, _
"Ability Message")
If ret = vbCancel Then
Exit Sub
ElseIf ret = vbYes Then
Exit Do
End If
449 Macros
mytb.MoveNext
If mytb.EOF Then
ret = MsgBox("End of records!" & vbCr & vbCr & _
"Review records again?", vbYesNo, _
"Ability Message")
If ret = vbNo Then
Exit Sub
End If
mytb.MoveFirst
End If
Loop
Selection.InsertAfter BuildAddBlock(mytb.Fields)
Selection.Collapse(1)
End Sub
The basic idea repeat for ever (Do....Loop) until the user chooses to select a record,
browse to the next record or start the browse over again if he reaches the end. The
command Exit Do jumps out of the loop at the users bidding.
The macro is finished of by inserting the text as described in part 6. above.
A quick note on the use of MsgBox. MsgBox is a built in function that takes one or more
parameters. In the examples above, MsgBox is called with three parameters:
Prompt
Buttons
Title
Prompt is the text displayed inside the dialog. Title is the text displayed on the title bar of
the dialog. Buttons controls what buttons to display on the dialog. vbYesNoCancel builds
the dialog with three buttons: Yes, No and Cancel. Which button the user selects can be
tested for by assigning the return value of MsgBox to a variable (called ret above). So ret
= vbYes is true if the user selected the Yes button and so on.
8. BuildAddBlock and AddLine functions
There are several calls to this function from the main code above. The idea is to take
named fields and construct a single string that is suitable for an address block (i.e. no
gaps).
Function BuildAddBlock(Flds)
Dim s
s = Flds("CustTitle") & " " & Flds("FirstName") & " " & Flds("Lastname") & vbCr
s = s & AddLine(Flds("Company"))
s = s & AddLine(Flds("Add1"))
s = s & AddLine(Flds("Add2"))
s = s & AddLine(Flds("Add3"))
s = s & AddLine(Flds("Add4"))
s = s & AddLine(Flds("Postcode"))
BuildAddBlock = s
450 Macros
End Function
The function is declared with a single parameter. In the calling code the following line is
used to invoke the function:
BuildAddBlock(mytb.Fields)
The result of this is that mytb.Fields (i.e. the fields for the current record) is mapped into a
variable called Flds in the function definition.
A variable s is built-up by calling the function AddLine which checks to make sure the line
is not blank.
Function AddLine(x)
AddLine = ""
If Len(x) > 0 Then
AddLine = x & vbCr
End If
End Function
Inserting a database address - code listing
This is a complete listing of the code referred to in the previous example.
If you want to make use of this macro, copy and paste into the macro editor and then
replace the dbpath, tbname and srchfld text on lines 4 to 6 with your own data. Also
adjust the function BuildAddBlock to match your own field names.
Sub InsertDBAddress
Dim app, mydb, mytb, srchtxt, dbpath, tbname, srchfld, qrytxt
dbpath = "c:\my documents\mydata.adb"
tbname = "mytable"
srchfld = "Lastname"
Set app = CreateObject("AbilityDatabase.Application")
app.Databases.Open dbpath, False
Set mydb = app.ActiveDatabase
srchtxt = InputBox("Enter " & srchfld & ":", "Ability Message")
If Len(srchtxt) = 0 Then
Exit Sub
End If
qrytxt = "SELECT * FROM " & tbname & " WHERE " & srchfld & "='" & srchtxt & "'"
Set mytb = mydb.Admin.OpenRecordset(qrytxt)
If mytb.BOF Then
MsgBox "No matching records"
Exit Sub
End If
mytb.MoveNext
If mytb.EOF Then
mytb.MoveFirst
451 Macros
Selection.InsertAfter BuildAddBlock(mytb.Fields)
Selection.Collapse(1)
End If
mytb.MoveFirst
Do
ret = MsgBox("More than one record - Select this record " & _
"With the Yes button or choose No For Next " & _
"record" & vbCr & vbCr & BuildAddBlock(mytb.Fields), _
vbYesNoCancel, _
"Ability Message")
If ret = vbCancel Then
Exit Sub
ElseIf ret = vbYes Then
Exit Do
End If
mytb.MoveNext
If mytb.EOF Then
ret = MsgBox("End of records!" & vbCr & vbCr & _
"Review records again?", vbYesNo, _
"Ability Message")
If ret = vbNo Then
Exit Sub
End If
mytb.MoveFirst
End If
Loop
Selection.InsertAfter BuildAddBlock(mytb.Fields)
Selection.Collapse(1)
End Sub
Function BuildAddBlock(Flds)
Dim s
s = Flds("CustTitle") & " " & Flds("FirstName") & " " & Flds("Lastname") & vbCr
s = s & AddLine(Flds("Company"))
s = s & AddLine(Flds("Add1"))
s = s & AddLine(Flds("Add2"))
s = s & AddLine(Flds("Add3"))
s = s & AddLine(Flds("Add4"))
s = s & AddLine(Flds("Postcode"))
BuildAddBlock = s
End Function
Function AddLine(x)
AddLine = ""
If Len(x) > 0 Then
AddLine = x & vbCr
End If
End Function
452 Macros
Sending email from Write
The following example relies on Active Messaging - an OLE wrapper for MAPI. You may
or may not have this installed on your system!
1. Start the macro and declare the variables
Sub SendEmail
Dim objSession, objMessage, objRecip, strEmsg, strTo, strSubject
2. Get the entire text of the document
strEmsg = ActiveDocument.Text.Mid(0, ActiveDocument.Text.Count)
This is the quickest way to get the text of the document – no consideration is given to font
changes!
3. Set the fields for Send To and Subject
strTo = "[email protected]"
strSubject = "Send from Ability Write"
These details are in the code at the moment – it would be much better to extract them
from the actual document. See the suggestions at the bottom or this page for more on
how to do this.
4. Start a MAPI session
Set objSession = CreateObject("MAPI.SESSION")
objSession.Logon "MS Exchange Settings"
Start a session and logon. This is a bit like starting Microsoft Outlook. Note the logon is
dependent on the current profiles on the user machine – in other words, you may have to
change "MS Exchange Settings" to whatever your logon details are.
5. Create a message
Set objMessage = objSession.Outbox.Messages.Add
objMessage.Subject = strSubject
objMessage.Text = strEmsg
Set objRecip = objMessage.Recipients.Add
objRecip.Name = strTo
objRecip.Type = 1 '
objRecip.Resolve
The first block above creates a new message and copies in the text from the document.
The second block adds the recipient details. Note the Type is set to 1 – this is the value
of mapiTo constant (defined as part of OLE Messaging).
6. Send the message
objMessage.Update
453 Macros
objMessage.Send
objSession.Logoff
End Sub
Save the message, send it and logoff.
Refining the send email macro
As a refinement to the send email macro on page 452 we can extract the "To" and
"Subject" fields from the text of a document using the following function:
Function GetEmailHeader(msg, str)
Dim spos, fpos, abText, slen
slen = Len(str)
' Find for example, To: somewhere in the document text
spos = InStr(1, msg, str, 1)
If spos Then
' If found, find the end of the line
fpos = InStr(spos, msg, vbCr) - 1
' Set the function to return the desired text
GetEmailHeader = Trim(Mid(msg, spos + slen, fpos - spos - slen + 1))
' Delete the line from the email and tidy-up excess linefeeds
msg = Left(msg, spos - 1) & Mid(msg, fpos+2)
While Left(msg, 1) = vbCr
msg = Mid(msg, 2)
Wend
Else
' Not found, so prompt user for the text
GetEmailHeader = InputBox("Please enter text for the " & _
str & " part of the email header")
End If
End Function
The function is called by replacing the lines:
strTo = "[email protected]"
strSubject = "Send from Ability Write"
in the SendEmail subroutine with the following
strTo = GetEmailHeader(abTxt, "To:")
' Check to see if the user Cancelled the function..
If Len(strTo) = 0 Then Exit Sub
strSubject = GetEmailHeader(abTxt, "Subject:")
See the complete code listing on page 453 .
Sending email from Write - code listing
This is complete code listing for the previous example. You can open the
Tools/Macros/Macro Editor screen and paste the entire listing below into your macros file.
Sub SendEmail
454 Macros
Dim objSession, objMessage, objRecip, strEmsg, strTo, strSubject
strEmsg = ActiveDocument.Text.Mid(0, ActiveDocument.Text.Count)
strTo = GetEmailHeader(abTxt, "To:")
If Len(strTo) = 0 Then Exit Sub
strSubject = GetEmailHeader(abTxt, "Subject:")
Set objSession = CreateObject("MAPI.SESSION")
objSession.Logon "MS Exchange Settings"
Set objMessage = objSession.Outbox.Messages.Add
objMessage.Subject = strSubject
objMessage.Text = strEmsg
Set objRecip = objMessage.Recipients.Add
objRecip.Name = strTo
objRecip.Type = 1
objRecip.Resolve
objMessage.Update
objMessage.Send
objSession.Logoff
End Sub
Function GetEmailHeader(msg, str)
Dim spos, fpos, abText, slen
slen = Len(str)
spos = InStr(1, msg, str, 1)
If spos Then
fpos = InStr(spos, msg, vbCr) - 1
GetEmailHeader = Trim(Mid(msg, spos + slen, fpos - spos - slen + 1))
msg = Left(msg, spos - 1) & Mid(msg, fpos+2)
While Left(msg, 1) = vbCr
msg = Mid(msg, 2)
Wend
Else
GetEmailHeader = InputBox("Please enter text for the " & _
str & " part of the email header")
End If
End Function
Making a letter from the current record
This macro shows how to take the data from the current record in a Database and
generate a letter in Write. The macro is broken into manageable junks in the description
below. To see the macro in full, with tips on how to use it with your own data, see Create
letter from database - code listing on page 456.
1. Initialize the macro
Sub MakeLetterFromDB
Dim myflds(9), lfld, s, tb, appWrite, mydoc, i
lastfld = 8
myflds(0) = "CustTitle"
myflds(1) = "Firstname"
myflds(2) = "Lastname"
myflds(3) = "Company"
455 Macros
myflds(4)
myflds(5)
myflds(6)
myflds(7)
myflds(8)
=
=
=
=
=
"Add1"
"Add2"
"Add3"
"Add4"
"Pcode"
The first line declares in advance all the variables that are going to used (good practice).
Note the declaration of an array myflds with 9 elements, that holds the names of the
fields to be used for the address block – obviously, this will need adjustment for your own
database.
The variable lastfld is just a reminder that any loops addressing the myflds array will need
to stop at 8 (arrays are zero based).
2. Get "hold off" the current table
Set tb = ActiveDataObject
ActiveDataObject returns the current table or query or relation and the line above saves a
reference to this in the tb variable. This makes the macro as general as possible – no
table name or type of object (table/query/relation) need be specified.
You could replace this with a specific table if necessary. For example
Set tb = ActiveDatabase.Tables("mytable")
would also do the job, providing mytable was open at the time (and pointing to the actual
record you want to use).
3. Make an address block
s = ""
For i = 0 To lastfld
txt = tb.Fields(myflds(i)).Value
If Len(txt) > 0 Then
s = s & txt
If i < 2 Then
s=s&""
Else
s = s & vbCr
End If
End If
Next
The code above loops through the fields listed in part 1 and adds them to a variable s. It
checks to see if the fields is blank (in which case it's skipped) and also takes account of
the first line of the address block, the code: If i < 2 then tests for this. All other address
lines are added to s along with a new line (vbCr).
4. Ask the user if he wants to continue
i = MsgBox("Make a letter with this record?" & _
vbCr & vbCr & s, vbOKCancel, _
456 Macros
"Ability Database Macro Message")
If i = vbCancel Then
Exit Sub
End If
This shows a message box with the address block and asks the user to continue or not. If
the user selects the cancel button, the macro is terminated.
5. Open a new write document and drop in the text
Set appWrite = CreateObject("AbilityWrite.Application")
Set mydoc = appWrite.Documents.Add("NORMAL")
mydoc.Text.Insert 0, s & vbCr & vbCr
mydoc.Selection.End = mydoc.Text.Count
mydoc.Selection.Start = Selection.End
appWrite.Activate
End Sub
The first two lines start Write and create a new document. The third line drops in the text.
The fourth and fifth line makes sure the cursor is at the end of the document and finally
the Write application is made visible by the Activate command so the user can finish off
the letter.
Create letter from database - code listing
This is a complete listing of the code referred to in the previous example.
If you want to make use of this macro, copy and paste into the macro editor of Database.
It need to be a global macro so use Tools/Macros. Since it works with the current table,
you'll need to execute the macro while actually viewing a table. For example, you can
add a button to the toolbar that allows you to do this. (Select Tools/Customize and then
the Macro Shortcuts tab. Drag the macro "MakeLetterFromDB", by its button, onto one of
the toolbars at the top of the screen).
To tailor it to your own data, replace the field names starting at line 5 with your own.
Sub MakeLetterFromDB
Dim myflds(9), lfld, s, tb, appWrite, mydoc, i
lastfld = 8
myflds(0) = "CustTitle"
myflds(1) = "Firstname"
myflds(2) = "Lastname"
myflds(3) = "Company"
myflds(4) = "Add1"
myflds(5) = "Add2"
myflds(6) = "Add3"
myflds(7) = "Add4"
myflds(8) = "Pcode"
457 Macros
Set tb = ActiveDataObject
s = ""
For i = 0 To lastfld
txt = tb.Fields(myflds(i)).Value
If Len(txt) > 0 Then
s = s & txt
If i < 2 Then
s=s&""
Else
s = s & vbCr
End If
End If
Next
i = MsgBox("Make a letter with this record?" & _
vbCr & vbCr & s, vbOKCancel, _
"Ability Database Macro Message")
If i = vbCancel Then
Exit Sub
End If
Set appWrite = CreateObject("AbilityWrite.Application")
Set mydoc = appWrite.Documents.Add("NORMAL")
mydoc.Text.Insert 0, s & vbCr & vbCr
mydoc.Selection.End = mydoc.Text.Count
mydoc.Selection.Start = Selection.End
appWrite.Activate
End Sub
Opening a web page inside Ability
Of course, this requires Microsoft's Internet Explorer. The only trick here is knowing how
to refer to Explorer (which is why we've included this as an example).
Sub OpenWebPage()
Dim mIE
Set mIE = CreateObject("InternetExplorer.Application")
mIE.Visible = True
mIE.Navigate "http://www.ability.com"
End Sub
The first line declares mIE as a variable to be used in this sub-routine. This is not strictly
necessary but is good practice (so as not to confuse it with a globally defined variable of
the same name were you to have a complex sequence of macros). The second line
creates an instance of Explorer, the third line makes it visible to the user (rather than run
in the background) and the last line navigates to the Ability web site.
Instead of "hard coding" the web site address, we can instead extract the URL from the
current text. For example, in Spreadsheet, using the following line:
mIE.Navigate ActiveCell.Value
458 Macros
causes the macro to take the text from the current cell, so that, if cell A1 had the text
"http://www.ability.com" and was also the current cell, the macro would again navigate to
the Ability web site.
Ability has a built-in function that performs a similar task – see HYPERLINK on page 581
for details.
Getting information on the script engine
Sometimes it is useful to get information about the script engine being used. For
example, certain features of the VBScript language are only available in version 5.0 of
the script engine. Here's how to do it:
Sub GetScriptVersionInfo
Dim s
s = ScriptEngine & " Version "
s = s & ScriptEngineMajorVersion & "."
s = s & ScriptEngineMinorVersion & "."
s = s & ScriptEngineBuildVersion
MsgBox s
End Sub
"ScriptEngine" etc are built-in VBScript functions.
An introduction to the VBScript language
VBScript is a derivative of Microsoft's Visual Basic designed to be used for web server
scripting and adding intelligence to web pages in Internet Explorer. Because it is
lightweight and very easy to use it makes an ideal language for application Macros.
Please note that this guide is designed as a very brief introduction to the language. If you
want a more detailed introduction, there are plenty of third party books - just go to
http://www.amazon.com/ and search for "VBScript". There is also lots of material at the
Microsoft web site.
Creating and assigning variables
VBScript allows you to create variables on the fly, as simple as this:
x = 24
which creates a variable, x, and gives it the value 24.
With VBScript you don't need to worry about data types. All of this is managed for you.
So all of this is a valid, if pointless, sequence:
Sub MyTest
x = 24
x = "Hello"
y = 12
459 Macros
x=x&""&y
End Sub
The last line shows how to concatenate strings in VBScript - it also demonstrates that the
language is smart enough to know that, in this instance, you want a number to be treated
as text. The end value of x is "Hello 12".
Explicit declaration of variables
If you are going to create a complex sequence of macros, it is a good idea to declare
your variables using a Dim statement in each subroutine. This prevents any confusion
over whether a variable is local to a subroutine or a global one (variables declared
outside of subroutines are global). For example:
Sub MyTest
Dim x, y
x = 24
x = "Hello"
y = 12
x=x&""&y
End Sub
Simple interaction with the user
There are two functions built into the VBScript language that allow you to get some input
value from the user and to display a message:
x = InputBox "Please enter your height in meters"
x = x * 3.279
MsgBox "Your height is " & x & " feet."
will ask the user to type a value in meters and assign it to the variable x, convert it to feet
and then display the result.
Conditional statements
You can conditionally execute commands using if...then...else statements. For example:
If 1 = 2 Then
MsgBox "It's true"
End If
More generally, you can evaluate multiple conditions in one go:
If [condition1] Then
[commands]
Elseif [condition2] Then
[more commands]
Else
[if all else fails, some default commands]
End If
460 Macros
A condition is a statement that logically evaluates as true or false. Here are some
examples:
a=b
True only if a and b have the same value
a>b
True if a is greater than b
a <= b
True if a is less than or equal to b
a <> b
True if a and b do not have the same value
(a = b) And (c < d)
True if a and b are equal and at the same time, c is less
than d
((a = b) And (a < c)) Or (a < b)
True if some complex relationship holds
Note in the last two examples that brackets must be used to surround individual
conditions.
Here's another example that uses a function built-in to VBScript, Len(), that gets the
number of characters in a text string.
str = InputBox "Please enter your name."
If Len(str) = 0 Then
MsgBox "You didn't enter anything!"
Else
MsgBox "The name you entered is: " & str
End If
Repeating commands with a For Next loop
If you want to repeat commands a set number of time, use a For...Next loop. For
example:
For i = 1 to 10
If i < 9 Then
MsgBox "Reminder " & i
Else
MsgBox "Reminder " & i & ", almost there"
End If
Next
VBScript starts by setting a variable i to 1 and then executing the commands sandwiched
between the For and Next statements. Because i can be referenced within this block, the
first time the block is executed, the message box will display:
"Reminder 1"
461 Macros
When the Next line is reached, VBScript adds one to i and returns execution to the top of
the block. And this process is repeated until i reaches 10. So the last message to be
displayed is:
"Reminder 10, almost there"
Repeating commands with a While Wend loop
If you want to repeat a command while a particular condition holds true, use a
While...Wend loop. For example:
str = InputBox "Please enter your name"
While Len(str) = 0
str = InputBox "You must enter at least one character, please try again"
Wend
This rather unfriendly bit of code forces the user to type something into the InputBox.
Using functions and subroutines
What is the difference between a function and a subroutine? Actually, very little. There is
the notional idea that a function usually returns a value whilst a subroutine never does.
Everything else is the same – both subroutines and functions can be passed parameters
and both return to the caller on completion.
If you intend to write a lot of script, you should plan to make good use of functions and
subroutines and make an effort to keep each one short – this will aid in maintaining the
code and should also make you a more efficient programmer. For example, if you have a
For...Next or Do While loop that contains 30 lines of script – consider putting this script
into a separate subroutine. Or if you find yourself re-writing some lines of script – make a
general subroutine or function out it of instead.
The use of functions and subroutines are best explained by example.
Subroutines - an example
To call a subroutine just type it’s name in your main script. As an example, consider a
replacement for MsgBox that replaces the dialog title with your own fixed message.
Here's the entire code:
Sub MainScript
ShowMsg("Hello")
End Sub
Sub ShowMsg(msgstr)
MsgBox msgstr, 0, "My custom msgbox"
End Sub
Note: MsgBox, the built-in VBScript function, takes up to 5 parameters, three of which are
used in the command above: prompt, buttons (0 makes it display only an "OK" button)
and title. (the text in the title bar of the MsgBox dialog).
462 Macros
What's the point? This is obviously a trivial example but even so, if you wanted all your
message boxes to display with your own message in the dialog title, repeatedly writing
out the longer form with "my customer msgbox" every time you wanted to use this
function would become tedious. To push the point home, which is quicker to write and
easier to maintain:
Example A (using a subroutine)
Sub MainScript
ShowMsg("Hello1")
ShowMsg("Hello2")
ShowMsg("Hello3")
ShowMsg("Hello4")
ShowMsg("Hello5")
ShowMsg("Hello6")
End Sub
Sub ShowMsg(msgstr)
MsgBox msgstr, 0, "My custom msgbox"
End Sub
Example B (without using a subroutine)
Sub MainScript
MsgBox "Hello1",
MsgBox "Hello2",
MsgBox "Hello3",
MsgBox "Hello4",
MsgBox "Hello5",
MsgBox "Hello6",
MsgBox "Hello7",
End Sub
0,
0,
0,
0,
0,
0,
0,
"My
"My
"My
"My
"My
"My
"My
custom
custom
custom
custom
custom
custom
custom
msgbox"
msgbox"
msgbox"
msgbox"
msgbox"
msgbox"
msgbox"
Functions - an example
Let’s take some very simple macro and show how it can be converted into a function that
returns a value. Here’s the basic macro:
Sub MainMacro()
y = InputBox “Enter a value in centigrade”
y = 32 + (y * 9) / 5
MsgBox “The answer is “ & y & Fahrenheit”
End Sub
Splitting this into a main subroutine and a function, we get the following:
Sub MainMacro()
y = InputBox “Enter a value in centigrade”
x = FtoC(y)
MsgBox “The answer is “ & x & Fahrenheit”
End Sub
Function FtoC (y)
FtoC = 32 + (y * 9) / 5
End Function
463 Macros
The important part is that the function returns a value by assigning a value to the function
name (as though the function name was itself a variable).
As with the subroutine example, the advantage of splitting the code will only come if you
have to perform the centigrade to Fahrenheit conversion many times in your code. For
example, suppose your code had ten separate lines, in different places that did a
conversion of centigrade to Fahrenheit:
x = 32 + (y * 9) / 5
and you now found out that you needed to check that a sensible value was created. In
this instance, you’d have to go and modify ten lines of code. If you'd split the code into a
function instead, you could adjust the function once. For example:
Function FtoC (y)
If y < -273.15 Then
MsgBox "Colder that absolute zero!"
Exit Function
End If
FtoC = 32 + (y * 9) / 5
End Function
Dealing with run-time errors
There are many situations that can generate run-time errors: careless programming,
system errors and so on. Any run-time error will have stop the script - not usually
desirable.
Here's a general way of dealing with this problem:
On Error Resume Next
[Some statement or call to another procedure]
If Err.Number Then
MsgBox Err.Description
Err.Clear
End If
It works by making use of a global object called Err that is part of VBScript. By stating
that "On Error Resume Next" VBScript knows that you want to deal with any errors rather
than letting VBScript deal with them in it's own way (i.e. to halt the script).
464 SQL Guide
SQL Guide
SQL– short for Structured Query Language – is a widely used language in database
applications. Its main use is in retrieving information, usually only information that is of
particular interest (a query).
SQL can be used in two places in Ability:
Database
using the View SQL button in the query
dialog (View/Query)
Database
functions
most of the database linking functions
support SQL e.g. DBSQL(). These allow
SQL to be used in Write or Spreadsheet
to retrieve data.
Ultimately, Ability uses SQL for all its database operations – for example, creating and
deleting tables and indexes. These types of operation are not covered here.
This guide covers five main types of SQL statement:
Selecting records (see
Selecting records - the
basics on page 464)
selecting all records from a
table, selecting by column
and by row
Aggregate and group
selection (see Groups and
aggregate functions on page
470)
summary information on
tables
Crosstabulations (see
Crosstabulations on page
472)
crosstabs (or contingency
tables)
Relational joins (see
Relational links and joins on
page 474)
linking two tables together
Editing tables (see Editing
records on page 235)
updating, adding and
deleting records
If you are new to SQL, the best place to start your reading is with the section Selecting
records on page 464 , since this topic covers ground required for later topics.
Selecting records - the basics
Consider the following example table of employee information:
EmployeeID
1001
1002
1003
1004
1005
FirstName
Phil
Chris
Andreas
Jim
Julia
LastName
Roach
England
Smith
Smith
Allan
Department
TECH
TECH
SALES
ADMIN
SALES
465 SQL Guide
Age
JoinDate
24
23/1/87
36
1/10/86
25
18/6/90
30
10/3/92
25
26/9/91
To select the entire table, the SQL command is:
SELECT EmployeeID, FirstName, LastName, Department, Age, JoinDate
FROM Employee;
This would return every row and column from the table. The two SQL keywords are
SELECT and FROM. Note that every SQL statement ends with a semi-colon ";".
A shorter alternative expression is:
SELECT * FROM Employee;
The asterisk simply stands for all, or every, column.
To select only names and departments, use:
SELECT FirstName, LastName, Department FROM Employee;
Note that you can re-arrange the order of the columns by supplying the field list in a
different order. For example:
SELECT Department, FirstName, LastName FROM Employee;
This would give the following results table (or query):
Department
TECH
TECH
SALES
ADMIN
SALES
FirstName
Phil
Chris
Andreas
Jim
Julia
LastName
Roach
England
Smith
Smith
Allan
If your table or field names include spaces, you’ll need to surround them with square
brackets as follows:
SELECT [field number 1] FROM [My test table];
Calculated fields and renaming column titles
You can rename column titles using the AS keyword. For example:
466 SQL Guide
SELECT Department AS Dept, FirstName, LastName FROM Employee;
This simply shortens the column header for the returned results table. More usefully, you
can name computed fields. Using the Employee table on page 478 as an example:
SELECT Department, FirstName + " " + LastName AS Name FROM
Employee;
produces the following:
Department
TECH
TECH
SALES
ADMIN
SALES
Name
Phil Roach
Chris England
Andreas Smith
Jim Smith
Julia Allan
Note that the space in between the FirstName and LastName is required to properly
format the result.
Numeric field types can also be used to create calculated columns. Here are some
examples:
SELECT Age + 2 AS [Age in two years] FROM Employee;
SELECT Age * 2 AS DoubleAge FROM Employee;
Applying a sort order
To sort the Employee table on page 478 by LastName, add the keywords ORDER BY:
SELECT Department, FirstName, LastName FROM Employee ORDER BY
LastName;
To make sure "Andreas" appears before "Jim", sort on both FirstName and LastName:
SELECT Department, FirstName, LastName FROM Employee ORDER BY
LastName, FirstName;
To reverse the order, add the keyword for descend as follows:
SELECT Department, FirstName, LastName FROM Employee ORDER BY
LastName DESC, FirstName;
Selecting top records only
You can select the top n records or the top n percent of the Employee table on page 478
, instead of the whole table. For example:
SELECT TOP 3 * FROM Employee;
467 SQL Guide
SELECT TOP 20 PERCENT * FROM Employee ORDER BY Age;
The first example returns the first 3 records only and the second example the youngest
20% of employees. To return the oldest 20%, order the table in reverse:
SELECT TOP 20 PERCENT * FROM Employee ORDER BY Age DESC;
Applying a condition
Rather than selecting all the records from the Employee table on page 478 , you can
select exactly which records you’d like to work with by applying a condition. To do this,
you use the WHERE command.
For example, to work with only those employees who are in the sales department:
SELECT Department, FirstName, LastName FROM Employee WHERE
Department = "SALES";
The results table would look like this:
Department
SALES
SALES
FirstName
Andreas
Julia
LastName
Smith
Allan
Here’s another example:
SELECT FirstName, LastName FROM Employee WHERE Age >= 30 ORDER
BY LastName;
This returns a sorted list of employees over the age of 29.
The part of the SQL statement following the WHERE key word and preceding the
ORDER BY keywords is called a condition and the ‘>=’ is called the operator. Here’s a list
of all the operators you can use with Ability:
Operator
=
!=
<
>
<=
>=
LIKE
IS NULL
AND
OR
NOT
Meaning
Exactly Equal
Not Equal
Less Than
Greater Than
Less Than or Equal To
Greater Than or Equal To
Partial match
Contains no data
Must match both conditions
Match either condition
Reverses logic
468 SQL Guide
IN
BETWEEN
Matches one of a list
Lies in-between two values
By using the operators together you can always define a condition to return the records
you want.
Numeric comparisons
Using the Employee table on page 478 , here are some examples of queries using
numeric comparisons:
SELECT FirstName, LastName, Age FROM Employee WHERE Age = 24 OR
Age = 25;
SELECT FirstName, LastName, Age FROM Employee WHERE Age >= 24
AND Age <= 25;
SELECT FirstName, LastName, Age FROM Employee WHERE Age
BETWEEN 24 AND 25;
SELECT FirstName, LastName, Age FROM Employee WHERE Age IN (24,
25);
All these produce the same results:
FirstName
Phil
Andreas
Julia
LastName
Roach
Smith
Allan
Age
24
25
25
You can exclude the above records, that is return everyone else, by reversing the logic
with the NOT operator:
SELECT FirstName, LastName, Age FROM Employee WHERE Age NOT
BETWEEN 24 AND 25;
SELECT FirstName, LastName, Age FROM Employee WHERE Age NOT IN
(24, 25);
If you are chaining a series of conditions together, take care to use the parenthesis to
denote the order the conditions are evaluated.
Date comparisons
These work in the same way as numeric comparisons (a date is just a number, starting at
0 for 1/1/1900 - see Numeric comparisons on page 468), except you should enclose the
dates in a pair of #s.
For example, using the Employee table on page 478 , you can find out who has joined
since 1990:
469 SQL Guide
SELECT LastName, JoinDate FROM Employee WHERE JoinDate > #1/1/90#;
Text comparisons
Text comparisons are similar to numeric comparisons (see Numeric comparisons on
page 468). For example, using the Employee table on page 478 :
SELECT FirstName, LastName FROM Employee WHERE FirstName > "Jim";
The comparison is made alphabetically on the first letter, then the second letter and so
on. The above would return "Julia" and "Phil" but not "Andreas", "Chris" or "Jim". Note
that all text comparisons must appear between quotes.
Wildcards
Wildcards allow one or more characters to be ignored in a text comparison (see Text
comparisons on page 469).
For example, using the Employee table on page 478 ,
SELECT FirstName, LastName FROM Employee WHERE FirstName =
"Julia";
returns an exact match only - if there was a "Julian" in the table, it would not be returned
by the above SELECT.
To get around this, we can use the LIKE operator in conjunction with an asterisk "*" (the
wildcard):
SELECT FirstName, LastName FROM Employee WHERE FirstName LIKE
"J*";
This produces a match on any FirstName beginning with the letter "J", in this case "Julia"
and "Jim" would be returned.
To find any first name containing the letter "h" use the asterisk twice:
SELECT FirstName, LastName FROM Employee WHERE FirstName LIKE
"*h*";
This returns "Phil" and "Chris".
Another wildcard is the question mark, "?". This can be used to replace a single,
unknown letter in a condition:
SELECT FirstName, LastName FROM Employee WHERE FirstName LIKE
"?h*";
This would match "Phil" and "Chris" again, whereas "??i*" would only match "Phil".
470 SQL Guide
Selecting blank entries
You can use the operator IS NULL to find or exclude fields with no data. For example,
using the Employee table on page 478 :
SELECT Company, Phone, FROM AddressBook WHERE Company IS NULL;
This would return all none-companies from and address book. To reverse this, and select
all companies from the address book, use:
SELECT Company, Phone, FROM AddressBook WHERE Company IS NOT
NULL;
Groups and aggregate functions
You can produce summary statistics for a table using functions on fields with the SQL
statement.
For example, using the Employee table on page 478 :
SELECT COUNT(Department), SUM(Age), MIN(JoinDate), MAX(JoinDate)
FROM Employee;
produces a single row of summary information:
COUNT(Department)
5
SUM(Age)
147
MIN(JoinDate)
1-Oct-1986
MAX(JoinDate)
10-Mar-1992
You can use these functions in conjunction with the GROUP BY keywords to produce
consolidated group statistics. For example:
SELECT Department, AVG(Age), COUNT(*) FROM Employee GROUP BY
Department;
This time we can include Department in the select statement as this is the field we are
grouping on. The results table lists, in each department, the average age and the total
number of people.
Department
ADMIN
SALES
TECH
AVG(Age)
30
25
33.5
COUNT(*)
1
2
2
As normal select statements have an optional WHERE clause to specify which rows are
included from the table, so GROUP statements have an optional HAVING clause.
For example, to show a list of departments with an average age over 30, use the
following:
471 SQL Guide
SELECT Department, AVG(Age), COUNT(*) FROM Employee GROUP BY
Department HAVING AVG(Age) > 30;
Here’s a complete list of aggregate functions you can use:
Function
COUNT
SUM
MAX
MIN
AVG
VAR
VARP
STDEV
STDEVP
Meaning
Count the number of records
Total
Find the maximum value of field
Find the minimum value of field
Average
Sample variance
Population variance
Sample standard deviation
Population standard deviation
Finding duplicate records on page 471
Other types of SQL statements on page 464
Grouping on more than one level
You can group by more than one field. For example, using the Employee table on page
478 :
SELECT Department, Age, COUNT(*) FROM Employee GROUP BY
Department, Age;
produces the following table:
Department
ADMIN
SALES
TECH
TECH
Age
30
25
24
43
COUNT(*)
1
2
1
1
Finding duplicate records
You can use GROUP BY to display a list of duplicate records by counting the
consolidated records. For example, using the Employee table on page 478 :
SELECT LastName, COUNT(*) FROM Employee GROUP BY LastName
HAVING COUNT(*) > 1;
472 SQL Guide
As only the name "Smith" is duplicated in LastName, the results table looks like this:
LastName
Smith
COUNT(*)
2
As you can group on several fields, you can construct more complex de-duplication
queries. Using the EmployeeSales table on page 479 as an example, the following query
picks out the first and last occurrence of duplicated sales region / employee
combinations. It also calculates a count of how many duplicates occur.
SELECT Employee, Region, COUNT(*) AS Total, FIRST(SalesID) AS [First
Match], LAST(SalesID) AS [Last Match] FROM EmployeeSales GROUP BY
Employee, Region HAVING COUNT(*) > 1;
This produces the following table:
Employee
John
John
Richard
Susan
Region
North
South
North
South
Total
2
2
3
2
First Match
1
5
4
3
Last Match
2
8
7
9
Crosstabulations
Crosstabulations (or contingency tables, or crosstabs for short), allow you to compare the
entries in one field with those of another. For example, suppose we have three
employees John, Richard and Susan, who make sales in two regions, north and south.
The sales are recorded in a table, EmployeeSales. Such a table may look like this:
SaleID
1
2
3
4
5
6
7
8
9
Employee
John
John
Susan
Richard
John
Richard
Richard
John
Susan
Region
North
North
South
North
South
North
North
South
South
Suppose you want a breakdown of sales by region, for each salesman. This can be done
using a TRANSFORM statement:
TRANSFORM COUNT(Region) SELECT Employee FROM EmployeeSales
GROUP BY Employee PIVOT Region;
This produces the following results table:
473 SQL Guide
Employee
John
Richard
Susan
North
2
3
South
2
2
For each employee, at total of sales in each region is calculated.
Let’s look at the general form of this SQL statement. Given that you want to compare
field_a against field_b, the SQL is really a standard GROUP select, wrapped in a
TRANSFORM and PIVOT:
TRANSFORM COUNT(field_a) SELECT field_b FROM table GROUP BY
field_b PIVOT field_a;
Suppose we wanted row totals. All we need to do is add a COUNT within the SELECT
statement:
TRANSFORM COUNT(Region) SELECT Employee, COUNT(Employee) AS
[Employee Total] FROM EmployeeSales GROUP BY Employee PIVOT
Region;
producing the following table:
Emloyee
John
Richard
Susan
Employee Total
4
3
2
North
2
3
South
2
2
Note that the employee count is given a new column title on the fly using the AS keyword.
As well as counting fields, other statistics can be used. Here’s a complete list:
Aggregate Function
FIRST
LAST
COUNT
MAX
MIN
Restricting pivot field values
You can choose to select specific values of the pivot field. For example, using the
EmployeeSales table on page 479 , we can choose to look at only those records in the
north region:
TRANSFORM COUNT(Region) SELECT Employee FROM EmployeeSales
GROUP BY Employee PIVOT Region IN ("North");
474 SQL Guide
This produces the following table:
Employee
John
Richard
Susan
North
2
3
Note that the value list after the IN keyword must be in brackets. The general form of this
statement is:
TRANSFORM COUNT(field_a) SELECT field_b FROM table GROUP BY
field_b PIVOT field_a; IN ("value 1", "value 2", "value 3", …., "value n");
Relational links and joins
Suppose that for each employee, you wanted to keep a record of holidays taken. Such a
table might look like:
HolidayID
1
2
3
4
EmployeeID
1002
1003
1002
1004
StartDate
1/2/97
21/2/97
24/2/97
1/3/97
DaysHoliday
5
1
3
4
Note that this table has a reference - EmployeeID - to the Employee table (see Employee
table on page 478). This is called a Foreign Key and implies some important rules that
should be (but are not always) abided by:
1. Each record in the Holiday table must contain a valid EmployeeID, that is you can’t
have an EmployeeID in the Holiday table that doesn’t also have a matching entry in
the Employee table.
2. Each EmployeeID listed in the Holiday table can only exist once in the Employee
table. EmployeeID forms a unique index for the Employee table called a primary key.
The resultant relation between the Employee table and the Holiday table is one-tomany, that each employee can have zero, one or more holidays.
These rules provide the basis for referential integrity, a goal of good database design that
Ability will try to help you achieve.
To join the two tables, use the following statement:
SELECT Employee.*, Holiday.* FROM Employee INNER JOIN Holiday ON
Employee.EmployeeID = Holiday.EmployeeID;
This selects all the fields from both tables. To select some of the fields, care has to be
taken not to confuse fields from one table with another – for example, the field
475 SQL Guide
EmployeeID exists in both tables. To avoid conflicts, tag on the table name to each field
in the following manner:
SELECT Employee.EmployeeID, Employee.FirstName, Employee.LastName,
Holiday.HolidayID, Holiday.StartDate, Holiday.DaysHoliday FROM Employee
INNER JOIN Holiday ON Employee.EmployeeID = Holiday.EmployeeID;
This produces the following results table:
EmployeeID
1002
1002
1003
1004
FirstName
Chris
Chris
Andreas
Jim
LastName
England
England
Smith
Smith
HolidayID
1
3
2
4
StartDate
1/2/97
24/2/97
21/2/97
1/3/97
DaysHoliday
5
3
1
4
Join types
There are three types of join:
INNER JOIN
LEFT JOIN
RIGHT JOIN
(otherwise known as "left outer join")
(otherwise known as "right outer join")
Inner joins are the most common types of join and only return records that match in both
tables.
For example, joining the Holiday table on page 479 and Employee table on page 478
using:
SELECT Employee.*, Holiday.* FROM Employee INNER JOIN Holiday ON
Employee.EmployeeID = Holiday.EmployeeID;
produces the following results table:
EmployeeID
1002
1002
1003
1004
FirstName
Chris
Chris
Andreas
Jim
LastName
England
England
Smith
Smith
HolidayID
1
3
2
4
StartDate
1/2/97
24/2/97
21/2/97
1/3/97
DaysHoliday
5
3
1
4
Note that there no records here for EmployeeID 1001 or 1005 since there are no
matching records in the Holiday table, that is, these employees have not taken any
holiday to date.
If you wanted to include every employee, you’d use a LEFT JOIN as follows:
SELECT Employee.*, Holiday.* FROM Employee LEFT JOIN Holiday ON
Employee.EmployeeID = Holiday.EmployeeID;
476 SQL Guide
Every record from the table "to the left" of the join statement is included.
Similarly, you can issue a RIGHT JOIN statement to include all records from the table to
the right of the join statement:
SELECT Employee.*, Holiday.* FROM Employee RIGHT JOIN Holiday ON
Employee.EmployeeID = Holiday.EmployeeID;
Strictly speaking, this should return the same results table as the INNER JOIN, since it
makes no sense to assign holidays to non-existent employees. However, this can
sometimes happen, especially with "historical" data – data imported from a system not
set-up to obey referential integrity.
Unmatched queries
LEFT and RIGHT JOINS are useful for finding unmatched records. For example, to
produce a list of all employees who have not taken holidays, using the Employee table on
page 478 and Holiday table on page 479 :
SELECT Employee.* FROM Employee LEFT JOIN Holiday ON
Employee.EmployeeID = Holiday.EmployeeID WHERE Holiday.EmployeeID
IS NULL;
To produce a list of holidays that have not been assigned to any employee, if there be
any:
SELECT Holiday.* FROM Employee RIGHT JOIN Holiday ON
Employee.EmployeeID = Holiday.EmployeeID WHERE
Employee.EmployeeID IS NULL;
Editing records
SQL statements can make changes to one, many or all records; therefore all editing type
SQL commands need careful application.
Ability supports three types of these SQL commands:
Update (see Updating records
on page 476)
Insert (see Adding records on
page 197)
Delete (see Deleting records on
page 200)
modify records
add records or tables
remove records
Updating records
The SQL statement UPDATE can be used to edit or update fields in one, many or all
records in a table. These types of queries don’t produce results tables – you have to
477 SQL Guide
issue a further SELECT statement to view the results. Here are some examples, using
the Employee table on page 478 :
UPDATE Employee SET Department="MARKETING";
Note that this replaces the Department field for every record. To limit the scope of the
update, use the WHERE clause:
UPDATE Employee SET Department="MARKETING" WHERE EmployeeID =
1005;
This performs an update to a single record. In the case where EmployeeID is a primary
key, this form of update is guaranteed to modify a single record (at most).
To update several fields at once, list them after the SET keyword. For example, if an
employee changed department and got married at the same time:
UPDATE Employee SET Department="MARKETING", LastName = "Pallister"
WHERE EmployeeID = 1005;
Adding records
To add a record to a table, use the INSERT command and specify at least some field
information. For example, to add a new employee to the Employee table (see Employee
table on page 478), we’d at least need to assign a new EmployeeID:
INSERT INTO Employee (EmployeeID) VALUES (1006);
To create a new record and fill in the field details at the same time, list the fields after the
table, and each value in order after the VALUES keyword:
INSERT INTO Employee (EmployeeID, FirstName, LastName, Department,
Age, JoinDate) VALUES (1007, "Joel", "Coleman", "ADMIN", 49, #1/5/97#);
Note that you surround each new value with quotes, unless the field is of a numeric type
where the quotes are omitted or date where the hash "#" sign is used instead. Also note
that both the field list and the values list are enclosed with brackets.
Adding multiple records
You can use the INSERT command to add many records from one table to another. For
example, if there was a table called NewEmployee, with an identical structure (field list) to
the Employee table on page 478 , you could add all the records from NewEmployee to
Employee using the following statement:
INSERT INTO Employee SELECT * FROM NewEmployee;
If the two tables are not identical, or you only want to append certain fields, list the fields
for both source and destination table. For example, you want to add records to the
Employee table from an old Employee table containing different field names:
478 SQL Guide
INSERT INTO Employee (EmployeeID, FirstName, LastName) SELECT
(EmpID, Fname, Lname) FROM OldEmployee;
Note the SELECT part of the INSERT statement follows all the rules for general SELECT
statements described above. For example, you can specify which records to append
using the WHERE clause:
INSERT INTO Employee (EmployeeID, FirstName, LastName) SELECT
(EmpID, Fname, Lname) FROM OldEmployee WHERE JoinDate < "1/1/80";
Creating tables from existing data
The combination of SELECT and INTO can create new tables based on existing
information. For example, to create a table of employees in the sales department from
the Employee table on page 478 , use the following statement:
SELECT * INTO Sales FROM Employee WHERE Department = "SALES";
To create a table with just names, use:
SELECT Employee.FirstName, Employee.LastName INTO Sales FROM
Employee WHERE Department = "SALES";
To create a complete copy of a table, just omit the WHERE clause:
SELECT * INTO EmpCopy FROM Employee;
Deleting records
The DELTE command allows you to drop records, permanently, from a table. There’s no
"undo" for this operation, so make sure you have adequate back-ups in case something
goes wrong. A good safety measure is to use a SELECT statement first to see what
records will be deleted.
For example, using the Holiday table on page 479 , if we are no longer interested in
holidays from the 1980s, we could check which records fell into this category by using:
SELECT * FROM Holiday WHERE StartDate < "1/1/90";
Then delete them with:
DELETE * FROM Holiday WHERE StartDate < "1/1/90";
To drop all the records from a table:
DELETE * FROM Holiday;
Please use with care!
Employee table
479 SQL Guide
The example employee data:
EmployeeID
1001
1002
1003
1004
1005
FirstName
Phil
Chris
Andreas
Jim
Julia
LastName
Roach
England
Smith
Smith
Allan
Department
TECH
TECH
SALES
ADMIN
SALES
Age
24
36
25
30
25
EmployeeSales table
The example employee sales data:
SaleID
1
2
3
4
5
6
7
8
9
Employee
John
John
Susan
Richard
John
Richard
Richard
John
Susan
Region
North
North
South
North
South
North
North
South
South
Holiday table
The example holiday data:
HolidayID
1
2
3
4
EmployeeID
1002
1003
1002
1004
StartDate
1/2/97
21/2/97
24/2/97
1/3/97
DaysHoliday
5
1
3
4
JoinDate
23/1/87
1/10/86
18/6/90
10/3/92
26/9/91
480 Function reference
Function reference
Ability provides a range of over 200 built-in functions that you can use in formulas.
A built-in function is a fast way to perform often-used calculations (such as totaling a
group of numbers) or complicated calculations (like figuring the net present value or the
internal rate of return).
The functions in Ability are divided into the following main categories:
Date functions on page 486
Financial functions on page 493
Trigonometric functions on
page 527
Mathematical functions on page
513
Statistical functions on page
536
Remote functions on page 568
Text functions on page 557
Document functions on page 565
Lookup functions on page
529
Logical functions on page 512
Information functions on
page 534
Using built-in functions
Built-in functions are actually formulas, and must be preceded by an equals sign (=) on
the formula bar. You can use the built-in functions to perform date, financial, logical,
mathematical, trigonometric, statistical, and other calculations.
You include a built-in function in a formula according to specific rules:
First activate the cell in which you wish the formula result to go, and then type the formula
as usual. You can use a built-in function as the entire formula, or as part of one. You
must precede the function name with = to show Ability that it is a formula.
You must type the function name exactly; you can’t abbreviate the name. The only
exceptions are that you can enter AVG for the AVERAGE function, and STD for the
STDEV function.
The function name is always followed by an open parenthesis, then the required
arguments, and then a close parenthesis. Arguments are the values Ability needs to
perform the calculation.
481 Function reference
For example, the TOTAL function requires as its argument a list of the values you want to
add. The list can be numbers, cell addresses, cell ranges, or cell names. Here’s what you
might type to find the total of some values in column C of a spreadsheet:
=TOTAL(C1..C15)
If a function doesn’t require an argument, you must still enter the parentheses. For
example:
=TODAY()
You can use more than one function in a single formula. Use parentheses to group the
various functions and control the order of calculation. For example, you can calculate the
average of a row of numbers and display the absolute value of the result by using the
formula:
=ABS(AVG(A1..A8))
If Ability is unable to perform the calculation you request, you’ll see an error indicator
displayed in the cell instead of the result of the formula. You can find a list of the error
indicators, and an explanation of each, later in this section.
Using the function dialog box to build formulas
The quick way to add built-in functions to your formulas is by using the "Insert Function"
dialog box. This saves you from having to remember all the different function names and
the parameters each function requires.
Suppose you want to display the month number of the current date. Follow these steps:
1. Double-click in an empty field to activate the Formula Editor
2. Click on the Insert Function button, or select the Function command from the Insert
menu
3. Click on the Date category and then select the Month function. Click on the OK
button
4. The cursor will now lie between the brackets inserted with the Month function. Click
the Insert Function button again and select the Date category and then select the
Today function. The formula should now read MONTH(TODAY()).
5. Click the Confirm button on the formula bar (or press Enter) to finish the formula.
You can call on the "Insert Function" dialog box any time you are editing a formula.
Select the Paste Arguments checkbox before clicking OK, to make Ability insert the
formula with text entries for each of the function parameters. You can then replace them
with the appropriate cell or range references.
482 Function reference
Text arguments
Some formulas require text as arguments. In such cases, the text can be supplied either
directly into the function by surrounding the text by double quotes, or by cell reference, in
which case quotes are not required.
Some examples of functions that require text as arguments are:
WPGET(document, fieldname), LEFT(text, num_chars) and UPPER(text)
where the text arguments are highlighted in bold.
For example, suppose you wanted to put the sentence "Have a nice day" into uppercase,
use one of the following methods:
UPPER("Have a nice day")
UPPER(A1)
where A1 contains the text: Have a nice day without any quotes.
Text arguments containing quotes
Suppose the text argument itself contains one or more quotes. For example, "Have a
"nice" day". The quotes within the text need to be treated as a special case, so that
Ability knows where an argument begins and ends. This is done by "escaping" the
character, using the caret (^) as follows:
UPPER("Have a ^"nice^" day")
Note that the quotes surrounding the word nice are each preceded by the caret. The
same thing can be achieved using a cell reference without the need for escaping
characters:
UPPER(A1)
where A1 contains the text Have a "nice" day and the function will still work as
expected.
If your text contains a caret, you need to escape the caret itself, so:
UPPER("The caret is denoted by the ^^ symbol")
returns the text: THE CARET IS DENOTED BY THE ^ SYMBOL.
Arrays
Some formulas require one or more arrays. An array is the same as a list, except that an
array may be two-dimensional.
483 Function reference
When entering numeric constants directly, rather than by cell reference, into a formula
that requires an array as an argument, the array must be bounded by a pair of "braces"
{}. For example, the INTERCEPT function (see INTERCEPT on page 545) requires two
arrays as arguments. These are usually entered as cell ranges:
INTERCEPT(A1..A10, B1..B10)
but can be entered using numbers directly:
INTERCEPT({1, 2, 3, 4}, {1.1, 2.4, 2.9, 4.1})
Note that the arrays themselves are separated by a comma.
Other formulas, for example MDETERM (see MDETERM on page 518), where the
function performs a calculation on a matrix with an equal number of rows and columns,
take as argument a single array. Note that each row in the array is separated by a semicolon:
MDETERM({2, 5, -3; -1, 10, 1; 2, -3, 1})
You cannot, however, use a range reference as if it were composed of separate ranges
or individual cell references. So, for example, the formulas MDETERM({A1..C1; A2..C2;
A3..C3}) and MDETERM({A1, B1, C1; A2, B2, C2; A3, B3, C3}) are invalid and return an
error message.
Logical operators
There are three logical operators you can use when building logical expressions. These
are especially useful when you are using the IF function (see IF on page 512).
The following table lists the logical operators in their natural order of evaluation. If you
combine either AND or OR with relational operators in an expression, Ability evaluates
the relational operators before evaluating the AND or OR.
Operator
&
|
~
Meaning
AND
OR
NOT
For example:
Formula
Returns
2*3>7
FALSE
(2 * 3 > 7) | (4 * 1 = 4)
TRUE
(2 * 3 = 6) & ~(4 - (4 * 1))
TRUE
484 Function reference
IF (cond1 & cond2 & cond3,
truevalue, falsevalue)
If all conditions are met, truevalue
Using the logical operators is equivalent to using the logical functions as follows:
Formula
Function Equivalent
(2 * 3 > 7) | (4 * 1 = 4)
OR((2 * 3 > 7), (4 * 1 = 4))
(2 * 3 = 6) & ~(4 - 4 * 1)
AND((2 * 3 = 6), NOT(4 - 4 * 1))
IF (cond1 & cond2 & cond3,
truevalue, falsevalue)
IF(AND(cond1, cond2, cond3),
truevalue, falsevalue)
Relational operators
You can use the following relational operators when building logical expressions.
Operator
<
>
=
<=
>=
<> or ~=
Meaning
Less than
Greater than
Equal to
Less than or equal to
Greater than or equal to
Not equal to.
These are especially useful in combination with the IF(x, true, false) function (see IF(x,
true, false) on page 512).
If you combine relational operators with arithmetical operators in an expression, Ability
performs the arithmetical operations before evaluating the relational operators.
Arithmetical operators
The following standard arithmetical operators are available in Ability. If arithmetical
operators are used in conjunction with relational operators in an expression, then the
arithmetical operations are calculated before the relational operators are evaluated.
Operator
+
*
/
^
Meaning
add
subtract
multiply
divide
power e.g. 2 ^ 3 = 2 * 2 * 2
485 Function reference
%
(..)
percentage e.g. 15% = 0.15
bracketed expressions e.g. (2 * 8 - 17)
Note that the arithmetical operators are evaluated in the following order in an expression:
(..)
%
^
* and /
+ and For example, the expression:
1+2*3/4^5%-6
is calculated as if it were the bracketed expression:
1 + ((2 * 3) / (4 ^ (5%))) - 6
Ability will automatically strip excess brackets from a formula to display it in its simplest
form.
Priority of evaluation of operators
The functions and operators in Ability are evaluated in an order of priority. For complex
expressions you will not have to worry about this too much, since it is likely that you will
have used brackets to control and make clear the way you want the expressions to be
calculated. The priorities are as follows, starting with the highest:
Operator / Function
Built-in functions
(..)
%
^
* and /
+ and <, <=, >, >=, =, <>
~
&
|
Meaning
Ability’s built-in functions
bracketed expressions
percentage
power
multiply and divide
add and subtract
relational operators
NOT
AND
OR
Cell error indicators
If Ability cannot perform the calculation you request in a formula, it displays an error
indicator in the cell instead of the result of the calculation.
There are five different error messages:
486 Function reference
Error
#VALUE
Explanation
Formula cannot be evaluated. For example, the
type of an argument does not match, as in
SQRT(-16), or an argument is out of range, as
in RIGHT("New York", -5).
Wrong number of function arguments or
improper function argument. For example,
SIN(A1, A2, A3) or COS(A1..B10).
The formula attempts to divide by zero.
Bad reference argument in formula. For
example, SUM(Sales), when there is no range
called Sales.
The formula makes a circular link. For example,
when the formula =A1 + 5 is entered in A1.
#FUNC
#DIV0
#REF
#CIRC
Date functions
Ability allows you to perform arithmetic with dates and times. To do this, it has a built-in
numbering sequence, called a date/time code, that starts on 1st Jan 1900 and increases
by one for each subsequent day.
The date time code has a fractional component as well, to correspond to the hour, minute
and second since midnight. A date/time code of 1.5 represents one-and-a-half days since
the start of the year 1900, that is 12:00 noon on the 2nd Jan 1900.
For example:
Date/time code
Date code
35484.47917
35484
Time code
0.47917
24th Feb 1997 11:30:00 AM
24th Feb 1997 i.e. 35484 days since
1/1/1900
11:30 AM i.e. 0.47917 * 24 hours since
midnight
A date code, then, is the integer part of a date/time code, and a time code is the fractional
remainder.
You can use Ability’s built-in date functions to generate a date/time code or to translate
a date code into the weekday, day, month or year, and a time code into hours, minutes
and seconds.
To change how a date/time code is displayed, use the Number command from the
Format menu and then select a date format.
Here is a complete list of date functions in Ability:
DATE on page 488
DATEVALUE on page 488
487 Function reference
DAY on page 488
DAYS360 on page 488
EDATE on page 489
EOMONTH on page 489
HOUR on page 489
MINUTE on page 489
MONTH on page 490
NETWORKDAYS on page
490
NOW on page 490
SECOND on page 491
TIME on page 491
TIMEVALUE on page 491
TODAY on page 491
WEEKDAY on page 492
WEEKNUM on page 492
WORKDAY on page 492
YEAR on page 493
YEARFRAC on page 493
Year 2000
The short answer is that the change of millennium won't cause any problems for Ability.
There are, however, two issues of which you should be aware:
1. Date format - in a spreadsheet showing both 20th and 21st Century dates, you
should format all dates to display four-digit years to avoid confusion (see Formattting
a date on page 108 for more details).
2. Date entry - you can enter dates using either two-digit years or four-digit years.
Obviously with four-digit years, there's no ambiguity in century. Most people will be
used to entering two-digit years, in which case Ability will assume you mean the 20th
Century for all years later than and including 1972 and up to 1999, and the 21st
Century for all other years entered as two digit. For example:
Enter date as…
1/1/99
1/1/00
1/1/71
1/1/72
Ability understands you to mean…
1/1/1999
1/1/2000
1/1/2071
1/1/1972
488 Function reference
DATE(year, month, day)
The DATE function calculates a date code for the given year, month and day. For
example, the formula:
DATE(97, 8, 8)
produces the date code 35649 or 8th August 1997, depending on your number format.
DATEVALUE(date_text)
The DATEVALUE function converts a date in the form of text to a date code. For
example, the formula:
DATEVALUE("8-Aug-1997")
returns the date code 35649, as does
DATEVALUE("8/8/97")
If the year is left out, the date code will refer to the current year.
DAY(date-code)
The DAY function calculates the day of the month of the date-code you enter. For
example, the formula
DAY(35649)
produces 8 as the day of the month, since the date code refers to 8th August 1997.
DAYS360(start_date, end_date, method)
The DAYS360 function calculates the number of days between a start_date and an
end_date, based on a 12-month year of 30 days each. This is useful when accounts are
calculated on the assumption of a 30-day month. The dates can be entered in either text
or date code format.
method is either European (TRUE or omitted) or American (FALSE). If TRUE or omitted
then start-dates or end-dates that refer to the 31st day of a month become 30; if FALSE
then a start-date of 31 becomes 30, but an end-date of 31 becomes the 1st of the next
month when the start-date is less than 30, otherwise the end-date becomes 30.
For example, the formula
DAYS360("25/1/97", "31/7/97", TRUE)
returns 185, whereas
489 Function reference
DAYS360("25/1/97", "31/7/97", FALSE)
returns 186.
EDATE(start_date, months)
The EDATE function calculates the date from a start_date plus or minus the number of
months indicated. For example, the formula
EDATE("12 December, 1997", -3)
returns the date "12 September, 1997".
EOMONTH(start_date, months)
The EOMONTH function calculates the end of the month from a start_date plus or minus
the number of months indicated. For example, the formula
EOMONTH("4/4/96", 5)
returns the date "30 September, 1996".
HOUR(time_code)
The HOUR function converts a time_code to an hour. The hour is calculated using the
24-hour clock as a basis, running from 0 at 12 PM (or 0:00 hours) to 23 at 11 PM (or
23:00 hours). 24-hour cycles correspond to a time code increment of 1. The argument for
HOUR can be in either text or time code format.
Examples:
Formula
HOUR(0.3)
HOUR(1.5)
HOUR(455.5)
HOUR("9:30 PM")
HOUR("21:30:45")
Returns
7
12
21
21
21.
MINUTE(time_code)
The MINUTE function converts a time_code to a minute. The minute is calculated using
1 hour as a basis, running from 0 to 59. A time code increment of 1 corresponds to 1 day
(or 1,440 minutes). The argument for MINUTE can be in either text or time code format.
The following examples all returns 12, that is the 12th minute after the 13th hour of the
day.
490 Function reference
Formula
MINUTE(0.55)
MINUTE(1.55)
MINUTE("13:12")
Returns
12
12
12
MONTH(date-code)
The MONTH function calculates the month from the date_code you enter.
For example,
MONTH(31062)
returns month 1, since the date referred to by the date code is 16th January 1985.
NETWORKDAYS(start_date, end_date, list_holidays)
The NETWORKDAYS function calculates the number of whole work days between 2
dates, start_date and end_date, taking into account weekends and holidays.
For example, the formula
NETWORKDAYS ("1 Jan 1997", "31 Dec 1997")
returns 261, that is a year’s worth of workdays, taking into account weekends.
NETWORKDAYS ("1 Jan 97", "31 Jan 97", "14 Jan 97", "15 Jan 97")
returns 21, that is the number of workdays in January with two days holiday.
NOW( )
The NOW function calculates the current date and time from the date-time code as set by
your computer’s built-in clock.
For example:
NOW()
would return "July/2/1997 12:23 PM" if that was in fact the current time and date.
If you choose to display the date-time code as a number, then the numbers before the
decimal point represent the date, and the numbers after the decimal point represent the
time.
The time and date are taken directly from your computer’s operating system (e.g.
Windows 95) - if they appear incorrect, you need to adjust the clock on your PC.
491 Function reference
SECOND(time_code)
The SECOND function calculates the number of seconds from 0 to 59 from a time_code.
The function can take as argument either a time code or text.
For example, the formula
SECOND("22:14:10")
returns 10, the number of seconds into the 14th minute of the 22nd hour.
SECOND(0.01)
returns 24, as a 100th of a day is 14 minutes and 24 seconds exactly.
TIME(hour, minute, second)
The TIME function calculates the time code from a supplied hour, minute and second.
This enables you to display the time in a format of your choice. The arguments for TIME
are entered according to the 24-hour clock.
For example, the formula
TIME(22,20,40)
returns a time code of 0.93101852 and is equivalent 10:20:40 PM, which is the displayed
default format.
Note that the formulas TIME(0, 0, 0) and TIME(24, 0, 0) return time codes of 0 and 1
respectively.
TIMEVALUE(time_text)
The TIMEVALUE function calculates the time code based on a time represented as text.
The time code is a decimal fraction ranging from 0 to 0.99999 (0:00:00 to 23:59:59).
For example, the formula
TIMEVALUE("20:15:30")
returns the time code 0.84409722 when formatted as a plain number.
TODAY( )
The TODAY function returns today's date. It actually calculates a date code for the
current day and, by default, this is then formatted and displayed as a recognizable date.
For example, the formula
492 Function reference
TODAY()
returns "July/2/1997" on that date.
The date is taken directly from the operating system (e.g. Windows 98) - if it appears
incorrect, you need to adjust the clock on your PC.
WEEKDAY(date_code)
The WEEKDAY function calculates the day of the week for the supplied date_code.
Days of the week are numbered sequentially from Sunday (1) through to Saturday (7).
For example, the formula
WEEKDAY(35612)
returns 4, as 2nd July 1997 occurs on a Wednesday. The WEEKDAY function can be
useful in conjunction with the TODAY function, for example:
WEEKDAY(TODAY())
returns the current day of the week.
WEEKNUM(date_code, return_type)
The WEEKNUM function uses date_code to calculate the week number in the year.
return_type is a number that tells the function on what day of the week the week begins:
1 for Sunday; 2 for Monday. If this is omitted WEEKNUM uses 1.
For example, if you want to know the week number for 1st November 1997, assuming the
week begins on Monday, use the formula
WEEKNUM("1 Nov 97", 2)
which returns 44 (the 44th week of the year).
WORKDAY(start_date, days, list_holidays)
The WORKDAY function returns a date that is start_date plus or minus days - a
specified number of workdays, taking into account weekends and holidays given by
list_holidays.
For example, the formula
WORKDAY("February/1/97", 100, "March/28/97")
returns the date "June/23/1997", a date 100 workdays after 1st Feb 97, given a holiday on
28th March.
493 Function reference
YEAR(date-code)
The YEAR function returns the year of the date code you enter.
For example, the formula
YEAR(31062)
returns the year 1985. At the time this text was written, the following example returns
1997:
YEAR(TODAY())
YEARFRAC(start_date, end_date, basis)
The YEARFRAC function calculates the year fraction representing the number of whole
days between start_date and end_date.
basis is the type of day count basis to be used, as defined by the following table:
Basis
0
1
2
3
4 or omitted
Day count basis
US 30/360
Actual/actual
Actual/360
Actual/365
European 30/360
For example, if a period has start date, 5 August 1997, and end date, 1 November 1997,
with a day count basis of 30/360, the formula
YEARFRAC(35646, 35734, 4)
returns a year fraction for the period of 0.2389 or 23.89%.
Financial functions
Here is a complete list of financial functions in Ability. You can use the built-in financial
functions to calculate compound amounts and net present values of investments, and to
perform other forecasting and analytical calculations.
ACCRINTM on page 494
COMPOUND on page 495
COUPDAYBS on page 495
COUPDAYS on page 496
COUPDAYSNC on page 497
COUPNCD on page 497
494 Function reference
COUPNUM on page 498
COUPPCD on page 498
DB on page 499
DISC on page 500
DOLLARDE on page 501
EFFECT on page 501
FV on page 502
INTRATE on page 502
IRR on page 503
MIRR on page 503
NOMINAL on page 504
NPV on page 505
PMT on page 506
PRICE on page 506
PRICEDISC on page 507
PRICEMAT on page 508
PV on page 509
RECEIVED on page 509
TAXBAND on page 510
TBILLPRICE on page 511
TBILLYIELD on page 511
ACCRINTM(issue, settlement, rate, par, basis)
The ACCRINTM function calculates the accrued interest for a security that pays interest
at maturity. The function arguments are:
issue
settlement
rate
par
basis
is the issue date of the security, expressed as a
date code
is the maturity date of the security, expressed as a
date code
is the annual coupon (interest) rate of the security
is the par or base value of the security (if par is
omitted, ACCRINTM uses $1000)
is the type of day count basis used, where basis is
one of the following:
Basis
Day count basis
0
US 30/360
1
Actual/actual
2
Actual/360
3
Actual/365
4 or omitted
European 30/360
The function is calculated using the formula
495 Function reference
ACCRINTM = par * rate * (A / D)
where A is the number of days accrued, counted according to a monthly basis, and D is
the annual year basis.
ACCRINTM calculates non-compound (or simple) interest over the security’s period.
For example, you have been issued with a coupon worth $10,000 on July 1st 1997 that
comes to maturity on September 30th 1997; the coupon’s annual interest rate is 12%;
and you want to know what the interest will be on September 30th when the coupon
achieves maturity. Use the formula:
ACCRINTM(35611, 35702, 0.12, 10000, 3)
to get an interest payment of $299.18.
COMPOUND (principal, interest, periods)
The COMPOUND function calculates the compound amount, based on the principal and
interest rate per period over the specified number of periods. The formula used is:
principle * (1 + interest )periods
For example, to find out the compound amount on a principal of $500, at an annual
interest rate of 13.5%, over 12 years, use the formula:
COMPOUND(500,13.5%,12)
Ability calculates the compound amount and displays the result 2285.1796 or $2,285.18
(depending on the currency formatting of the cell – use the Number command from the
Format menu to change it).
COUPDAYBS(settlement, maturity, frequency, basis)
The COUPDAYBS function calculates the number of days from the beginning of the
coupon period to the settlement date. The function arguments are:
settlement
maturity
frequency
basis
is the settlement date of the security, expressed as
a date code
is the maturity date of the security, expressed as a
date code
is the number of coupon payments per year (1 =
annually; 2 = biannually; 4 = quarterly)
is the type of day count basis used, where basis is
one of the following:
Basis
Day count basis
0
US 30/360
496 Function reference
1
2
3
4 or omitted
Actual/actual
Actual/360
Actual/365
European 30/360
For example, you have been issued with a bond that comes to maturity on August 31st
1998, the settlement date is July 15th 1997, the coupon payments are quarterly, and the
day count basis is actual/actual. Using the formula
COUPDAYBS(35625, 36037, 4, 1)
returns 45 as the number of days from the beginning of the coupon period to the
settlement date.
COUPDAYS(settlement, maturity, frequency, basis)
The COUPDAYS function calculates the number of days in the coupon period in which
the settlement date occurs. The function arguments are:
settlement
maturity
frequency
basis
is the settlement date of the security, expressed as
a date code
is the maturity date of the security, expressed as a
date code
is the number of coupon payments per year (1 =
annually; 2 = biannually; 4 = quarterly)
is the type of day count basis used, where basis is
one of the following:
Basis
Day count basis
0
US 30/360
1
Actual/actual
2
Actual/360
3
Actual/365
4 or omitted
European 30/360
For example, you have been issued with a bond that comes to maturity on August 31st
1998, the settlement date is July 15th 1997, the coupon payments are quarterly, and the
day count basis is actual/actual. Using the formula
COUPDAYS(35625, 36037, 4, 1)
returns 92 as the number of days in the coupon period in which the settlement date
occurs.
497 Function reference
COUPDAYSNC(settlement, maturity, frequency, basis)
The COUPDAYSNC function calculates the number of days from the settlement date to
the next coupon date. The function arguments are:
settlement
maturity
frequency
basis
is the settlement date of the security, expressed as
a date code
is the maturity date of the security, expressed as a
date code
is the number of coupon payments per year (1 =
annually; 2 = biannually; 4 = quarterly)
is the type of day count basis used, where basis is
one of the following:
Basis
Day count basis
0
US 30/360
1
Actual/actual
2
Actual/360
3
Actual/365
4 or omitted
European 30/360
For example, you have been issued with a bond that comes to maturity on August 31st
1998, the settlement date is July 15th 1997, the coupon payments are quarterly, and the
day count basis is actual/actual. Using the formula
COUPDAYSNC(35625, 36037, 4, 1)
returns 47 as the number of days from the settlement date to the next coupon date.
COUPNCD(settlement, maturity, frequency, basis)
The COUPNCD function calculates the next coupon date after the settlement date. The
function arguments are:
settlement
maturity
frequency
basis
is the settlement date of the security, expressed as
a date code
is the maturity date of the security, expressed as a
date code
is the number of coupon payments per year (1 =
annually; 2 = biannually; 4 = quarterly)
is the type of day count basis used, where basis is
one of the following:
Basis
Day count basis
0
US 30/360
1
Actual/actual
2
Actual/360
498 Function reference
3
4 or omitted
Actual/365
European 30/360
For example, you have been issued with a bond that comes to maturity on August 31st
1998, the settlement date is July 15th 1997, the coupon payments are quarterly, and the
day count basis is actual/actual. Using the formula
COUPNCD(35625, 36037, 4, 1)
returns August 31st 1997 or 35672 as the next coupon date after the settlement date.
COUPNUM(settlement, maturity, frequency, basis)
The COUPNUM function calculates the number of coupons payable between the
settlement date and the maturity date. The function arguments are:
settlement
maturity
frequency
basis
is the settlement date of the security, expressed as
a date code
is the maturity date of the security, expressed as a
date code
is the number of coupon payments per year (1 =
annually; 2 = biannually; 4 = quarterly)
is the type of day count basis used, where basis is
one of the following:
Basis
Day count basis
0
US 30/360
1
Actual/actual
2
Actual/360
3
Actual/365
4 or omitted
European 30/360
For example, you have been issued with a bond that comes to maturity on August 31st
1998, the settlement date is July 15th 1997, the coupon payments are quarterly, and the
day count basis is actual/actual. Using the formula
COUPNUM(35625, 36037, 4, 1)
returns 5 as the number of coupons payable between the settlement date and the
maturity date.
COUPPCD(settlement, maturity, frequency, basis)
The COUPPCD function calculates the previous coupon date before the settlement date.
The function arguments are:
settlement
is the settlement date of the security, expressed as
a date code
maturity
frequency
basis
499 Function reference
is the maturity date of the security, expressed as a
date code
is the number of coupon payments per year (1 =
annually; 2 = biannually; 4 = quarterly)
is the type of day count basis to use, where basis is
one of the following:
Basis
Day count basis
0
US 30/360
1
Actual/actual
2
Actual/360
3
Actual/365
4 or omitted
European 30/360
For example, you have been issued with a bond that comes to maturity on August 31st
1998, the settlement date is July 15th 1997, the coupon payments are quarterly, and the
day count basis is actual/actual. Using the formula
COUPPCD(35625, 36037, 4, 1)
returns May 31st 1997 or 35580 as the coupon date before the settlement date.
DB(cost, salvage, life, period, month)
The DB function calculates the depreciation of an asset for a specified period using the
fixed-declining balance method. DB works out a fixed rate which it then uses to calculate
depreciation. The function arguments are:
cost
salvage
life
period
month
is the initial value of the asset
is the value at the end of the depreciation
is the number of years over which the asset
depreciates
is the specified period for which the depreciation is
sought
is the number of months between the purchase date
and the end of the first period (12 if omitted)
For all periods except the first and last, DB calculates the depreciation per period using
the equation:
(cost - total depreciation from previous periods) * rate
where rate is given by:
rate = 1 − (salvage cost )
1
life
For depreciation over the first period DB uses the equation:
500 Function reference
cost * rate * (month/12)
For depreciation over the last period DB uses the equation:
[(cost - total depreciation from previous periods) * rate * (12 - month)] / 12
For example, a new yacht is purchased for $1,000,000. Its active life is 20 years and its
salvage value at the end of this time is $50,000. The purchase was made at the end of
May and the buyer, who attends a boat show at the end of every October, wishes to
know its depreciation over the periods between boat shows for the first 4 shows after the
initial purchase. The first period is of 5 months (from May to October) and the next three
periods are whole years. The depreciation for the first 4 periods is calculated using these
formulas:
DB(1000000, 50000, 20, 1, 5) returns a depreciation of $57,917
DB(1000000, 50000, 20, 2, 5) returns a depreciation of $130,950
DB(1000000, 50000, 20, 3, 5) returns a depreciation of $112,748
DB(1000000, 50000, 20, 4, 5) returns a depreciation of $97,076
Note: A 20-year span contains at most 21 periods, and therefore setting period to greater
than 21 will result in DB returning a #VALUE error message.
DISC(settlement, maturity, par, redemption, basis)
The DISC function calculates the discount rate for a security. The function arguments
are:
settlement
maturity
par
redemption
basis
is the settlement date of the security, expressed
as a date code
is the maturity date of the security, expressed as a
date code
is the price of the security per $100 face value
is the amount received at maturity per $100 face
value
is the type of day count basis to use, where basis
is one of the following:
Basis
Day count basis
0
US 30/360
1
Actual/actual
2
Actual/360
3
Actual/365
4 or omitted
European 30/360
DISC is calculated using the formula:
[(redemption - par)/redemption] * B/DSM
501 Function reference
where B is the number of days in a year according to the basis used and DSM is the
number of days between settlement and maturity.
For example, you have been issued with a bond that comes to maturity on August 31st
1998, the settlement date is July 15th 1997, the price of the security is $95 per $100 face
value, the redemption value is $100, and the day count basis is actual/actual. Using the
formula
DISC(35625, 36037, 95, 100, 1)
returns a bond discount rate of 4.429 %.
DOLLARDE(fractional_dollar, fraction)
The DOLLARDE function converts a dollar price expressed as a fraction, into a dollar
price expressed as a decimal number.
For example, if a dollar value is expressed in 1/16ths of a dollar, the value 7/16 is entered
as 0.07 in fractional_dollar and the integer 16 is entered in fraction, the formula:
DOLLARDE(0.07, 16)
returns 0.438. If the fraction is greater than 1/10th only one place is needed after the
point.
For example, 3/8ths of a dollar is entered using the formula:
DOLLARDE(0.3, 8)
which returns 0.375.
EFFECT(nominal_rate, npery)
The EFFECT function calculates the effective annual interest rate. This uses the given
nominal annual interest rate, nominal_rate, and the number of periods per year where
compound interest is applied, npery. EFFECT uses the formula:
(1 + (nominal_rate
npery ))npery − 1
For example, the formula:
EFFECT(7 %, 4)
returns an effective annual interest rate of 7.19% or 0.0719, which is the overall interest
rate over a year when the interest has been calculated quarterly at 7/4% and
compounded.
EFFECT is the inverse of NOMINAL (see NOMINAL on page 504).
502 Function reference
FV(payment, rate, periods)
The FV function calculates the future value of an annuity, based on the payments per
period, interest rate per period, and the number of periods for which you want the value
calculated. The formula used is:
(
)
payment * (1 + rate )periods − 1 rate
Example 1: The future value of an annuity with annual $500 payments at an interest rate
of 13.5% per annum, compounded over five years, is calculated using the formula:
FV(500, 13.5%, 5)
Ability calculates the future value and displays 3272.44 or $3,272.44 (depending on the
currency formatting of the cell – use the Number command from the Format menu to
change it).
Example 2: Each month you deposit $50 at a bank. Interest accrues at an annual rate of
13.5% but is applied monthly. To calculate the value of the account after six months, use
FV in conjunction with NOMINAL (see NOMINAL on page 504) as follows:
FV(50, NOMINAL(13.5%, 12)/12, 6)
This returns a value of $308.07.
INTRATE(settlement, maturity, investment, redemption, basis)
The INTRATE function calculates the interest rate for a fully invested security. The
function arguments are:
settlement
maturity
investment
redemption
basis
is the settlement date of the security, expressed
as a date code
is the maturity date of the security, expressed as a
date code
is the amount invested in the security
is the amount received at maturity
is the type of day count basis used, where basis is
one of the following:
Basis
Day count basis
0
US 30/360
1
Actual/actual
2
Actual/360
3
Actual/365
4 or omitted
European 30/360
INTRATE is calculated using the formula:
503 Function reference
[(redemption - investment)/investment] * B/DIM
where B is the number of days in a year according to the basis used and DIM is the
number of days from settlement to maturity.
For example, you have been issued with a bond that comes to maturity on August 31st
1998, the settlement date is July 15th 1997, the amount invested in the security is
$10,000, the redemption value is $10,100, and the day count basis is actual/actual. Using
the formula
INTRATE(35625, 36037, 10000, 10450, 1)
returns an interest rate of 3.98665% for a fully invested security.
IRR(guess, initial, list)
The IRR function calculates the internal rate of return of a series of cash flows, starting
with a guess at the correct answer. The internal rate of return is the effective interest rate
such that the net present value of the cash flow is zero. This function is the inverse of the
net present value function.
You should enter the initial cash flow, initial, as a negative number to indicate that it is
money received, rather than money paid out.
For example, to find the internal rate of return of a series of cash flows that start with a
negative flow of $800, followed by payments of $400, $400, $200, and $100 at even
intervals, use the following formula:
IRR(0.15, -800, {400, 400, 200, 100})
Ability calculates the interest rate per period and displays 0.18 or 17.9652% (depending
on the percent formatting of the cell – use the Number command from the Format menu
to change it).
In this example, the result shows that if you borrow $800 and make annual payments of
$400, $400, $200 and $100, the underlying interest rate charged to you would be
17.9652%.
MIRR(finance_rate, reinvest_rate, list)
The MIRR function calculates a modified internal rate of return where positive cashflows
earn interest at a reinvest_rate and negative cash flows are financed at a finance_rate.
The cashflows are contained in list and will usually begin with a negative figure,
indicating that you start with a loan.
MIRR is calculated as follows:
504 Function reference
⎡
⎢
⎢
⎣
∑
1
(+ ve cashflows) + net interest ⎤ n−1
⎥
−1
⎥
(-ve cashflows)
⎦
∑
where net interest is the return on the reinvested positive cash flows, less the interest
accrued on the negative cash flows.
For example, suppose you were loaned $1000.00 to invest in a business venture and you
pay interest on this loan at 15%. You predict that at the end of each of the first four years
the business will generate the following cash flow: $500, $700, $700, $900. Further
suppose that you reinvest the earnings at a fixed rate of 10% and this will compound over
the four years.
At the end of the first year, you’ll receive $500, which will be reinvested but you’ll also
have to take into account the interest on the loan, which will be $150 at this time. Over
the years, net interest will accumulate as follows:
Period (n) Cash flow Interest1 Interest2 Interest3 Interest4
1
2
3
4
5
-1000
500
700
700
900
-150.00
-172.50
50.00
-198.36
55.00
70.00
-228.13
60.50
77.00
70.00
∑ Interest
-748.99
165.50
147.00
70.00
0.00
-366.49
After four years, the original $1000 has generated earnings of 500+700+700+900=$2800
less net interest of $366.49 = $2433.51. This can be expressed as a rate of return, over
four years, of 143.35% or [(1+ 143.35%)^(1/4) -1] = 24.9% per annum.
The same result can be obtained using the MIRR functions as follows:
MIRR(15%, 10%, -1000, 500, 700, 700, 900)
which Ability calculates as 24.90%.
NOMINAL(effect_rate, npery)
The NOMINAL function calculates the annual nominal interest rate. This uses the given
effective annual interest rate, effect_rate, and the number of periods per year where
compound interest is applied, npery. NOMINAL uses the formula:
(
)
npery * (effect _ rate + 1)1 npery − 1
For example, the bank quotes an annual interest of 7.19% and calculates interest
quarterly, which is then compounded over the year. What is actual interest rate in a given
quarter? Use the formula:
505 Function reference
NOMINAL(7.19%, 4)/4
which returns a rate of 1.75%.
NOMINAL is the inverse of EFFECT (see EFFECT on page 501).
NPV(rate, list)
The NPV function calculates the net present value of a set of future cash flows. Ability
assumes that the first cash flow occurs at the end of the first period, which means the
initial payment is usually not included. (Compare this with the IRR function – see IRR on
page 503)
Ability calculates the net present value according to the following formula:
list 3
list 1
list 2
list n
+
+
+ ... +
1 + rate (1 + rate )2 (1 + rate )3
(1 + rate )n
n is the number of items in the list and listi is the ith element in the list.
In the function, enter rate as the effective interest rate per period. Enter list as the value
of the payments in the order in which they appear, one payment per period. If you enter
list as a range that includes several rows and columns, Ability reads the range from left to
right and top to bottom. If blank cells are in the range, Ability skips them when calculating
the net present value.
For example, to find the net present value of cash flows of $400, $300, $300, and $200
and assuming inflation will run at 13.25%, type the following formula:
NPV(13.25%,400,300,300,200)
Ability calculates the net present value and displays 915.23 or $915.23 (depending on the
currency formatting of the cell – use the Number command from the Format menu to
change it). This shows that the real value of these future payments is much less than the
sum of the payments after inflation has eroded the cash flow.
You can also use NPV with the COMPOUND function (see COMPOUND on page 495) to
calculate the end value of a series of payments, reinvested over a period of time.
Suppose you know that you’ll receive payments of $400, $300, $300, and $200 over the
next four years, and that you’ll reinvest these payments in an account bearing interest of
12% per annum, compounded over the four years. After the four years, how much will be
in the account? This is given using the following formula:
COMPOUND(NPV(13.25%, 400, 300, 300, 200), 13.25%, 4)
Ability calculates the answer as $1505.51.
506 Function reference
PMT(principal, rate, periods)
The PMT function calculates the amount of payment required per period to pay off a loan
or mortgage at the given principal, interest rate per period, and number of periods.
Ability calculates the payment based on the following formula:
principle * rate
1 − (1 + rate )−periods
Often the payment amounts end up as fractional numbers. In such cases, you can
include the ROUND function (see ROUND on page 521) to calculate the payments as
even amounts.
To find the payments required to pay off a $17,000 loan, at 14.25% interest per annum,
over a period of 3 years, use the following formula:
PMT(17000, 14.25%, 3)
Ability calculates the payments and displays 7353.17 or $7,353.17 per year (depending
on the currency formatting of the cell – use the Number command from the Format menu
to change it).
To find the payments required per period when the interest is compounded monthly, use
PMT in conjunction with EFFECT (see EFFECT on page 501) as follows:
PMT(17000, EFFECT(14.25%, 12) / 12, 36)
Ability calculates the monthly payments at $591.13.
PRICE(settlement, maturity, rate, yield, redemption, frequency, basis)
The PRICE function calculates the price per $100 face value of a security that pays
periodic interest. The function arguments are:
settlement
maturity
rate
yield
redemption
frequency
basis
is the settlement date of the security, expressed
as a date code
is the maturity date of the security, expressed as a
date code
is the annual coupon rate of the security
is the annual yield of the security
is the redemption value of the security per $100
face value
is the number of coupon payments per year (1 =
annually; 2 = biannually; 4 = quarterly)
is the type of day count basis used, where basis is
one of the following:
507 Function reference
Basis
0
1
2
3
4 or omitted
Day count basis
US 30/360
Actual/actual
Actual/360
Actual/365
European 30/360
For example, if a bond has settlement date 15/July/1992, maturity date
15/September/1999, annual coupon rate of 6.50%, annual yield of 7.25%, redemption
value of $100, two coupon payments per year, and is calculated according to a year
basis of US 30/360, then use the formula
PRICE(33799, 36417, 6.50%, 7.25%, 100, 2, 0).
This returns a bond price of $95.852.
PRICEDISC(settlement, maturity, discount, redemption, basis)
The PRICEDISC function calculates the price per $100 face value of a discounted
security. The function arguments are:
settlement
maturity
discount
redemption
basis
is the settlement date of the security, expressed
as a date code
is the maturity date of the security, expressed as a
date code
is the discount rate of the security
is the redemption value of the security per $100
face value
is the type of day count basis used, where basis is
one of the following:
Basis
Day count basis
0
US 30/360
1
Actual/actual
2
Actual/360
3
Actual/365
4 or omitted
European 30/360
The formula used is
redemption - (discount * redemption * DSM/B)
in which B is the number of days in a year according to the year basis used and DSM is
the number of days from settlement to maturity.
508 Function reference
For example, if a bond has settlement date 15th July, 1997, maturity date 31st October,
1997, discount rate of 4.9%, and redemption value $100, with a year basis of actual/365,
then the formula
PRICEDISC(35625, 35733, 0.049, 100, 3)
returns a price of $98.55.
PRICEMAT(settlement, maturity, issue, rate, yield, basis)
The PRICEMAT function calculates the price per $100 face value of a security that pays
interest at maturity. The function arguments are:
settlement
maturity
issue
rate
yield
basis
is the settlement date of the security, expressed as
a date code
is the maturity date of the security, expressed as a
date code
is the issue date of the security, expressed as a
date code
is the interest rate of the security at date of issue
is the annual yield of the security
is the type of day count basis used, where basis is
one of the following:
Basis
Day count basis
0
US 30/360
1
Actual/actual
2
Actual/360
3
Actual/365
4 or omitted
European 30/360
The formula used is
[100 + (DIM/B * rate * 100)] / [1 + (DSM/B * yield)] - (A/B * rate * 100)
where
B
DSM
DIM
A
is the number of days in a year according to year
basis used
is the number of days from settlement to maturity
is the number of days from issue to maturity
is the number of days from issue to settlement.
For example, if a bond has settlement date 15th July, 1997, maturity date 31st October,
1997, and issue date 1st October, 1996, with an interest rate of 4.9% at date of issue and
an annual yield of 5.4%, and is calculated according to a 30/360 year basis, then the
formula
509 Function reference
PRICEMAT(35625, 35733, 35338, 0.049, 0.054, 0)
returns a price of $99.79.
PV(payment, rate, periods)
The PV function calculates the present value of an annuity, based on the amount of the
payment, the interest rate per period, and the number of periods. Ability computes
present value using the following formula:
(
payment * 1 − (1 + rate )−periods
rate
)
For example, to find the present value of an annuity with payments of $400, at 12.5%
interest per period, after 4 periods, type:
PV(400,12.5%,4)
Ability calculates the present value and displays 1202.26 or $1,202.26 (depending on the
currency formatting of the cell – use the Number command from the Format menu to
change it).
RECEIVED(settlement, maturity, investment, discount, basis)
The RECEIVED function calculates the amount received at maturity for a fully invested
security. The function arguments are:
settlement
maturity
investment
discount
basis
is the settlement date of the security, expressed
as a date code
is the maturity date of the security, expressed as a
date code
is the amount invested in the security
is the discount rate of the security
is the type of day count basis used, where basis is
one of the following:
Basis
Day count basis
0
US 30/360
1
Actual/actual
2
Actual/360
3
Actual/365
4 or omitted
European 30/360
RECEIVED is calculated using the formula:
investment / [1 - (discount * DIM/B)]
510 Function reference
Where B is the number of days in a year according to the basis used and DIM is the
number of days from issue to maturity.
For example, you have been issued with a bond that comes to maturity on August 31st
1998, the settlement (issue) date is July 15th 1997, the amount invested in the security is
$10,000, the discount rate is 4.2%, and the day count basis is actual/actual. Using the
formula
RECEIVED(35625, 36037, 10000, 0.042, 1)
returns a total amount received at maturity of $10,497.68.
TAXBAND(income, taxrates, taxbands)
The TAXBAND function calculates the total tax payable on a given income subject to a
series of banded tax rates. taxrates and taxbands are both lists and must be of equal
length.
The function is calculated summing the tax rate and band product over the number of
items in each list:
n
∑ [MAX(MIN(income − taxband , taxband
i
i+1
− taxbandi ),0 ) * taxrate i ]
i=1
where n is the number of items in each list and taxband[n+1] is defined as being equal
to income.
Example 1: suppose you earned £28,800 in the tax year ending 1996 and had a tax-free
personal allowance of £3,525. The tax rates for that year were 20% on the first £3,200 of
taxable income, 25% up to £24,300 and 40% on the remainder. You would use the
TAXBAND function to calculate tax due as follows:
TAXBAND(28800, {20%, 25%, 40%}, {3525, 6725, 27825}) = 6305
Note that the personal allowance needs to be added back onto the taxbands in this
example because the supplied figures are net of this amount.
Example 2: suppose you want to subtract tax-free earnings before calculating tax due.
You can use TAXBAND as follows:
TAXBAND(28800-3525, {20%, 25%, 40%}, {0, 3200, 24300}) = 6305
Some governments publish tax bands in this format.
Example 3: suppose a proportion of your income of £28,800 was taxed at source to
contribute towards health care. The tax was at a flat rate of 7.3% on all income over
£6,640 up to a ceiling of £22,880. The tax can be calculated as follows:
TAXBAND(28800, {7.3%, 0%}, {6640, 22880}) = 1185.52
511 Function reference
TBILLPRICE(settlement, maturity, discount)
The TBILLPRICE function calculates the price per $100 face value for a Treasury bill.
The function arguments are:
settlement
maturity
discount
is the settlement date of the Treasury bill,
expressed as a date code
is the maturity date of the Treasury bill, expressed
as a date code
is the discount rate of the Treasury bill
TBILLPRICE is calculated using the formula:
100 * [1 - (discount * DSM/360)]
where DSM is the number of days from the settlement to the maturity date.
The maturity date should not be more than 1 calendar year after the settlement date,
otherwise an error message is returned.
For example, a Treasury bill has settlement date 10th May, 1997 and maturity date 1st
November, 1997. The discount rate is 7%. The formula
TBILLPRICE(35559, 35734, 0.07)
returns a price of $96.60.
TBILLYIELD(settlement, maturity, par)
The TBILLYIELD function calculates the yield for a Treasury bill. The yield is a measure
of the value per dollar spent when the bill reaches maturity, expressed as an annual
interest rate. The function arguments are:
settlement
maturity
par
is the settlement date of the Treasury bill,
expressed as a date code
is the maturity date of the Treasury bill, expressed
as a date code
is the price per $100 face value of the Treasury
bill
TBILLYIELD is calculated using the formula:
[(100 - par)/par] * 360/DSM]
where DSM is the number of days from the settlement to the maturity date.
The maturity date should not be more than 1 calendar year after the settlement date,
otherwise an error message is returned.
512 Function reference
For example, a Treasury bill has settlement date 10th May, 1997 and maturity date 1st
November, 1997. The price per $100 of the Treasury bill is $95.75. The formula
TBILLYIELD(35559, 35734, 95.75)
returns a yield of 9.13%.
Logical functions
You can use the built-in logical functions to test for specific conditions in a calculation.
Logical functions generally either return an answer of TRUE or FALSE or are based on a
condition that evaluates to TRUE or FALSE. The value FALSE equates to zero and
TRUE as 1 (or anything non-zero).
Here is a list of logical functions in Ability:
AND on page 512
IF on page 512
NOT on page 513
OR on page 513
AND(list of logical conditions)
The AND function returns the logical AND of its arguments. The arguments must be
logical conditions that can take the value TRUE or FALSE.
Examples
AND(TRUE, TRUE)
AND(TRUE, FALSE)
AND(6 < 10, 40 > 20)
returns TRUE
returns FALSE
returns TRUE
IF(x, true, false)
The IF function calculates x and evaluates it. If x is TRUE (or not zero), the true value is
displayed; if x is FALSE (or zero), the false value is displayed.
For example:
IF(m > n, m, n)
returns the larger value of m and n.
You can use logical and relational operators in an IF function. For example:
513 Function reference
IF (A2 > 5 & A2 < 7, "A2 is OK", "A2 is not OK")
If the value in the cell A2 is greater than 5 and less than 7, Ability displays the true value
"A2 is OK"; otherwise Ability displays the false value "A2 is not OK".
NOT(logical)
The NOT function returns the logical NOT of its argument. The argument should have a
logical value of TRUE or FALSE, which NOT then negates to give the opposite value.
For example:
NOT(TRUE)
NOT(2+2=5)
returns FALSE
returns TRUE
OR(list of logical conditions)
The OR function returns the logical OR of its arguments. The arguments must be logical
conditions that can take the value TRUE or FALSE.
For example:
OR(FALSE, FALSE)
OR(TRUE, FALSE)
OR(2*3 < 7, 100 = 10)
returns FALSE
returns TRUE
returns TRUE
Mathematical functions
You use the built-in mathematical functions to perform arithmetic and other calculations.
With these functions you can also work with angles, logarithms and factorials.
Here is a complete list of mathematical functions in Ability:
ABS on page 514
ACOSH on page 515
ACOTANH on page 515
ASINH on page 515
ATANH on page 515
COSH on page 515
COTANH on page 515
DIVIDE on page 515
EVEN on page 515
EXP on page 516
FACT on page 516
FACTDOUBLE on page 517
GCD on page 517
INT on page 517
514 Function reference
LCM on page 517
LN on page 518
LOG on page 518
LOG10 on page 518
MDETERM on page 518
MINUS on page 519
MOD on page 519
MULTINOMIAL on page 519
ODD on page 520
PLUS on page 520
POWER on page 520
RAND on page 520
RANDBETWEEN on page 521
ROUND on page 521
ROUNDDOWN on page 521
ROUNDUP on page 522
SERIESSUM on page 522
SIGN on page 523
SINH on page 523
SQR on page 523
SQRT on page 523
SUM on page 524
SUMIF on page 524
SUMSQ on page 524
SUMTIMES on page 524
SUMX2MY2 on page 525
SUMX2PY2 on page 525
SUMXMY2 on page 525
SUMXPY2 on page 526
TANH on page 526
TIMES on page 526
TOTAL on page 526
ABS(x)
The ABS function calculates the absolute value (i.e. it removes the negation sign, if
present) of a single number, x. You can also enter x as a single cell address or cell
name.
For example:
ABS(31)
ABS(-31)
ABS(B6)
returns 31
returns 31
returns positive value of the cell
B6
515 Function reference
ACOSH(x)
The ACOSH function calculates the inverse hyperbolic cosine of a number. Number must
be greater than or equal to 1.
ACOTANH(x)
The ACOTANH function calculates the inverse hyperbolic cotangent of a number.
ASINH(x)
The ASINH function calculates the inverse hyperbolic sine of a number.
ATANH(x)
The ATANH function calculates the inverse hyperbolic tangent of a number. Number
must be between -1 and 1 ( excluding -1 and 1).
COSH(x)
The COSH function calculates the hyperbolic cosine of a number, using the formula:
COSH(x) = (EXP(x) + EXP(-x)) / 2
COTANH(x)
The COTANH function calculates the hyperbolic cotangent of a number.
DIVIDE(list)
The DIVIDE function calculates the division of its arguments.
For example:
DIVIDE(10, 2, 4)
returns the value 1.25, having divided 10 by 2, and the result of this by 4. The list can
also be a range in a spreadsheet, as folllows:
DIVIDE(A1..A10).
EVEN(x)
The EVEN function rounds a number up to the nearest even integer. The number will be
rounded up away from 0, whether it is + or -.
For example:
516 Function reference
EVEN(3)
EVEN(-3)
returns 4
returns -4.
EXP(x)
The EXP function calculates the value of e to the power x, according to the following:
ex
where e is the base of the natural logarithms and is approximately equal to 2.718282.
FACT(n)
The FACT function calculates the factorial of a number n where n is traditionally a
positive integer. The factorial of n is defined as:
n * (n-1) * (n-2) *…….* 4 * 3 * 2 * 1
with the factorial of n = 0 being defined as 1.
For example:
FACT(4)
returns 24 as calculated by 4 * 3 * 2 * 1.
FACT can be used to determine the probability of ordered events. For example, the
probability of drawing 6 balls, numbered 1 through 6, in the precise sequence 1, 2, 3, 4,
5, 6 is given by the formula:
1/FACT(6)
which returns 0.001389.
FACT can be used with numbers having a fractional part. The factorial of x where x is not
an integer, is calculated using the formula:
x * (x - 1) * (x - 2) *…..* (x - n)
where 2 > (x - n) > 1.
The factorial of any number 0 < x < 1 is defined as 1. For example:
FACT(0.5)
returns 1
FACT(1.5)
returns 1.5
FACT(3.5)
returns 3.5 * 2.5 * 1.5 = 13.125
Factorial functions do not work with negative numbers, so if you enter a negative number
Ability displays #VALUE in the cell.
517 Function reference
Factorial calculations can create very large numbers. The factorial of any number bigger
than 170 will cause overflow errors and #VALUE will be returned.
FACTDOUBLE(n)
The FACTDOUBLE function calculates the double factorial of a number n. It takes into
account whether n is even or odd, and then carries out a factorial calculation using either
the even or the odd numbers up to n.
For example:
FACTDOUBLE(5)
returns 15, that is 5 * 3 * 1.
FACTDOUBLE(6)
returns 48, that is 6 * 4 * 2.
FACTDOUBLE also works with fractional numbers (see FACT on page 516). For
example:
FACTDOUBLE(5.5)
returns 28.875, that is 5.5 * 3.5 * 1.5.
FACTDOUBLE(6.5)
returns 73.125, that is 6.5 x 4.5 x 2.5.
GCD(list)
The GCD function calculates the greatest common divisor of a list of integers. The
greatest common divisor is the largest integer that exactly divides all the integers in a list.
For example:
GCD(24, 36)
returns 12
GCD(24, 36, 72)
returns 12
GCD(2, 7, 9)
returns 1
INT(x)
The INT function returns the integer part of the value x.
For example:
INT(3.12543)
returns 3.
LCM(list)
The LCM function calculates the least common multiple of a list of numbers.
For example:
518 Function reference
LCM(3,7,21)
returns 21, which is the smallest number that is a common multiple of 3, 7 and 21.
LN(x)
The LN function calculates the natural logarithm of the number x, for any positive
number. Natural logarithms are based on the constant e, which is approximately
2.718281828.
Note that LN is the inverse of the EXP function (see EXP on page 516).
LOG(x, b)
The LOG function calculates the logarithm of the positive number x to a specified base b.
If b is omitted, LOG uses 10 instead.
For example:
LOG(8, 2)
returns the value 3, since 2 raised to the power 3 is 8.
LOG(1e6)
returns 6, since 10 raised to the power 6 is 1,000,000 i.e. 1E6.
LOG10(x)
The LOG10 function calculates the logarithm of the number x to base 10, for any positive
number.
For example:
LOG(80)
returns 1.9031 since 10 raised to the power 1.9031 is approximately 80.
MDETERM(array)
The MDETERM function calculates the matrix determinant of an array. Array must be
numeric, have an equal number of rows and columns, and not contain any empty cells. If
these conditions are not met MDETERM will return a #VALUE error message. Array can
be given as numeric constants, for example
MDETERM({3,7,9; 1,7,2; 4,3,2})
or call upon a range of cells containing numeric values:
519 Function reference
MDETERM(A1..C3)
MDETERM can be used to solve systems of linear equations. For example, the system of
linear equations
2x -y + 2z = 2
x + 10y - 3z = 5
-x + y + z = -3
can be arranged so that the coefficients appear in the cell range A1..D3 as follows:
row/c
ol
1
2
3
A
B
2
1
-1
C
-1
10
-1
D
2
-3
1
2
5
-3
The system of equations can then be solved using the following formulas:
x is given by =MDETERM({2, 5, -3; -1, 10, 1; 2, -3, 1}) / MDETERM(A1..C3) = 2
y is given by =MDETERM({2, 1, -1; 2, 5, -3; 2, -3, 1}) / MDETERM(A1..C3) = 0
z is given by =MDETERM({2, 1, -1; -1, 10, 1; 2, 5, -3}) / MDETERM(A1..C3) = -1
MINUS(list)
The MINUS function calculates a successive subtraction from the first item of list, all
other items of list.
For example:
MINUS(10, 3, 4) returns 3, that is 10 - 3 - 4
MINUS(10, 3, -4) returns 11, that is 10 - 3 - (-4)
MOD(x, y)
The MOD function calculates the remainder of x divided by y according to the following
formula:
MOD(x, y) = x - (y * INT(x / y))
You can calculate the fractional part of a number x using:
MOD(x,1)
MULTINOMIAL(list)
The MULTINOMIAL function calculates the multinomial of a list of numbers. The function
is calculated using according to the following:
520 Function reference
MULTINOMIAL (a, b, c) = FACT(a + b +c) / [FACT(a)*FACT(b)*FACT(c)]
For example:
MULTINOMIAL(1, 2, 3)
returns 60.
ODD(x)
The ODD function rounds a number up to the nearest odd integer.
For example:
ODD(4)
returns 5
ODD(1.5)
returns 3
ODD(-2)
returns –3
PLUS(list)
The PLUS function calculates the sum of its arguments.
For example:
PLUS(3, 4, 6)
returns 13, that is 3+4+6
PLUS(3, 4, -6)
returns 1, that is 3+4+(-6)
POWER(list)
The POWER function calculates the result of a number raised to a power. The first
argument place in the list contains the number and any places after this contain the
power or powers.
For example:
POWER(2, 3)
returns 8, that is 2^3
POWER(2, 3, 2)
returns 64, that is (2^3)^2
RAND(x)
The RAND function generates a random number from 0 to x (including 0 but excluding x).
Each time you enter a RAND function, Ability displays a new random number.
For example:
RAND(100)
521 Function reference
generates a number from 0 to 100 (excluding 100).
Note that in Spreadsheet, you can recalculate RAND using the Calculate Now command
from the Tools menu.
RANDBETWEEN(bottom, top)
The RANDBETWEEN function calculates a random number between the numbers you
specify as function arguments. Each time you enter a RANDBETWEEN function, Ability
displays a new random number.
For example,
RANDBETWEEN(100, 200)
generates a number from 100 to 200 (excluding 200).
Note that in Spreadsheet, you can recalculate RANDBETWEEN using the Calculate Now
command from the Tools menu.
ROUND(x, y)
The ROUND function calculates the value of x rounded to the nearest y.
For example:
ROUND(2.8234, 1)
returns 3 (round to nearest whole number)
ROUND(2.8234, 0.01)
returns 2.82 (round to nearest hundredth)
ROUND(2678, 100)
returns 2700 (round to nearest hundred)
ROUNDDOWN(number, num_digits)
The ROUNDDOWN function rounds a number down, that is towards 0. num_digits is a
positive or negative integer which specifies the number of digits to which you want to
round down. num_digit set to a positive integer will round down to the right of the
decimal point (the fractional part); set to a negative integer will round down to the left of
the decimal point (the whole number part).
For example:
ROUNDDOWN(2.8234, 1)
returns 2.8
ROUNDDOWN(2.8234, 0)
returns 2
ROUNDDOWN(2678, -2)
returns 2600
522 Function reference
ROUNDUP(number, num_digits)
The ROUNDUP function rounds a number up, away from 0. num_digits is a positive or
negative integer which specifies the number of digits to which you want to round up.
num_digit set to a positive integer will round up to the right of the decimal point (the
fractional part); set to a negative integer will round up to the left of the decimal point (the
whole number part).
For example:
ROUNDUP(2.8234, 1)
returns 2.9
ROUNDUP(2.8234, 0)
returns 3
ROUNDUP(2678, -2)
returns 2700
SERIESSUM(x, n, m, coefficients)
The SERIESSUM function calculates the sum of a power series:
a 1x n + a 2 x n+m + a 3 x n+ 2m + .... + a j x n+ ( j−1)m
where coefficients is the list denoted by a1, a2, a3 …. aj.
Power series expansions are useful in approximating many functions. The function
arguments are:
is a variable that contains the input value to
x
the power series
is the initial power to which x is to be raised
n
is the step by which n is to be increased for
m
each term of the series
is a set of coefficients by which the
coefficients
successive powers of x are to be multiplied.
The number of coefficients determines the
number of terms in the power series.
For example, a power series can be used to approximate the function SIN(x). The power
series expansion for SIN(x) is:
x - (x^3)/3! + (x^5)/5! - (x^7)/7! + ….
The sequence of coefficients 1, -1/3!, 1/5!, -1/7! ….. can be written as
(-1)^0, ((-1)^1)/(m + n)!, ((-1)^2)/(2m + n)!, ((-1)^3)/(3m + n)! ….. where n = 1 and m =2.
Thus to calculate sin(45°) or, in radians, sin(π/4), set n = 1, m = 2, x = π/4, and put the
coefficients that are to be used in a range. In a spreadsheet, if B1..B5 contain the first 5
523 Function reference
coefficients (i.e. 1, -1/FACT(3), 1/FACT(5), -1/FACT(7), 1/FACT(9)), then the following
formula can be used to approximate the sine function:
SERIESSUM(PI()/4, 1, 2, B1..B5)
which returns 0.707107.
The accuracy of the approximation depends, of course, on how many coefficients are
used. The greatest accuracy possible is attained when the number of coefficients used is
infinite! Note that computational modeling of mathematical functions such as sine and
cosine is ultimately achieved by using power series expansions.
SIGN(x)
The SIGN function returns the sign of a number, according to the following convention: 1
stands for x is positive; 0 stands for x is zero; -1 stands for x is negative.
For example:
SIGN(20 - 20)
returns 0
SIGN(-87)
returns -1
SIGN(20)
returns 1
SINH(x)
The SINH function calculates the hyperbolic sine of a number x, using the formula:
SINH(x) = (EXP(x) - EXP(-x)) / 2
SQR(x)
The SQR function calculates the square of a number x.
For example,
SQR(5)
returns 25, that is 5 raised to the power 2.
SQRT(x)
The SQRT function calculates the square root of x. The value x must be equal to or
greater than zero. If it is not, #VALUE is displayed.
524 Function reference
SUM(list)
The SUM function calculates the total of the values in the list. The list can be numbers,
cell addresses, ranges, and cell names. The SUM function is the same as the TOTAL
function (see TOTAL on page 526).
Here are some examples:
SUM(12, 255, 10)
SUM(A5..C9)
SUM(Sales, C2, Expenses, Equip)
SUMIF(list, condition)
Conditionally sums values in the list. For example:
SUMIF(A1..A10, “<100”)
adds up all the values less than 100 in the range A1..A10. Note that the condition must
be surrounded by quotes if it contains non-numeric characters.
More examples:
Formula
Returns
SUMIF({5, 4, 5, 3, 5}, “>=4”)
19
SUMIF({5, 4, 5, 3, 5}, 5)
15
SUMSQ(list)
The SUMSQ function calculates the sum of the squares of a list of numbers.
For example
SUMSQ(3, -2, 2)
returns 17, that is 3^2 + (-2)^2 + 2^2.
SUMTIMES(range1, range2, range3…)
The SUMTIMES function calculates the sum of the products of corresponding values
from two or more arrays.
The array arguments must have the same dimensions or the error message #VALUE will
be returned. Non-numeric values will be counted as 0. The array components can be
entered as a range.
525 Function reference
For example:
SUMTIMES({1,2,3}, {2,3,4})
returns 20, that is 1*2 + 2*3 + 3 * 4
SUMTIMES({1,2},{3,4}, {5,6})
returns 63, that is 1*3*5 + 2*4*6
SUMTIMES({2,3; 4,6}, {7,5; 4,9})
returns 99, that is 2*7 + 3*5 + 4*4 + 6*9
SUMTIMES(A1..B2, D1..E2)
returns A1*D1 + B1*E1 + A2*D2 + B2*E2
SUMX2MY2(range_x, range_y)
The SUMX2MY2 function calculates the sum of the differences of squares of
corresponding values in two arrays, according to the formula:
∑ (x
2
− y2 )
The number of values in both arrays must be the same
For example:
SUMX2MY2({4,5,6}, {7,4,3})
returns 3, that is (4^2 - 7^2) + (5^2 - 4^2) +(6^2 - 3^2)
SUMX2PY2(range_x, range_y)
The SUMX2PY2 function calculates the sum of the sum of squares of corresponding
values in two arrays, according to the formula:
∑ (x
2
+ y2 )
The number of values in both arrays must be the same
For example:
SUMX2PY2({4,5,6}, {7,4,3})
returns 151, that is (4^2 + 7^2) + (5^2 + 4^2) + (6^2 + 3^2).
SUMXMY2(range_x, range_y)
The SUMXMY2 function calculates the sum of squares of differences of corresponding
values in two arrays, according to the formula:
∑ ( x − y)
2
526 Function reference
The number of values in both arrays must be the same
For example:
SUMXMY2({4,5,6}, {7,4,3})
returns 19, that is (4 - 7)^2 + (5 - 4)^2 + (6 - 3)^2.
SUMXPY2(range_x, range_y)
The SUMXPY2 function calculates the sum of squares of sum of corresponding values in
two arrays, according to the formula:
∑ (x + y)
2
The number of values in both arrays must be the same.
For example:
SUMXPY2({4,5,6}, {7,4,3})
returns 283, that is (4 + 7)^2 + (5 + 4)^2 + (6 + 3)^2.
TANH(x)
The TANH function calculates the hyperbolic tangent of a number x, calculated as
follows:
TANH(x) = SINH(x) / COSH(x)
TIMES(list)
The TIMES function calculates the product of a list of numbers.
For example:
TIMES(4, 5, 6)
returns 120, that is 4*5*6.
TOTAL(list)
The TOTAL function calculates the total of the list. The list can be numbers, cell
addresses, ranges, and cell names. This function is the same as the SUM function (see
SUM on page 524).
527 Function reference
Trigonometric functions
You use the trigonometric functions to solve standard problems in trigonometry, such as
computing the cosine of a given angle.
Note that all angles must be supplied in radians, where pi/2 radians = 90 degrees, and all
answers will be given in radians. To convert radians to degrees and degrees to radians
use the DEGREES and RADIANS functions respectively.
Here is a complete list of trigonometric functions in Ability:
ACOS on page 527
ACOTAN on page 527
ASIN on page 527
ATAN on page 527
ATAN2 on page 528
COS on page 528
COTAN on page 528
DEGREES on page 528
PI
RADIANS on page 528
SIN on page 528
SQRTPI on page 528
TAN on page 528
ACOS(x)
The ACOS function calculates the inverse cosine of the number x. The result is given in
radians.
ACOTAN(x)
The COTAN function calculates the two-quadrant inverse cotangent of the number x. The
result is given in radians.
ASIN(x)
The ASIN function calculates the inverse sine of the number x. The result is given in
radians.
ATAN(x)
The ATAN function calculates the two-quadrant inverse tangent of the number x. The
result is given in radians.
528 Function reference
ATAN2(x, y)
The ATAN2 function calculates the four-quadrant determination of the angle formed by
the point (x, y) and the x-axis. The result is given in radians.
COS(x)
The COS function calculates the cosine of the number x, where x is an angle given in
radians.
COTAN(x)
The COTAN function calculates the cotangent of the number x, where x is an angle given
in radians.
DEGREES(angle)
The DEGREES function converts an angle expressed in radians to degrees.
PI()
The PI function always returns the universal constant π or 3.14159265359 approximately.
RADIANS(angle)
The RADIANS function converts an angle expressed in degrees to radians.
SIN(x)
The SIN function calculates the sine of x, where x is an angle given in radians.
SQRTPI(x)
The SQRTPI function calculates the square root of a number x multiplied by π, according
to the formula:
x * PI()
TAN(x)
The TAN function calculates the tangent of x, where x is an angle given in radians.
529 Function reference
Lookup functions
The built-in functions listed in this section are known as the Lookup Functions. You use
these functions to search for the location of specific information. These functions are
most useful if you are working with tax tables or other kinds of spreadsheet tables that
you want to use for looking up and referring to information.
Here is a complete list of lookup functions in Ability:
ADDRESS on page 529
AREAS on page 530
CHOOSE on page 530
COLUMN on page 530
COLUMNS on page 531
FIND on page 531
FINDEX on page 531
INDEX on page 532
INDIRECT on page 532
LOOKUP on page 533
LOOKUPEX on page 533
ROW on page 533
ROWS on page 534
ADDRESS(row_number, column_number, abs_mode)
The ADDRESS function calculates the location of a reference to a single cell and returns
the location as text.
The row and column numbers determine the address and the mode number determines
the mode. In Spreadsheet, for example, the row number will specify the row number of
the spreadsheet, the column number will specify the column letter, and the mode number
will specify whether the reference address is absolute or relative, according to the
following key:
abs_mode
1
2
3
4 or omitted
Reference
Absolute
Absolute row, relative column
Relative row, absolute column
Relative
For example:
ADDRESS(1,1,1)
returns $A$1
ADDRESS(10,5,3)
returns $E10
ADDRESS(100,200)
returns GR100
530 Function reference
AREAS(list)
The AREAS function calculates the number of areas in a reference or list of references.
An area is a range of cells that are contiguous, including a single cell.
For example:
AREAS(A1..D3, E10)
returns 2.
CHOOSE(index_num, list)
The CHOOSE function chooses a value from a list of values. index_num is the position
of the value in list. The arguments of list can be numbers, formulas, text, cell references
or ranges.
For example:
CHOOSE(3, "Sales", "Profit", "Cost")
returns "Cost".
CHOOSE can also return a range which can be use in conjunction with other functions.
For example:
SUM(CHOOSE(2, A1..A3, B1..B3, C1..C3))
returns the result of SUM(B1..B3).
COLUMN(ref)
The COLUMN function returns the column number of ref according to the following:
ref
cell
range
omitted
returns
column number
number of leftmost column in a
range
current column number
For example:
COLUMN(Z100)
COLUMN(D5..G10)
COLUMN(mycell)
returns 26
returns 4
returns the column number of a
named cell, mycell, or the
leftmost column within mycell if it
is a range.
531 Function reference
COLUMN( )
returns 5 if the function is
entered in any cell in column E
COLUMNS(array)
The COLUMNS function returns the number of columns in a reference or array.
For example:
COLUMNS(F1..H10)
returns 3
COLUMNS({1, 2; 9, 8})
returns 2
If you have created a named range called myarea that refers to the range A1..D4, then
COLUMNS(myarea)
returns 4.
FIND(value, list)
The FIND function searches the list to find where the largest item that is less than or
equal to value occurs in the list. The list can contain numbers, text, cell addresses,
ranges, and cell names.
The list must be sorted in ascending order (as contrasted with the FINDEX function – see
FINDEX on page 531).
For example,
FIND(19, 1, 15, 20, 30, 35, 40)
returns 2, the second position in the list, as 15 is the last value in the list that is less than
or equal to the test value.
If the list you want to search is a range that contains several rows and several columns,
Ability searches the range from left to right and top to bottom.
The FIND function is similar to the LOOKUP function (see LOOKUP on page 533),
except that LOOKUP returns an actual value, rather than the position of the value in a
list.
The INDEX function (see INDEX on page 532) is also similar to the FIND function, except
that with INDEX you enter the position rather than a test value in a list.
FINDEX(value, list)
The FINDEX function searches the list and returns the position of value in the list. If list
does not contain value, #VALUE is returned.
532 Function reference
The list can contain numbers, text, cell addresses, ranges, and cell names. The list can
be in any order (which contrasts with FIND on page 531).
For example,
FINDEX(15, 18, 15, 10, 3, 35, 12)
returns 2, the second position in the list.
If the list you want to search is a range that contains several rows and several columns,
Ability searches the range from left to right and top to bottom.
The FINDEX function is similar to the LOOKUP function (see LOOKUPEX on page 533),
except that LOOKUPEX returns an actual value, rather than the position of the value in a
list.
The INDEX function (see INDEX on page 532) is also similar to the FINDEX function,
except that with INDEX you enter the position rather than a test value in a list.
INDEX(number, list)
The INDEX function returns the value in a list that is in the position given by number.
The list can be numbers, text, cell addresses, ranges, and cell names. Ability searches
the list and returns the value that occurs in the specified position.
For example,
INDEX(2, 1, 15, 20, 30, 35, 40)
returns 15, which is in the second position in the list.
INDIRECT(ref_as_text, mode)
INDIRECT allows a text reference to be turned into a cell reference. For example:
INDIRECT("B10")
Returns the contents of cell B10 in the same way as a direct reference would (i.e. typing
B10 into a formula).
The INDIRECT funtion is more useful when used with cell references. For example,
consider the formula = INDIRECT(A1) / 100 in a cell, say C1. A1 contains the text A5 and
the range A5..A10 contains numbers. The sum displayed in cell D1 can now be controlled
by entering a different any of "A5", "A6", "A7"...."A10" in cell A1, as shown below:
{bmc spIndirect.bmp}
533 Function reference
Mode is optional and can be set to true or false to switch between A1 style notation and
R1C1 style notation. For example, the following will all return the contents of cell B10:
INDIRECT("B10")
INDIRECT("B10", TRUE)
INDIRECT("R10C2", FALSE)
LOOKUP(value, in_range, out_range)
The LOOKUP function searches the list in_range, to find the last item that is less than or
equal to value and returns the corresponding item from the list out_range.
The in_range must be sorted into ascending order (use LOOKUPEX on page 533 for
unsorted lists). If it isn’t, Ability may display an unexpected answer. LOOKUP works with
both sorted numbers and text.
For example:
LOOKUP(3, {1, 2, 3, 4, 5}, {10, 20, 30, 40, 50})
returns 30
LOOKUP("red", {"blue", "red", "yellow"}, {3, 2, 1})
returns 2
The LOOKUP function produces the same result as combining INDEX on page 532 and
FIND on page 531 , as follows:
INDEX(FIND(x, in_range), out_range)
LOOKUPEX(value, in_range, out_range)
The LOOKUPEX function searches the list in_range, to find the item that is equal to
value and returns the corresponding item from the list out_range. If the value is not
found, LOOKUPEX returns #VALUE.
The in_range can be in any order (as contrasted with LOOKUP on page 533).
LOOKUPEX works with both numbers and text.
For example:
LOOKUPEX(3, {1, 5, 4, 3, 2}, {10, 20, 30, 40, 50})
returns 40
LOOKUPEX("blue", {"red", "blue", "yellow"}, {3, 2, 1}) returns 2
The LOOKUPEX function produces the same result as combining INDEX on page 532
and FINDEX on page 531 , as follows:
INDEX(FINDEX(x, in_range), out_range)
ROW(ref)
The ROW function returns the row number of ref, according to the following:
534 Function reference
ref
cell
range
omitted
returns
row number
number of topmost row in a
range
current row number
For example:
ROW(Z100)
ROW(D5..G10)
ROW(mycell)
ROW( )
returns 100
returns 5
returns the row number of a
named cell, mycell, or the
topmost row within mycell if it is
a range
returns 5 if the function is
entered in any cell in row 5
ROWS(array)
The ROW function returns the number of rows in a reference or array.
For example:
ROWS(F5..H10)
returns 6
ROWS({1, 2; 9, 8})
returns 2
If you have created a named range called myarea, that refers to the range A1..D4, then:
ROWS(myarea)
returns 5
Information functions
You can use Ability’s built-in information functions to find out if a value is a number, text
or error indicator, and how many blank cells or error indicators there are in a range.
Here is a complete list of information functions in Ability:
COUNTBLANK on page 535
ISBLANK on page 535
ISERR on page 535
ISERROR on page 535
ISEVEN on page 535
ISNUMBER on page 536
ISODD on page 536
ISREF on page 536
ISTEXT on page 536
535 Function reference
COUNTBLANK(list)
The COUNTBLANK function counts the number of blank cells within a specified range.
For example, if A1 is blank, A2 contains a number, and A3 contains an error message,
then the formula
COUNTBLANK(A1..A3)
returns 1.
Note that if a cell contains a formula which returns a blank value (for example,
CONCATENATE(" ")), then Ability does not count the cell itself as blank.
ISBLANK(value)
The ISBLANK function returns TRUE if the value is blank or if the cell referred to is
empty.
Note that if a cell contains a formula that returns a blank value (for example,
CONCATENATE(" ")), then Ability does not count the cell itself as blank.
ISERR(list)
The ISERR function checks the list and returns a count of the number of cells that contain
#CIRC, #FUNC, #DIV0, #VALUE or #REF error indicators (see Cell error indicators on
page 485). The list can be cell addresses, ranges, and cell names.
You can combine the IF function (see IF(x, true, false) on page 512) and the ISERR
function to check for errors and return an error message if something is incorrect. For
example, in a spreadsheet that runs from A1 to E20, you might use the following:
IF(ISERR(A1..E20), "A problem", "No problem")
ISERROR(ref)
The ISERROR function returns TRUE if the field or cell referenced by ref contains any
error message.
ISEVEN(value)
The ISEVEN function returns TRUE if the value is an even number, FALSE for all other
values.
536 Function reference
ISNUMBER(value)
The ISNUMBER function returns TRUE if the value is a number, FALSE for all other
values.
ISODD(value)
The ISODD function returns TRUE if the value is an odd number, FALSE for all other
values.
ISREF(value)
The ISREF function returns TRUE if the value is a reference.
For example,
ISREF(sales)
returns TRUE when sales is the name of a range A1..A10.
ISTEXT(value)
The ISTEXT function returns TRUE if the value is text.
Statistical functions
You can use the built-in statistical functions to perform statistical and other calculations.
With these functions you can automatically find the average, minimum and maximum of a
set of values, calculate the number of permutations, and perform other complex
computations.
Here is a complete list of statistical functions in Ability:
AVEDEV on page 537
AVERAGE on page 538
BINOMDIST on page 538
COMB on page 539
CORREL on page 539
COUNT on page 539
COUNTIF on page 540
COUNTN on page 540
COVAR on page 540
DEVSQ on page 541
EXPONDIST on page 541
FISHER on page 541
FISHERINV on page 542
FORECAST on page 542
537 Function reference
GAMMADIST on page 543
GAMMALN on page 543
GEOMEAN on page 544
HARMEAN on page 544
HYPGEOMDIST on page 544
INTERCEPT on page 545
KURT on page 546
LARGE on page 546
MAX on page 546
MEDIAN on page 547
MIN on page 547
MODE on page 547
NEGBINOMDIST on page 548
NORMDIST on page 548
PEARSON on page 548
PERCENTILE on page 549
PERCENTRANK on page 549
PERM on page 550
POISSON on page 550
PROB on page 551
QUARTILE on page 551
RANK on page 552
RSQ on page 552
SKEW on page 552
SLOPE on page 553
SMALL on page 554
STANDARDIZE on page 554
STD on page 554
STDEVP on page 554
STEYX on page 555
VAR on page 556
VARP on page 556
WAVG on page 556
WEIBULL on page 557
AVEDEV(list)
The AVEDEV function calculates the average deviations of numbers in a list from the
mean value of the list. The formula for average deviation is:
1
n
∑ (ABS(x − AVG(x)))
For example:
AVEDEV(2, 6, 9, 4, 5)
returns 1.84, which is the average deviation from the mean of 5.2.
538 Function reference
AVERAGE(list) or AVG(list)
The AVERAGE function calculates the unweighted average value of one or more values
in a list. The formula used is:
SUM(list)/ n
where n is the number of values in the list. The list can include cell addresses, ranges,
and cell names. This function can be abbreviated to AVG.
For example:
AVERAGE(10, 20, 30)
returns 20.
BINOMDIST(number, trials, probability, cumulative)
The BINOMDIST function is used to calculate the binomial distribution. This is useful in
situations where there is a fixed number of trials, the trials are independent of each
other, the outcome of each trial is either success or failure, and the probability of
success or failure is constant throughout the test.
The arguments of the function represent the following:
number
trials
probability
cumulative
the number of occurrences of success in the
trials
the number of trials to be performed
the probability of success for a single trial
a logical value, which determines the form of the
function:
TRUE calculates the cumulative distribution
function, which gives the probability that there
are at most number successes
FALSE calculates the probability mass function,
which gives the probability that there are exactly
number successes
For example, we want to know the probability of getting 12 heads from 20 flips of a coin.
Each flip of the coin can only give either heads or tails ("success" or "failure"), and the
probability of heads on each flip is constant at 0.5. Therefore, setting cumulative to
FALSE, the formula:
BINOMDIST(12, 20, 0.5, FALSE)
returns the probability 0.12 that we will get exactly 12 successes from 20 trials.
If cumulative is set to TRUE, then the formula:
539 Function reference
BINOMDIST(12, 20, 0.5, TRUE)
returns 0.87, that is the probability that we will get at most 12 heads (12 or less).
COMB(n, m)
The COMB function calculates the number of combinations of n distinct things taken m at
a time using the following formula:
COMB(n, m) = FACT(n) / (FACT(m) * FACT(n - m))
A combination is a selection of one or more things or events without regard to order. This
can be contrasted with a permutation (see PERM on page 550), where order does
matter.
For example, the chances of correctly selecting six numbers drawn from 49 in a lottery is
given by:
COMB(49, 6)
which returns 13,983,816, that is, 1 chance in 13,983,816.
CORREL(array1, array2)
The CORREL function calculates the correlation coefficient between two sets of data.
The function arguments should contain numbers or refer to ranges containing numbers,
and should have matching numbers of data points. The correlation coefficient is a
number between -1 and 1. The formula used is:
(n∑ xy − ∑ x ∑ y)
(n∑ x 2 − (∑ x ) 2 )(n∑ y 2 − (∑ y) 2 )
For example, the correlation coefficient between the height (array1) and weight (array2)
of six people, can be calculated using the formula:
CORREL({1.52, 1.75, 1.96, 1.85, 1.55, 1.30}, {170, 167, 210, 182, 154, 100})
This returns a correlation coefficient of 0.918156, which indicates high correlation.
Low correlation tends towards 0, as can be seen when array1 and array2 contain many
data points filled with random numbers.
COUNT(list)
The COUNT function counts the number of items of non-blank entries in list. The list can
contain numbers, cell addresses, ranges, and cell names.
For example:
540 Function reference
COUNT(A1..A10)
returns a count of the number of cells A1 through to A10 that are non-blank.
Note that if a cell contains a formula that returns a blank value (for example
CONCATENATE(" ")), then Ability does not regard the cell itself as blank.
COUNTIF(list, condition)
Counts the the number of cells in a list matching a condition. For example:
COUNTIF(A1..A10, “>5”)
returns a count of the number of cells having a value greater than 5. Note that the
condition should be surrounded by quotes if it contains any non-numeric characters.
More examples:
Formula
Returns
COUNTIF({“Mon”, “Tue”, “Mon”, “Thu”}, “Mon”)
2
COUNTIF({5, 4, 5, 3, 5}, “>=4”)
4
COUNTIF({5, 4, 5, 3, 5}, 5)
3
COUNTN(list)
The COUNTN function counts how many numbers there are in a list of arguments. The
arguments can also be ranges.
For example:
COUNTN(A1..A10)
returns a count of the number of cells A1 through to A10 containing a number, a formula
with a numeric result or a date.
COVAR(array1, array2)
The COVAR function calculates the covariance between two sets of data. This is a
measure of the average of the products of deviation for matching pairs from two arrays.
The function arguments should contain numbers or refer to ranges containing numbers,
and should have a matching number of data points.
541 Function reference
DEVSQ(list)
The DEVSQ function calculates the sum of squares of deviations from the mean of a list
of numbers. The formula used is:
∑ (x − AVG(x))
2
For example:
DEVSQ(9, 4, 8, 1, 14)
returns 98.8.
EXPONDIST(x, lambda, cumulative)
The EXPONDIST function calculates the exponential distribution. x is the input value to
the function; lambda is a distribution parameter; and cumulative is a logical value with
the following effect:
FALSE
the probability density function is
calculated, using the equation:
f (x, λ ) = λ e − λx
TRUE
the cumulative distribution function is
calculated, using the equation:
F(x, λ ) = 1 − e − λx
For example
EXPONDIST(0.3, 9, TRUE)
returns 0.932794
EXPONDIST(0.3, 9, FALSE)
returns 0.604850
FISHER(x)
The FISHER function calculates the Fisher transformation at x.
The formula used is:
f(x) = ½ LN((1 + x)/(1 - x))
for -1 < x < 1.
The transformation can be used to convert a skewed distribution into a more normal one,
provided there is some theoretical support.
For example:
FISHER(0.85)
542 Function reference
returns 1.256153.
FISHERINV(y)
The FISHERINV function calculates the inverse of the Fisher transformation (see
FISHER on page 541), using the formula:
x=
e 2y − 1
e 2y + 1
where y = FISHER(x).
For example,
FISHER(1.256153)
returns 0.85.
FORECAST(x, array_y, array_x)
The FORECAST function returns a prediction of y for a given x after first performing a
linear regression on the data points described by array_y and array_x.
A linear regression produces a "best fit" line through the data points by minimizing the
sum of the (squared horizontal) distances from each data point to the line. FORECAST
then uses this line to predict a y value for the supplied x as follows:
y=
∑ y + ⎛⎜ n∑ xy − ∑ x ∑ y ⎞⎟⎛⎜ x − ∑ x ⎞⎟
⎜ n x 2 − ( x )2 ⎟⎜
n
n ⎟⎠
∑ ⎠⎝
⎝ ∑
which is the same as:
y = INTERCEPT(array_y, array_x) + SLOPE(array_y, array_x)*x
For example, suppose the following y-values were observed for the supplied x-values:
Y
X
4.7
1
6.0 11.2 10.6
2
3
4
8.2
5
7.3 15.8 11.7
6
7
8
A linear regression through these points would look like this:
543 Function reference
You could use FORECAST to predict the y value at x = 10 using the following formula:
FORECAST(10, {4.7, 6, 11.2, 10.6, 8.2, 7.3, 15.8, 11.7}, {1, 2, 3, 4, 5, 6, 7, 8})
which returns the value 14.9.
GAMMADIST(x, alpha, beta)
The GAMMADIST function calculates the gamma distribution. It is used when working
with variables that may have a skewed distribution. x is the value at which the function is
to be evaluated; alpha and beta are parameters to the function. The formula for the
gamma distribution is:
f (x; α, β ) =
x α −1e
−N
β
β Γ(α )
α
and for the standard gamma distribution, that is when β = 1, is:
f (x; α ) =
x α −1e −N
Γ (α )
For example:
GAMMADIST(15, 7, 4)
returns 0.022709.
GAMMALN(x)
The GAMMALN function calculates the natural logarithm of the gamma function, Γ(x)
(see GAMMADIST on page 543).
The formula used is:
GAMMALN = LN(Γ(x))
544 Function reference
GEOMEAN(list)
The GEOMEAN function calculates the geometric mean of a list of numbers.
Each number y of the list should be > 0.
The formula for the geometric mean is:
n
y 1 * y 2 * y 3 * .... * y n
For example:
GEOMEAN(3, 8, 7)
returns 5.5178, that is the 3rd or cubed root of 3*8*7.
HARMEAN(list)
The HARMEAN function calculates the harmonic mean of a list of numbers. This is the
reciprocal of the arithmetic mean of reciprocals.
Each number x of the list should be > 0. The harmonic mean is always less than the
geometric mean, which is always less than the arithmetic mean, for the list of numbers.
The formula for the harmonic mean is:
n
1 + 1 + 1 + .... + 1
x1
x2
x3
xn
where n is the size of the list and x1 ,x2 …. xn are the numbers in the list.
For example,
HARMEAN(10, 5, 4, 7, 8)
returns 6.113537, given by 5/(1/10 + 1/5 + 1/4 + 1/7 + 1/8).
HYPGEOMDIST(sample, n_sample, population, n_population)
The HYPGEOMDIST function calculates the hypergeometric distribution.
This is the measure of the probability of a given number of sample "successes" from a
finite population, without replacement of samples and given the sample size and the
number of population "successes". Each sample is defined as either a "success" or a
"failure"; for example, when flipping a coin, heads might be a success and a tails a
failure.
The arguments of the function represent the following:
sample
n_sample
population
n_population
545 Function reference
the number of successes in the sample,
for which we seek the probability
the size of the sample
the number of successes in the
population
the size of the population
For example, a lucky dip has been organized, with 40 items in total. 35 of these are
worthless trinkets; 5 are diamonds. We wish to know the probability of getting exactly 2
diamonds from a selection of 4 items.
Each diamond counts as a success. There are 40 items in total: this is the n_population.
The size of the sample is 4: this is the n_sample. The number of successes, that is to
say, diamonds, in the total population is 5: this is population. The number of successes
in the sample, for which we seek the probability, is 2: this is the sample.
Applying the formula:
HYPGEOMDIST(2, 4, 5, 40)
returns 0.065106 as the probability.
INTERCEPT(array_y, array_x)
The INTERCEPT function returns the point where a "best fit" line meets the y-axis. This is
calculated by applying a linear regression on the data points in array_x (the independent
or controlled variable) and array_y (the dependent variable).
The formula used for intercept is:
∑ y − ⎛⎜ n∑ xy − ∑ x ∑ y ⎞⎟ ∑ x
⎜ n x 2 − ( x )2 ⎟ n
n
∑ ⎠
⎝ ∑
which is the same as:
AVG(array_y) - SLOPE(array_x, array_y) * AVG(array_x)
For example, suppose the following y-values were observed for the supplied x-values:
4.7 6.0 11.2 10.6 8.2 7.3 15.8 11.7
Y
1
2
3
4
5
6
7
8
X
A linear regression through these points would look like this:
546 Function reference
You calculate where the line crosses the y-axis using:
INTERCEPT({4.7, 6, 11.2, 10.6, 8.2, 7.3, 15.8, 11.7}, {1, 2, 3, 4, 5, 6, 7, 8})
which returns 4.942857.
KURT(list)
The KURT function calculates the kurtosis of a list of numbers.
Kurtosis is used to measure how much data is massed in the center of a distribution
compared to the normal distribution - a relatively flat distribution will have negative
kurtosis and a pointed one a positive kurtosis. KURT needs at least 4 numbers in the list.
LARGE(k, list)
The LARGE function calculates the k-th largest number in a list of numbers. k should be
greater than 0 and not greater than the number of numbers in the list.
For example,
LARGE(3, 9, 234, 4, 56, 888)
returns 56, the third largest number.
MAX(list)
The MAX function returns the maximum (largest) value in the list. The list can include
numbers, cell addresses, ranges, and cell names.
For example:
MAX(1, 2, -16, 8)
returns largest number in the list, which is 8.
547 Function reference
MEDIAN(list)
The MEDIAN function calculates the median of a list of numbers. The median is the
middle value in a list of numbers, after the list has been arranged in ascending order.
MEDIAN both orders the list and finds the middle value, so you can enter the list values
in any order you like. If the list contains an even number of numbers, the median is
calculated as the average of the two middle numbers.
For example:
MEDIAN(3, 5 ,17, 34, 98)
returns 17.
MEDIAN(3, 5, 17, 26, 34, 98)
returns 21.5, which is the average of the two middle numbers 17 and 26.
MEDIAN will return an error message if any of the list values are non-numeric, though it
will ignore non-numeric values if calling on a range.
MIN(list)
The MIN function returns the minimum (smallest) value in the list. The list can include
numbers, cell addresses, ranges, and cell names.
For example,
MIN(1, 2, -16, 8).
Ability displays the smallest number, which is -16.
MODE(list)
The MODE function calculates the mode of a list of numbers. The mode is the most
frequently occurring number in the list.
If all the numbers occur with equal frequency then an error message is returned.
However, if a subset of the numbers occur with greater frequency than the others, then
the first number in the subset is returned.
For example:
MODE(4, 5, 9, 2, 9)
returns 9
MODE(4, 5, 2, 9, 2, 9)
returns 2
MODE(1, 2, 3, 4, 5)
returns an error message
548 Function reference
MODE will return an error message if any of the list values or values held in a range are
non-numeric.
NEGBINOMDIST(number_f, number_s, probability_s)
The NEGBINOMDIST function calculates the negative binomial distribution.
This is a measure of the probability that a certain number of failures will occur before the
nth success, given that the probability of success is constant. It is used in situations
where the number of trials is variable and each trial is independent of the others, but the
number of successes is fixed.
The function arguments are:
the number of failures
the number of successes
the probability of a success
number_f
number_s
probability_s
For example, we want to know the probability of getting exactly 10 tails ("failures") before
we get 12 heads ("successes") in a coin-tossing experiment. The probability of a success
is constant at 0.5. The formula:
NEGBINOMDIST(10, 12, 0.5)
returns 0.084094 as the probability.
NORMDIST(x, mean, stdev)
The NORMDIST function calculates the normal distribution for a given mean and
standard deviation (stdev), where x is the value for which you want to know the
distribution. The formula used is:
1
σ 2π
e ( )
− 12
x−µ 2
σ
NORMDIST calculates the probability mass function.
For example:
NORMDIST(3, 2, 1)
returns 0.242, which is the probability of the event x = 3, given a normal distribution with
a mean of 2 and standard deviation 1.
PEARSON(array_x, array_y)
The PEARSON function calculates the Pearson product moment correlation coefficient.
This is a measure, between -1 and 1 inclusive, of the extent of the relationship between
two sets of data.
549 Function reference
array_x is the set of independent and array_y is the set of dependent numbers. The
arrays must have a matching number of values. PEARSON is calculated using the
formula:
r = (n∑ xy − ∑ x ∑ y)
(n∑ x 2 − (∑ x ) 2 )(n∑ y 2 − (∑ y) 2 )
where r is the correlation coefficient of the linear regression line running through the data
points described by array_x and array_y.
For example:
PEARSON({10, 7, 5, 3, 2}, {12, 8, 13, 4, 1})
returns 0.756437.
PERCENTILE(k, array)
The PERCENTILE function calculates the k-th percentile of the numbers in an array or
range. k is a number from 0 to 1 inclusive (or 0% to 100%).
The k-th percentile P of a range of numbers is a number such that at least a proportion k
of the range of numbers is smaller than or equal to P, and also at least a proportion (1 k) of those numbers is larger than or equal to P.
For example
PERCENTILE(25%, {0, 1, 2, 3, 4})
returns 1.
PERCENTILE(25%, {1, 2, 3, 4})
returns 1.75.
PERCENTRANK(x, array)
The PERCENTRANK function calculates the percentage rank of a number in a set of
numbers.
The percent rank of a value is a measure of its standing in relation to a set of values. It is
always a number from 0 to 1 inclusive. x is the value for which the percentage rank is
sought in comparison to the set of numbers in an array or range.
For example,
PERCENTRANK(2, {0, 1, 2, 3, 4})
returns 0.5
PERCENTRANK(2, {1, 2, 3, 4})
550 Function reference
returns 0.333333.
PERM(n, m)
The PERM function calculates the number of permutations of n distinct things taken m at
a time, using the following formula:
PERM = FACT(n) / FACT(n - m)
For example, to get the number of permutations of the three letters a, b and c, taking 2 at
a time, use the formula:
PERM(3, 2)
which returns 6. The six permutations are ab, ac, bc, ba, ca, cb.
A more complex example is a coded telegram where each word is 5 letters in length. The
number of possible different words, where each word contains a letter no more than
once, is given by the formula:
PERM(26, 5)
which returns 7893600.
POISSON(x, mean, cumulative)
The POISSON function calculates the Poisson distribution. This is useful for predicting
the probability of a number of events over a specific measure, for example time, length or
area.
The arguments of the function represent the following:
x
mean
cumulative
the number of events, for which we seek the
probability
the known average rate of events
a logical value, which determines the form of
the function:
TRUE calculates the cumulative Poisson
probability, which gives the probability that
the number of events will be between 0 and
x inclusive.
FALSE calculates the Poisson probability
mass function, which gives the probability
that the number of events will be exactly x.
For example, if 7 cars per minute is the average traffic rate on a particular road, and their
arrival is entirely random, we can calculate the probability of there being exactly 4 cars in
a minute by using the formula:
551 Function reference
POISSON(4, 7, FALSE)
which returns a probability of 0.091226.
The probability that there will be between 0 and 4 cars per minute inclusive is given by:
POISSON(4, 7, TRUE)
that is 0.172992.
PROB(x_range, prob_range, lower_limit, upper_limit)
The PROB function calculates the probability that numbers in a range are between two
limits.
x_range is a range of numbers with which there is associated a range of corresponding
probabilities in prob_range.
lower_limit and upper_limit are the limits of the range of numbers for which we want to
know the probability. If upper_limit is omitted then it becomes equal to lower_limit, and
PROB calculates the probability of just the one number.
Note that the values in prob_range must total 1, and that this range and x_range must
contain the same number of values.
For example, if {2, 4, 6, 8, 10} is a list of all possible outcomes of an experiment, with
corresponding probabilities {0.3, 0.1, 0.1, 0.2, 0.3}, then the probability of an event being
between 4 and 8 inclusive is given by the formula:
PROB({2,4,6,8,10}, {0.3, 0.1, 0.1, 0.2, 0.3}, 4, 8)
which returns 0.4.
QUARTILE(quart, array)
The QUARTILE function calculates the quartile of an array or range of numbers.
quart is either 0, 1, 2, 3 or 4, and represents either the zero (minimum), 25th, 50th
(median), 75th or 100th (maximum) percentile respectively.
For example, the 3rd quartile of a data set {12, 9, 11, 7, 4, 15} is given using the formula:
QUARTILE(3, {12, 9, 11, 7, 4, 15})
which returns 11.75. This is equivalent to using the Percentile function (see
PERCENTILE on page 549):
PERCENTILE(75%, {12, 9, 11, 7, 4, 15})
552 Function reference
Note that using quart = 0, 2, or 4 has the same effect as using the functions MIN,
MEDIAN or MAX respectively.
RANK(number, ref, order)
The RANK function calculates the rank of a number in a list of numbers. The rank of a
number is its size relative to the other numbers in the list.
The arguments for the function are:
number
the number in the list that we want to rank.
ref
the reference for the list of numbers, usually an
array, range or range name.
order
determines whether the rank is to be
calculated against a list sorted in descending
or ascending order: setting order at 0 (or
omitting it) sorts in descending order, at 1 or
>1 sorts in ascending order.
For example:
RANK(12, {6, 8, 2, 4, 14, 12, 10}, 0)
returns 2; whereas:
RANK(12, {6, 8, 2, 4, 14, 12, 10}, 1)
returns 6.
RSQ(array_x, array_y)
The RSQ function calculates the square of the Pearson product moment correlation
coefficient (see PEARSON on page 548). The formula is equivalent to:
SQR(PEARSON(array_x, array_y)
SKEW(list)
The SKEW function calculates the skewness of a distribution given by list.
Skewness is a measure of the asymmetery of a distribution round its mean. A distribution
with positive skewness has an asymmetric tail that stretches towards more positive
values. A distribution with negative skewness has an asymmetric tail that stretches
towards more negative values.
553 Function reference
SKEW works with a list of numbers, a range or an array. An error message is returned if
there are less than 3 values.
For example:
SKEW(16, 17, 19, 12, 11, 10, 9)
returns 0.367654.
SLOPE(array_y, array_x)
The SLOPE function calculates the slope of the linear regression line through the data
points described by array_x (the independent or controlled variable) and array_y (the
dependent variable).
The slope is the vertical distance between any two data points divided by the horizontal
distance between the same two data points. It is a measure of the rate of change of the
regression line, and is given by the formula:
b=
n∑ xy − ∑ x ∑ y
n∑ x 2 − (∑ x )
2
where b is the slope of the regression line.
The x- and y-arrays or ranges must have the same number of data points.
For example, suppose the following y-values were observed for the supplied x-values:
4.7 6.0 11.2 10.6 8.2 7.3 15.8 11.7
Y
1
2
3
4
5
6
7
8
X
A linear regression through these points would look like this:
You calculate the slope of the line using:
SLOPE({4.7, 6, 11.2, 10.6, 8.2, 7.3, 15.8, 11.7}, {1, 2, 3, 4, 5, 6, 7, 8})
which returns 0.9988.
554 Function reference
SMALL(k, list)
The SMALL function calculates the k-th smallest value in a set of numbers in list.
For example:
SMALL(2, {19, 7, 1, 18, 10})
returns 7.
STANDARDIZE(x, mean, stdev)
The STANDARDIZE function calculates a nomalized value for x, by subtracting the mean
and dividing the result by the standard deviation (stdev) of a distribution. This allows
direct comparison to the standard normal distribution.
For example:
STANDARDIZE(30, 20, 1.8)
returns 5.56, that is (30-20)/1.8.
STD(list) or STDEV(list)
The STD or STDEV function estimates the standard deviation of a population based on a
random sample of that population as supplied by list.
The standard deviation is a measure of the dispersal of data from the mean value and is
defined as the square root of the variance (see VAR on page 556).
The formula used by STD is:
SQRT(VAR(list))
STD assumes that list is a sample of the population, so use STDEVP (see STDEVP on
page 554) if you wish to work with a whole population.
For example, if 5 people are chosen at random and measured for height, from a company
with 40 employees, the formula:
STD(1.85, 1.9, 1.8, 1.75, 1.7)
returns 0.079 as the estimated standard deviation for the population. To get the standard
deviation based on all 40 employees use STDEVP.
STDEVP(list)
The STDEVP function calculates the standard deviation of a population based on the
whole of the population as supplied by list.
555 Function reference
The standard deviation is a measure of the dispersal of data from the mean value. The
formula used by STDEVP is:
SQRT(VARP(list))
STDEVP assumes that its arguments are the whole of a population, so use STD on page
554 if you wish to estimate the standard deviation based on a sample.
For example, if you wish to calculate the standard deviation of the times, in seconds, for
the members of a 4 x 400m running team, use the formula
STDEVP(55, 57, 56, 59)
which returns 1.479 seconds.
STEYX(array_y, array_x)
The STEYX function calculates the standard error associated with a linear regression on
the data points described by array_y (the dependent variable) and array_x (the
independent or controlled variable) according to the formula:
(n∑ xy − ∑ x∑ y )2
1 ⎛⎜
2
n∑ y 2 − (∑ y ) −
2
n(n − 2 ) ⎜
n∑ x 2 − (∑ x )
⎝
⎞
⎟
⎟
⎠
Standard error is a measure of the amount of error associated with a prediction of y given
x.
For example, suppose the following y-values were observed for the supplied x-values:
4.7 6.0 11.2 10.6 8.2 7.3 15.8 11.7
Y
1
2
3
4
5
6
7
8
X
A linear regression through these points would look like this:
Suppose you want to forecast y for x = 10 and supply a standard error with this forecast.
The standard error would be calculated using:
STEYX({4.7, 6, 11.2, 10.6, 8.2, 7.3, 15.8, 11.7}, {1, 2, 3, 4, 5, 6, 7, 8})
556 Function reference
which returns 2.84.
VAR(list)
The VAR function calculates the sample variance of the list. The list can contain
numbers, cell addresses, ranges, and cell names.
VAR is calculated according to the formula:
1
2
∑ (x − AVG(x))
n−1
VARP(list)
The VARP function calculates the variance of a list on the assumption that list contains
the whole population.
The variance is a measure of the spread of data from the mean, and is calculated using
the formula:
1
2
∑ (x − AVG(x))
n
VARP assumes that list is the whole of a population, so use VAR (see VAR on page 556)
if you wish to estimate the variance based on a sample.
For example:
VARP(9, 6, 5, 1, 10, 9, 3)
returns 9.836735.
WAVG(array_x, array_y)
The WAVG function calculates the weighted average of the values in array_x, with
corresponding weights taken from array_y. The arguments are either ranges or arrays.
WAVG is calculated using the formula:
x 1y 1 + x 2 y 2 + x 3 y 3 + ... + x n y n
y 1 + y 2 + y 3 + ... + y n
For example:
WAVG({1, 2, 3, 4, 5}, {0.3, 0.3, 0.1, 0.7, 0.8})
returns 3.64.
557 Function reference
WEIBULL(x, alpha, beta, cumulative)
The WEIBULL function calculates the Weibull distribution. This is often used in reliability
analysis.
The arguments of the function represent the following:
x
alpha
beta
cumulative
the value at which to evaluate the function
a parameter to the distribution
a parameter to the distribution
a logical value, which determines the form of the
function:
TRUE calculates the Weibull cumulative
distribution function, which uses the formula:
F(x; α, β) = 1 - EXP(-(x/β)^α)
FALSE calculates the Weibull probability density
function, which uses the formula:
f(x; α, β) = ( α / β^α ) x^(α - 1) EXP(-(x/β)^α)
Text functions
You can use Ability’s built-in text functions to manipulate, transform and compare text.
Here is a complete list of text functions in Ability:
CHAR on page 558
CLEAN on page 558
CODE on page 558
CONCATENATE on page
559
DOLLAR on page 559
EXACT on page 559
FINDTEXT on page 559
FIXED on page 560
LEFT on page 560
LEN on page 561
LOWER on page 561
MID on page 561
PROPER on page 561
REPLACE on page 562
REPT on page 562
RIGHT on page 562
SEARCHTEXT on page 563
SUBSTITUTE on page 563
T on page 564
TRIM on page 564
558 Function reference
UPPER on page 564
VALUE on page 564
CHAR(number)
The CHAR function returns the character specified by the code number. This is used to
convert codes from other types of computers to characters. number is from 1 to 255,
each number representing an ASCII character.
For example:
CHAR(37)
returns "%"
CHAR(57)
returns "9"
CLEAN(text)
The CLEAN function removes all non-printable characters from text. These are
characters that are not normally displayed by your operating system.
For example:
CLEAN (CONCATENATE (CHAR (7), "Hello"))
returns "Hello".
CODE(text)
The CODE function returns the numeric code for the first character in a text string. The
code corresponds to a character in ASCII.
For example:
CODE("W")
and
CODE("Wittgenstein")
both return 87.
CONCAT(text_list)
The CONCAT function joins several text items into one text item. text_list can be
composed of text, numbers or single-cell references.
CONCAT is an abbreviation for the CONCATENATE function.
559 Function reference
CONCATENATE(text_list)
The CONCATENATE function joins several text items into one text item. text_list can be
composed of text, numbers or single-cell references.
For example, if the cell A1 contains the number 5, the formula:
CONCATENATE("Petrol is $", A1, " today")
returns "Petrol is $5 today".
An abbreviated version of this function is CONCAT.
DOLLAR(number, precision)
The DOLLAR function converts a number to text, using a currency format. number is the
number to be converted and formatted.
precision specifies how the number is to be rounded. For example, 2 will round the
number to 2 decimal places, while -2 will round the number to 2 places to the left of the
point. If precision is omitted the default currency precision is taken from Windows
settings.
For example:
DOLLAR(234.19999, 2)
returns "$234.20"
DOLLAR(234.19999, -2)
returns "$200"
EXACT(text1, text2)
The EXACT function checks to see if two text values are identical. TRUE is returned if
they are, FALSE if not.
EXACT is case sensitive.
For example, suppose a field called myfield contains the text "Happy today", the following
results are obtained:
EXACT("Happy today", myfield)
TRUE
EXACT("happy today", myfield)
FALSE
EXACT("Happy", myfield)
FALSE
FINDTEXT(find_text, within_text, start_num)
The FINDTEXT function finds one text string within another and returns the position of
the character at which the two text strings first match.
560 Function reference
FINDTEXT is case sensitive and does not allow wildcard characters (in this it differs from
SEARCHTEXT – see SEARCHTEXT on page 563).
find_text is the text you wish to find.
within_text is the object text.
start_num is the position of the character in within_text from which you want to begin
the search.
If find_text is "" (empty) the character at start_num is returned. If start_num is omitted it
is assumed to be 1. The #VALUE error message is returned if FINDTEXT fails to find a
match.
For example:
FINDTEXT("br", "abracadabra",5)
returns 9
FINDTEXT("r", "Robertson", 1)
returns 5
FINDTEXT("R", "Robertson", 1)
returns 1
FINDTEXT(" ", "Mr Smith")
returns 3
FIXED(number, precision, commas)
The FIXED function formats a number as text with a fixed number of decimals.
number is the number to be rounded and formatted.
precision specifies how the number is to be rounded. For instance, 2 will round the
number to 2 decimal places, while -2 will round the number to 2 places to the left of the
point.
commas is a logical value which determines whether the number is to have commas
(TRUE) or not (FALSE or omitted).
For example:
FIXED(1234.19999, 2, TRUE)
returns "1,234.20"
FIXED(1234.19999, -2, FALSE)
returns "1200"
LEFT(text, num_chars)
The LEFT function returns the left-most characters from a text string.
num_chars is the number of characters from the left of the text string. If this is omitted, it
is assumed to be 1; if it is greater than the number of characters in text, then LEFT will
return the whole text string.
561 Function reference
For example:
LEFT("WC1 5NH", 3)
returns "WC1".
LEN(text)
The LEN function returns the number of characters in a text string. Spaces are counted
as characters.
For example,
LEN("The Queen of England")
returns 20.
LOWER(text)
The LOWER function converts text to lower case.
For example,
LOWER("SALES REPORT")
returns "sales report".
MID(text, start_num, num_chars)
The MID function returns a specific number of characters from a text string, starting at a
specified position.
If start_num is greater than the length of text, MID returns "" (empty string).
If num_chars is greater than the number of characters remaining after start_num, or if it
is omitted, MID returns the remaining characters.
For example,
MID("The discount is 10% in March", 24, 10)
returns "March".
PROPER(text)
The PROPER function capitalizes the first letter in each word of a text value. A word is
any continuous string of letters that follows a character other than a letter. Letters that are
not capitalized by PROPER are reduced to lower case.
562 Function reference
For example:
PROPER("no smoking")
returns "No Smoking"
PROPER("NO SMOKING")
returns "No Smoking"
PROPER("Leonardo’s masterPiece")
returns "Leonardo’S Masterpiece"
REPLACE(old_text, start_num, num_chars, new_text)
The REPLACE function replaces characters within text. This enables you to replace a
specified text string with another text string.
old_text contains the string which is to be replaced.
start_num gives the number of the character at which the replacement is to begin.
num_chars is the number of characters to be replaced.
new_text is the text that will replace the relevant string in old_text.
For example:
REPLACE("November", 1, 3, "Dec")
returns "December"
REPLACE("Mr Bill Clinton", 1, 7, "President") returns "President Clinton"
REPT(text, number_times)
The REPT function repeats text a given number of times.
For example,
REPT("x", 5)
returns "xxxxx".
RIGHT(text, num_chars)
The RIGHT function returns the right-most characters from a text string.
num_chars is the number of characters from the right of the text string. If this is omitted it
is assumed to be 1. If it is greater than the number of characters in text then RIGHT will
return the whole text string.
For example,
RIGHT("New York", 4)
returns "York"
RIGHT("Washington", 20)
returns "Washington"
563 Function reference
SEARCHTEXT(find_text, within_text, start_num)
The SEARCHTEXT function finds one text string within another and returns the position
of the character at which the two text strings first match.
SEARCHTEXT is case-insensitive and allows wildcard characters (* or ?) (This differs
from FINDTEXT – see FINDTEXT on page 559). If you wish to search for the characters
* or ? themselves, use ~* or ~?.
find_text is the text you wish to find. If find_text is "" (empty) the position of the
character at start_num is returned.
within_text is the object text.
start_num is the position of the character in within_text from which you want to begin
the search. If start_num is omitted it is assumed to be 1.
The #VALUE error message is returned if SEARCHTEXT fails to find a match.
For example,
=SEARCHTEXT("br", "AbraCADaBRa", 5)
returns 9
=SEARCHTEXT("r", "Robertson", 1)
returns 1
=SEARCHTEXT("R*t", "Robertson", 1)
returns 1
=SEARCHTEXT("", "Mr Smith", 4)
returns 4
=SEARCHTEXT("~*", "XXXX*XX")
returns 5
SUBSTITUTE(text, old_text, new_text, instance_num)
The SUBSTITUTE function substitutes new text for old text in a text string. This enables
you to replace a specified text string with another text string (see REPLACE on page 562
if you wish to replace text at a specific location in a text string).
text contains the text string that is to be replaced.
old_text is the text that is to be replaced.
new_text is the text that is to be substituted for old_text.
instance_num specifies which instance of old_text is to be replaced (if this is omitted all
instances of old_text are replaced).
For example:
SUBSTITUTE("Happy New Year", "New Year", "Birthday")
564 Function reference
returns "Happy Birthday"
SUBSTITUTE("Apri1/1/1997", "9", "8", 2)
returns "April/1/1987"
SUBSTITUTE(SUBSTITUTE("(x + y)/(x - y)", "(", "["), ")", "]")
returns "[x + y]/[x - y]"
T(value)
The T function returns its argument if it is text, otherwise it converts a value to text. This
is not a function that will often be needed, since Ability automatically converts most
values as necessary in formulas.
For example:
T("FALSE")
returns "FALSE"
T(FALSE)
returns "FALSE"
T(1000)
returns "1000"
This function is the reverse of VALUE (see VALUE on page 564).
TRIM(text)
The TRIM function removes spaces from text, except single spaces between words.
For example
TRIM("Dear Mr
Clinton")
returns "Dear Mr Clinton".
UPPER(text)
The UPPER function converts text to uppercase.
For example:
UPPER("hello")
returns "HELLO".
VALUE(text)
The VALUE function converts a text argument to a number.
565 Function reference
For example,
VALUE("222")
returns 222.
This function is the reverse of T(value) (see T(value) on page 564).
Document functions
You can use Ability’s built-in document functions to display information about the
document in which you are currently working. This is useful if you want a print-out to
contain document information within the document itself.
The document functions directly access the information in Summary and Statistics
contained in Properties under the File menu.
Here is a complete list of document functions in Ability:
Function
AUTHOR on page 566
COMMENTS on page
127
CREATEDATE on
page 566
EDITTIME on page
566
FILENAME on page
566
FILESIZE on page
566
KEYWORDS on page
566
MERGECOUNT on
page 567
MERGEREC on page
567
NUMCHARS on page
567
NUMPAGES on page
567
NUMWORDS on page
567
PAGE on page 567
PRINTDATE on page
Operation
returns author from Summary Information
returns comments from Summary Information
returns the date document was created from Statistics
returns the total document editing time from Statistics
returns the document name and location
returns the size on the disk of the document
returns keywords from Summary Information
returns the total number of merge records in the
document
returns the number of the current merge record
returns the number of characters in the document from
Statistics (only applies to Write)
returns the number of pages in the document from
Statistics
returns the number of words in the document from
Statistics (only applies to Write)
returns the number of the current page in the document
returns the date the document was last printed from
566 Function reference
567
REVNUM on page
567
SAVEDATE on page
Error! Bookmark not
defined.
SUBJECT on page
568
TITLE on page 129
Statistics
returns the number of times the document has been
saved from Statistics
returns the date the document was last saved from
Statistics
returns the subject of the document from Summary
Information
returns the title of the document from Summary
Information
AUTHOR()
Returns the author’s name. This is taken directly from the Summary page under the
File/Properties menu.
COMMENTS()
Returns document comments. This is taken directly from the Summary page under the
File/Properties menu.
CREATEDATE()
Returns the date the document was created. This is taken directly from the Statistics
page under the File/Properties menu.
EDITTIME()
Returns the total document editing time. This is taken directly from the Statistics page
under the File/Properties menu.
FILENAME()
Returns the document name and location.
FILESIZE()
Returns the number of bytes the document occupies on disk.
KEYWORDS()
Returns the document keywords. This is taken directly from the Summary page under the
File/Properties menu.
567 Function reference
MERGECOUNT()
Returns the total number of merge records in the document.
If mail merge is enabled, this is the total number of records in the current mail merge. (A
tick will show next to Mail merge on the Tools menu). If mail merge is not enabled,
returns #VALUE.
MERGEREC()
Returns the number of the current merge record, providing mail merge is enabled. (A tick
will show next to Mail merge on the Tools menu).
If mail merge is not enabled, returns #VALUE.
NUMCHARS()
Returns the total number of characters in current document. This is taken directly from
the Statistics page under the File/Properties menu.
NUMPAGES()
Returns the number of pages in the current document. This is taken directly from the
Statistics page under the File/Properties menu.
NUMWORDS()
Returns the number of words in the current document. This is taken directly from the
Statistics page under the File/Properties menu.
PAGE()
Returns the number of the current page in the document.
PRINTDATE()
Returns the date the document was last printed. This is taken directly from the Statistics
page under the File/Properties menu.
REVNUM()
Returns the number of times the document has been saved. This is taken directly from
the Statistics page under the File/Properties menu.
568 Function reference
SAVEDATE()
Returns the date the document was last saved. This is taken directly from the Statistics
page under the File/Properties menu.
SUBJECT()
Returns the subject of the document. This is taken directly from the Summary page under
the File/Properties menu.
TITLE()
Returns the title of the current document. This is taken directly from the Summary page
under the File/Properties menu.
Remote functions
You can use Ability’s built-in remote functions to work with information from other
documents. These allow you to display, manipulate and edit external information in the
current document. The remote functions are useful when you need to access external
database, spreadsheet or write information from a current spreadsheet or write
document. Most of the remote functions call on a database object. This is a table, query,
relation or SQL statement.
Here is a complete list of remote functions in Ability:
DBFIELDCOUNT on page 569
DBFIELDNAME on page 569
DBFILTER on page 569
DBFILTERSORT on page 571
DBGET on page 572
DBQUERYCOUNT on page 573
DBQUERYNAME on page 573
DBRELATIONCOUNT on page 573
DBRELATIONNAME on page 574
DBSORT on page 574
DBSQL on page 575
DBSQLFILTER on page 576
DBSQLSORT on page 578
DBSQLFILTERSORT on page 579
DBTABLECOUNT on page 581
DBTABLENAME on page 581
HYPERLINK on page 581
REMOTE on page 582
SSGET on page 586
WPGET on page 587
569 Function reference
DBFIELDCOUNT(database, source)
The DBFIELDCOUNT function returns the number of fields in a database object.
database is the name of a database and must include the full path if not in the same
directory as the open document.
source is the name of the database object, which can be a table, query, relation or SQL
statement.
For example, if there is a database called wineshop.adb in a folder c:\ability\samples,
which contains a table called Contacts, then:
DBFIELDCOUNT("c:\ability\samples\wineshop.adb", "Contacts")
returns the number of fields.
DBFIELDNAME(database, source, index)
The DBFIELDNAME function returns the name of a field in a database object.
database is the name of a database and must include the full path if not in the same
directory as the open document.
source is the name of the database object, which can be a table, query, relation or SQL
statement.
index is a field number.
The function arguments are case insensitive.
For example, if there is a database called wineshop.adb in a folder c:\ability\samples,
which contains a table called Contacts, then:
DBFIELDNAME("c:\ability\samples\wineshop.adb", "Contacts", 1)
returns the name of the first field in the table.
DBFILTER(database, table, filter, field_name, rec_num)
The DBFILTER function returns the contents of a field from a database table, after a
specified named filter has been applied.
This requires that the filter has already been defined in Database. This contrasts with
DBSQLFILTER (see DBSQLFILTER on page 576), which is similar in functionality but
allows you to define simple filters "on-the-fly".
570 Function reference
database is the name of a database and must include the full path if not in the same
directory as the open document.
table is the name of the table within the database. table could also be the name of a
relation.
filter is the named filter that has been applied to the table or relation.
field_name is optional and can be either the name of the field within a table or relation or
the column number. If omitted, every row and column of the filtered table is returned.
rec_num is optional (and cannot be specified if field_name is omitted) and determines
the record or row number of the returned value. If omitted, the entire column is returned
(or table if field_name is also omitted).
The function arguments are case insensitive.
For example, a database called wineshop, located in a folder c:\ability\samples, contains
a Product table of wines. A filter called Red has been defined that filters out all wines
other than red. The table contains the name of each wine in a Title field and the price in a
field called Price as follows:
Title
Château Haut du Puy
Volnay-Santenots
Le Chambertin
Chambolle-Musigny
Price
17.00
27.00
53.00
28.50
Classification
red
red
red
red
DBFILTER can be used to obtain the following results:
DBFILTER("c:\ability\samples\wineshop.adb", "products", "red")
returns "Château Haut du Puy" as this is the first column and row off the filtered table.
DBFILTER("c:\ability\samples\wineshop.adb", "products", "red", 1, 3)
returns "Le Chambertin", as this is the value from 3rd row and 1st column.
DBFILTER("c:\ability\samples\wineshop.adb", "products", "red", "price", 2)
returns 27, the 2nd record of the Price column.
AVG(DBFILTER("c:\ability\samples\wineshop.adb", "products", "red",
"price"))
returns 31.375 - the average price of red wine.
ROWS(DBFILTER("c:\ability\samples\wineshop.adb", "products", "red"))
returns 12, the total number of records in the filtered table.
571 Function reference
DBFILTERSORT(database, table, filter, sort, field_name, rec_num)
The DBFILTERSORT function returns the contents of a field from a database table after
a specified named filter and sort order have been applied.
This requires that the filter and sort order have already been defined in Database. This
contrasts with DBSQLFILTERSORT (see DBSQLFILTERSORT on page 579), which is
similar in functionality but allows you to define simple filters and sort orders "on-the-fly".
database is the name of a database and must include the full path if not in the same
directory as the open document.
table is the name of the table within the database. table could also be the name of a
relation.
filter is the named filter that has been applied to the table or relation.
sort is the named sort order that has been applied to the table or relation.
field_name is optional and can be either the name of the field within a table or relation or
the column number. If omitted, every row and column of the filtered table is returned.
rec_num is optional (and cannot be specified if field_name is omitted) and determines
the record or row number of the returned value. If omitted, the entire column is returned
(or table if field_name is also omitted).
The function arguments are case insensitive.
For example, a database called wineshop, located in a folder c:\ability\samples, contains
a Product table of wines. A filter called Red has been defined that filters out all wines
other than red. The table contains the name of each wine in a Title field and the price in a
field called Price as follows:
Title
Château Haut du Puy
Volnay-Santenots
Le Chambertin
Chambolle-Musigny
Price
17.00
27.00
53.00
28.50
Classification
red
red
red
red
A sort order called ByPrice has been created that sorts in ascending order the price field.
DBFILTERSORT can be used to obtain the following results:
DBFILTERSORT("c:\ability\samples\wineshop.adb", "products", "red",
"byprice")
572 Function reference
returns "Château Haut du Puy" as this is the first column and row off the filtered table
when sorted by price.
DBFILTERSORT("c:\ability\samples\wineshop.adb", "products", "red",
"byprice", 1, 3)
returns " Chambolle-Musigny", as this is the 3rd cheapest wine.
DBFILTERSORT("c:\ability\samples\wineshop.adb", "products", "red",
"byprice", "price", 2)
returns the price of the second cheapest wine, 27.
DBGET(database, source, field_name, rec_num)
The DBGET function returns the contents of a field in a database.
database is the name of a database and must include the full path if not in the same
directory as the open document.
source is the name of the database object, which can be a table, query, relation or SQL
statement.
field_name is optional and can be either the name of the field within a table or relation or
the column number. If omitted, every row and column of the filtered table is returned.
rec_num is optional (and cannot be specified if field_name is omitted) and determines
the record or row number of the returned value. If omitted, the entire column is returned
(or table if field_name is also omitted).
The function arguments are case insensitive.
For example, a database called wineshop, located in a folder c:\ability\samples, contains
a table called Products, which details a list of wines. The table contains three fields as
follows:
Title
Château Haut du Puy
Volnay-Santenots
Le Chambertin
Chambolle-Musigny
Price
17.00
27.00
53.00
28.50
Classification
red
red
red
red
DBGET can be used in the following ways:
DBGET("c:\ability\samples\wineshop.adb", "products", 1, 1)
returns "Château Haut du Puy", the first field from the first record.
DBGET("c:\ability\samples\wineshop.adb", "products", "price", 3)
573 Function reference
returns 53.00, the Price field from record three.
SUM(DBGET("c:\ability\samples\wineshop.adb", "products", "price"))
returns 125.50, the sum of the Price field.
DBQUERYCOUNT(database)
The DBQUERYCOUNT function returns the number of queries in a database.
database is the name of a database and must include the full path if not in the same
directory as the open document.
For example, a database called wineshop, located in a folder c:\ability\samples, contains
a three queries:
DBQUERYCOUNT("c:\ability\samples\wineshop.adb")
will return 3.
DBQUERYNAME(database, index)
The DBQUERYNAME function returns the name of a specified query in a database.
database is the name of a database and must include the full path if not in the same
directory as the open document.
index is the query number, starting at 1.
For example, you know a database called wineshop, located in a folder c:\ability\samples,
contains at least one query:
DBQUERYNAME("c:\ability\samples\wineshop.adb", 1)
returns the name of the first query in the database.
Suppose you enter "c:\ability\samples\wineshop.adb" into a cell in a spreadsheet, say A1.
Then the following:
DBQUERYNAME(A1, DBQUERYCOUNT(A1))
returns the name of the last query.
DBRELATIONCOUNT(database)
The DBRELATIONCOUNT function returns the number of relations in a database.
database is the name of a database and must include the full path if not in the same
directory as the open document.
574 Function reference
For example, a database called wineshop, located in a folder c:\ability\samples, contains
a four relations:
DBRELATIONCOUNT("c:\ability\samples\wineshop.adb")
will return 4.
DBRELATIONNAME(database, index)
The DBRELATIONNAME function returns the name of a specified relation in a database.
database is the name of a database and must include the full path if not in the same
directory as the open document.
index is the relation number, starting at 1.
For example, you know a database called wineshop, located in a folder c:\ability\samples,
contains at least one relation:
DBRELATIONNAME("c:\ability\samples\wineshop.adb", 1)
returns the name of the first relation in the database.
Suppose you enter "c:\ability\samples\wineshop.adb" into a cell in a spreadsheet, say A1.
Then the following:
DBRELATIONNAME(A1, DBRELATIONCOUNT(A1))
returns the name of the last relation.
DBSORT(database, table, sort, field_name, rec_num)
The DBSORT function returns the contents of a field from a database table, after a
specified named sort order has been applied.
This requires that the sort order has already been defined in Database. This contrasts
with DBSQLSORT (see DBSQLSORT on page 578), which is similar in functionality but
allows you to define simple sort orders "on-the-fly".
database is the name of a database and must include the full path if not in the same
directory as the open document.
table is the name of the table within the database. table could also be the name of a
relation.
sort is the named sort order that has been applied to the table or relation.
575 Function reference
field_name is optional and can be either the name of the field within a table or relation or
the column number. If omitted, every row and column of the filtered table is returned.
rec_num is optional (and cannot be specified if field_name is omitted) and determines
the record or row number of the returned value. If omitted, the entire column is returned
(or table if field_name is also omitted).
The function arguments are case insensitive.
For example, a database called wineshop, located in a folder c:\ability\samples, contains
a Product table of wines. A sort order called ByPrice has been defined acting in
ascending order on the Price field. The unsorted table looks like:
Title
Château Haut du Puy
Volnay-Santenots
Meursault-Charmes
Le Chambertin
Chambolle-Musigny
Price
17.00
27.00
54.00
53.00
28.50
Classification
red
red
white
red
red
DBSORT can be used to obtain the following results:
DBSORT("c:\ability\samples\wineshop.adb", "products", "byprice")
returns "Château Haut du Puy" as this is the first column and row of the table when
sorted by price.
DBSORT("c:\ability\samples\wineshop.adb", "products", "byprice", 1, 3)
returns " Chambolle-Musigny", as this is the 3rd cheapest wine.
DBSORT("c:\ability\samples\wineshop.adb", "products", "byprice", "price",
2)
returns the price of the second cheapest wine, 27.
DBSQL(database, SQL_statement, field_name, rec_num)
The DBSQL function returns the value of an SQL query.
database is the name of a database and must include the full path if not in the same
directory as the open document.
SQL_statement is a text string containing the full syntax of a SQL statement.
field_name is optional and can be either the name of the field within a table or relation or
the column number. If omitted, every row and column of the filtered table is returned.
576 Function reference
rec_num is optional (and cannot be specified if field_name is omitted) and determines
the record or row number of the returned value. If omitted, the entire column is returned
(or table if field_name is also omitted).
The function arguments are case insensitive with the exception that SQL commands
within SQL_statement should all be upper case.
For example, a database called wineshop, located in a folder c:\ability\samples, contains
a Product table of wines. Products contains three fields as follows:
Title
Château Haut du Puy
Volnay-Santenots
Meursault-Charmes
Le Chambertin
Chambolle-Musigny
Price
17.00
27.00
54.00
53.00
28.50
Classification
red
red
white
red
red
DBSQL can be used to obtain the following results:
DBSQL("c:\ability\samples\wineshop.adb", "SELECT * FROM products")
returns the entire table. "Château Haut du Puy", is displayed as it is contents of the first
column from the first record.
DBSQL("c:\ability\samples\wineshop.adb", "SELECT * FROM products", 3,
3)
returns "white", the third column from the third record.
ROWS(DBSQL("c:\ability\samples\wineshop.adb", "SELECT Price FROM
products WHERE Price > 50"))
returns 2, since there are two wines over 50.
The examples given here only touch on the possibilities with SQL. For a general
introduction to SQL, with the full range of supported SQL commands in Ability, see the
SQL Reference Guide on page 464.
DBSQLFILTER(database, table, filter, field_name, rec_num)
The DBSQLFILTER function returns the value of a database SQL query that applies a
filter.
database is the name of a database and must include the full path if not in the same
directory as the open document.
table is the name of the table within the database. table could also be the name of a
relation.
577 Function reference
filter is a text string containing an SQL filter statement and takes the general form of
fieldname <operator> comparison. The following could all be used in the examples
below:
filter
meaning
Price = 50
Price exactly equal to 50
Price >= 50
Price greater than or equal to 50
Price > 25 AND Price < 50
Price less than 50 but greater than
25
Classification = 'red'
Classification exactly equal to 'red'
Title LIKE 'Château*'
Title begins with ' Château' where * is
a wildcard
field_name is optional and can be either the name of the field within a table or relation or
the column number. If omitted, every row and column of the filtered table is returned.
rec_num is optional (and cannot be specified if field_name is omitted) and determines
the record or row number of the returned value. If omitted, the entire column is returned
(or table if field_name is also omitted).
The function arguments are case insensitive with the exception of SQL operators within
the filter statement, which must be upper case.
For example, a database called wineshop, located in a folder c:\ability\samples, contains
a Product table of wines. Products contains three fields as follows:
Title
Château Haut du Puy
Volnay-Santenots
Meursault-Charmes
Le Chambertin
Chambolle-Musigny
Price
17.00
27.00
54.00
53.00
28.50
Classification
red
red
white
red
red
DBSQLFILTER can be used to obtain the following results:
DBSQLFILTER("c:\ability\samples\wineshop.adb", "products",
"Classification = 'white' ")
returns "Meursault-Charmes", as this is the contents of the first column from the first (and
only in this case) record that matches the filter condition. Note that the filter parameter is
surrounded by double quotes and the text that Classification is compared to - 'white' - is
in single quotes. This is necessary to distinguish the end of each text string respectively.
578 Function reference
DBSQLFILTER("c:\ability\samples\wineshop.adb", "products",
"Classification = 'red' ", 2, 3)
returns 53.00, the second column from the third record that matches the filter.
ROWS(DBSQLFILTER("c:\ability\samples\wineshop.adb", "products",
"Price > 50", "Price"))
returns 2, since there are two wines over 50.
Note that
DBSQLFILTER(database, table, filter, column, record)
is equivalent to DBSQL (see DBSQL on page 575) as follows:
DBSQL(database, "SELECT * FROM <table> WHERE <filter>", column,
record).
For more details on how to build valid filter conditions, see the SQL primer.
DBSQLSORT(database, table, sort, field_name, rec_num)
The DBSQLSORT function returns the value of a database SQL query that applies a sort
order.
database is the name of a database and must include the full path if not in the same
directory as the open document.
table is the name of the table within the database. table could also be the name of a
relation.
sort is a text string containing an SQL sort statement. This is a field name or names with
an optional "DESC" to reverse the default ascending order.
field_name is optional and can be either the name of the field within a table or relation or
the column number. If omitted, every row and column of the filtered table is returned.
rec_num is optional (and cannot be specified if field_name is omitted) and determines
the record or row number of the returned value. If omitted, the entire column is returned
(or table if field_name is also omitted).
The function arguments are case insensitive.
For example, a database called wineshop, located in a folder c:\ability\samples, contains
a Product table of wines. Products contains three fields as follows:
Title
Château Haut du Puy
Price
17.00
Classification
red
579 Function reference
Volnay-Santenots
Meursault-Charmes
Le Chambertin
Chambolle-Musigny
27.00
54.00
53.00
28.50
red
white
red
red
DBSQLSORT can be used to obtain the following results:
DBSQLSORT("c:\ability\samples\wineshop.adb", "price DESC")
returns "Meursault-Charmes", the first column of the first record of the table when sorted
by Price in descending order.
DBSQLSORT("c:\ability\samples\wineshop.adb", "price", 2, 3)
returns 27.00, the second cheapest wine price.
Note that:
DBSQLSORT(database, table, sort, column, record)
is equivalent to using DBSQL (see DBSQL on page 575) as follows:
DBSQL(database, "SELECT * FROM <table> ORDER BY <sort>", column,
record)
DBSQLFILTERSORT(database, table, filter, sort, field_name, rec_num)
The DBSQLFILTERSORT function returns the value of a database SQL query that
applies a filter and a sort order.
database is the name of a database and must include the full path if not in the same
directory as the open document.
table is the name of the table within the database. table could also be the name of a
relation.
filter is a text string containing an SQL filter statement and takes the general form of
fieldname <operator> comparison. The following could all be used in the examples
below:
filter
meaning
Price = 50
Price exactly equal to 50
Price >= 50
Price greater than or equal to 50
Price > 25 AND Price < 50
Price less than 50 but greater than
25
580 Function reference
Classification = 'red'
Classification exactly equal to 'red'
Title LIKE 'Château*'
Title begins with 'Château' where * is
a wildcard
sort is a text string containing an SQL sort statement. This is a field name or names with
an optional "DESC" to reverse the default ascending order.
field_name is optional and can be either the name of the field within a table or relation or
the column number. If omitted, every row and column of the filtered table is returned.
rec_num is optional (and cannot be specified if field_name is omitted) and determines
the record or row number of the returned value. If omitted, the entire column is returned
(or table if field_name is also omitted).
The function arguments are case insensitive with the exception of SQL operators within
the filter statement, which must be upper case.
For example, a database called wineshop, located in a folder c:\ability\samples, contains
a Product table of wines. Products contains three fields as follows:
Title
Château Haut du Puy
Volnay-Santenots
Meursault-Charmes
Le Chambertin
Chambolle-Musigny
Price
17.00
27.00
54.00
53.00
28.50
Classification
red
red
white
red
red
DBSQLFILTER can be used to obtain the following results:
DBSQLFILTERSORT("c:\ability\samples\wineshop.adb", "products",
"classification = 'red' ","price DESC")
Returns "Le Chambertin", the most expensive red wine.
DBSQLFILTER("c:\ability\samples\wineshop.adb", "products",
"classification = 'red' ", "price", 2, 3)
returns 28.50, the second column from the third cheapest, red wine.
Note that:
DBSQLFILTERSORT(database, table, filter, sort, column, record)
is equivalent to using DBSQL (see DBSQL on page 575) as follows:
DBSQL(database, "SELECT * FROM <table> WHERE <filter> ORDER BY
<sort>", column, record)
581 Function reference
DBTABLECOUNT(database)
The DBTABLECOUNT function returns the number of tables in a database.
database is the name of a database and must include the full path if not in the same
directory as the open document.
For example, if a database called wineshop. located in a folder c:\ability\samples,
contains seven tables, then
DBTABLECOUNT("c:\ability\samples\wineshop.adb")
will return 7.
DBTABLENAME(database, index)
The DBTABLENAME function returns the name of a specified table in a database.
database is the name of a database and must include the full path if not in the same
directory as the open document.
index is the table number, starting at 1.
For example, you know a database called wineshop, located in a folder c:\ability\samples,
contains at least one table:
DBTABLENAME("c:\ability\samples\wineshop.adb", 1)
returns the name of the first table in the database.
Suppose you enter "c:\ability\samples\wineshop.adb" into a cell in a spreadsheet, say A1.
Then the following:
DBTABLENAME(A1, DBTABLECOUNT(A1))
returns the name of the last table.
HYPERLINK(link location, friendly name)
Creates a hyperlink jump to a remote document specified by link location. The remote
document could be any local file (a Write document or spreadsheet) or a URL to an
Internet location.
Friendly name is an optional parameter that masks the actual link details with more
meaningful text. If friendly name is omitted, the function displays the link location.
HYPERLINK is different to all other functions in that it creates an interface componant for
the user – as the mouse pointer is moved over the text it will change into a pointer and by
582 Function reference
default, the text is displayed in a blue underlined font. HYPERLINK is very similar to links
used in web pages.
Examples:
=HYPERLINK(“http://www.ability.com/”)
Displays
http://www.ability.com/ and
opens the web site using the
default browser.
=HYPERLINK("http://www.ability.com/",
"Ability's web site")
Displays Ability's web site but
otherwise behaves exactly as
above.
=HYPERLINK(A1, A2)
Displays whatever is in A2 and
opens the file/URL defined in
A1.
=HYPERLINK("c:\my
documents\myfile.aww", "My text file")
Runs Write and opens the file
myfile.aww
Note: if the link location points to a local document, the associated program will be
launched to open the file. For example if you have Microsoft's Paint as the default editor
for all bmp (bitmap) files, then Paint would be launched if HYPERLINK specified a file
with a .bmp extension.
REMOTE(document_name, reference_name)
The REMOTE function returns the value of a remote object. Usually this means the value
of a cell in a spreadsheet or a field in a document. REMOTE is the "grandfather" of all
linking functions - every other remote function can be expressed using just REMOTE.
document_name is the name of a remote document and must include the full path if not
in the same directory as the open document. The document can be a spreadsheet,
database or word processing document.
reference_name is the name of the object whose value is sought. An object can be a
named field in a write or spreadsheet document, a cell or range reference in a
spreadsheet, or a table, query, relation or SQL statement in a database.
Note that there are easier-to-use functions that will achieve the same result, as follows:
WPGET on
page 587
for linking to Write
SSGET on
page 586
for linking to Spreadsheet
583 Function reference
DBGET on
page 572
for linking to Database
Here are some simple examples, using REMOTE to link to spreadsheets and write
documents.
REMOTE("c:\ability\samples\letter.aww", "myfield")
returns the value of the field myfield from the Write document letter.aww.
REMOTE("c:\ability\samples\income.aws", "A1")
returns the value of the cell A1 from the spreadsheet income.aws.
REMOTE("spread1", "C1..E17"))
returns the range C1..E17 from an untitled spreadsheet, Spread1. Note that since
Spread1 has not yet been saved it does not have an extension.
Using REMOTE for database linking is usually unnecessary, as there is a full range of
specific database linking functions.
The full syntax for REMOTE, including database links, is as follows:
Application
reference_name
Write
reference_name is a field, usually inserted into a write
document in order to