Sie sind auf Seite 1von 396

VOLUME

3
DataBase Query Language Guide

This

menu

tree

shows

where the various DataEase


options are located. Record
Entry,

QBE-Quick

Reports,

and Database Maintenance


are discussed in Volume I.

Form

Definition

Relationships,
Definition,

Form

Definition

Menu

1.

Define a Form

2.

View or Modify a Form

3.

Define Relationships

4.

Delete a Form

5.

Reorganize a Form

and

Menu

and System

Administration are discussed


in

Volume

2.

DQL Advanced Processing is


discussed in

Volume

3.

Records Menu
Please select a form.
Enter a number from

2:

NONE
SYSTEM
STORES

3:

CALL LIST

0;
1:

DataEase Main Menu

4:
5:
1.

Form

Definition

to

PRODUCTS
EMPLOYEES

and

Relationships

3.

Record Entry
QBE-Quick Reports

4.

DQL Advanced

5.

Menu

6.

Database Maintenance
System Administration

2.

7.

Processing

Definition

The
DataEase Menu
Definition

Form

Displays

Maintenance Menu

3.

Database Status
Backup Database
Restore Database

4.

DOS

5.

Lock Database

6.

Unlock Database

2.

Functions

DataEase International Inc.


Technical Support Policy
DataEase International provides free technical support for all registered
DataEase licensees in the U.S. (support in other countries is provided by
the local distributor).

To

register,

simply

fill

out and send in the enclosed

registration card. Technical support for unregistered callers

is

limited to

30 days from the date of purchase. DataEase International reserves the


right to limit the number of calls and the call length.

The DataEase Hotline number


through Thursday,

is

1-203-374-2825. Our hours are

9AM to 8PM, and Friday, 9AM

to

6PM

Monday

EST. Please

have your DataEase serial number ready when you call. This number
located on your system diskette and on the DataEase Sign On screen.

is

YOU MUST BE REGISTERED TO RECEIVE FREE TECHNICAL


SUPPORT!

Copyright and Trademarks


DataEase and GrafTalk are registered trademarks of DataEase
International, Inc.

IBM

is

a registered trademark of International Business

Machines

Corporation.

The following companies hold trademarks on product names


italic)

which are mentioned

in the

(printed in

DataEase documentation:

Ashton-Tate: dBASE II dBASE III dBASE


MultiMate dBASE IV

III

PLUS.

Borland International: Paradox


Lotus Development Corporation: Lotus 1-2-3 Symphony"'

MicroPro

International:

WordStar

WordPerfect Corporation: WordPerfect


This manual supports DataEase Release 4.2 and higher.

No

part of this publication may be reproduced, stored in a retrieval


system, or transmitted in any form or by any means: electronic,
mechanical, photocopying, recording, or otherwise, without the prior

written permission of the publisher.

Copyright 1988, 1989, 990 DataEa.se International


7 Cambridge Drive, Trumbull, CT 0661
(203) 374-8000
1

All rights reserved.

Printed in the U.S.A.

DataBase
g^^-mx^v'^.^-^.^'j^^^

?-^'

-.'.

s^^^

j-s-jj,

'
:.

,v.:--'.i^y^x<mre -

REFERENCE MANUAL

Volume 3
DataBase Query Language
Guide

=^
DataBase
>^^F
INTERNATIONAL

mi

U A

A E A

N C E

MANUAL

Table of Contents
1

Introduction to

INTERACTIVE
EDIT

DQL Advanced Processing

MODE

1-1

MODE

1-2

WHAT'S A QUERY?
SAMPLE QUERY AND REPORT OUTPUT
DQL PROCEDURES
Types of Procedures

Defining, Modifying, and

RUN PROCEDURE
START NEW PROCEDURE
DEFINE DATA-ENTRY FORM
How

to

a Data-entry

1-5

1-6

Running Procedures

QUICK SUMMARY OF THE DQL MENU OPTIONS

Is

1-4

1-5

First

TYPOGRAPHICAL CONVENTIONS

What

1-3

1-3

THE BASIC DQL VOCABULARY


HOW TO USE THIS BOOK

1-2

1-3

Conditional Processing

What To Read

1-2

Form?

Display the Data-entry Form

Creating the Data-entry Forni

2-3
2-5

2-6
2-7
2-7
2-8
2-9

Using the Data-entry Form

2-10

Saving the Data-entry Form

2-12

Modifying the Data-entry Form

DEFINE QUERY
The DataEase Query Language
Interactive

Mode

Edit

Low

2-14
2-15

Changing Modes
High Level and

2-13

2-14

2-15

Level

Mode

Modify Query

2-18
2-19
2-20

How to Switch Modes


SAVE PROCEDURE

2-21

LOAD PROCEDURE
DELETE PROCEDURE
PRINT PROCEDURE DEFINITION

2-24

2-22

2-26
2-27

Volume

TABLE OF CONTENTS
3

Define Query:

A Low

Level Example

THE PURPOSE OF THE QUERY; A REPORT


WHICH RECORDS TO SELECT
CREATING THE QUERY
4

Define Query:

A High

Level

3-2
3-2
3-3

Example

HIGH LEVEL DQL COMMANDS


POST ORDERS

PROCEDURE
Query

4-1

4-3

4-3

for the Post Orders Procedure

Explanation of the Query

Saving the Procedure

PROCEDURE
Query

2:

CALCULATE DISCOUNT

for the Calculate Discount Procedure

Explanation of the Query

PROCEDURE 3: PRINT INVOICES


Query

for the Print Invoices Procedure

Explanation of the Query

THE CONTROL PROCEDURE: MAILORDER


Query

for Mail

4-3

Order Control Procedure

4-7
4-8

4-9
4-9

4-17
4-18
4-19
4-21
4-21

Explanation of the Control Procedure

4-22

Summary

4-24

(Putting

It

All Together)

Define Format/Print Style: Designing Report Output

DEFINE FORMAT

5-3

QUICK SUMMARY OF THE FORMAT MENU OPTIONS


FORMAT TYPES

5-5

Columnar Format

5-8
5-8

Field per Line Format

5-14

Record Entry Format

5-16

Template Format

5-17

GrafTalk Chart Format

5-20

Mailing Labels Format

5-25

Export Formats

5-27

CUSTOM FORMAT
Formatting

5-40

Commands
Commands

Required Formatting

Group Level Formatting Commands


Page Level Formatting

The

.call

Volume

Command

Commands

5-42

5-44
5-49
5-53

5-56

ii

DATAEASE REFERENCE MANUAL


EDITING FORMATS
Editing Function

5-58

Keys

5-58

Adding and Modifying Fields

5-60

Saving a Format

5-64

Printer Control

Commands

5-65

DEHNE PRINT STYLE


The

5-70
5-70

Print Style Specification

Defining the Report Destination

5-71

Print Style Modification

5-75

Saving/Modifying

5-79

Examples

5-80

DQL Lexicon

INTRODUCTION
DQL LEXICON TYPOGRAPHICAL CONVENTIONS

6-2

Syntax Diagrams

6-2

Margin Notes

6-2

Typesize
Database Forms Used

iii

6-1

6-2
in the

Examples

6-2

Punctuation Symbols

6-3

Math Symbols

6-3

Wildcard Symbols

6-3

Comparison Symbols

6-3

Volume

TABLE OF CONTENTS
List of Figures

Introduction to

Figure

1-1

DQL Advanced Processing

- Query

that Lists U.S. States in Alphabetical


the Report Output

Defining, Modifying, and

Order and
1-2

Running Procedures

-The DQL Menu


2-2 - Data-entry Form Used to Specify a Single State
2-3 - Interactive Mode Screen
2-4 Procedure Definition (no Data-entry Form)

Figure 2-1

2-1

Figure

2-7

Figure
Figure

Define Query:

2-15

2-28

A Low Level Example

Low Level Example Database Forms


Account Balance Report
3-3 Sort Commands
3-4 Alphabetized Account Balance Report

Figure 3-1

3-1

Figure 3-2

3-2

Figure
Figure

Define Query:

Figure 4-1
Figure 4-2

Figure 4-3

High Level Example

- High Level Example DataBase Forms


Calculation Of Annual Variable
Christmas Order Invoice

4-2
4-13

4-17

Define Format/Print Style: Designing Report Output

Figure 5-1

Figure 5-2
Figure 5-3

Sample Report Showing Formatting Commands


~ Sample Query, Format, and Report Output
Sample Formatting Commands Used to Create
a

Custom Format

Figure 5-4

Figure 5-5

Pairing Group Formatting Commands


Report Field Definition Screen
Report Field Formula in Window
- Print Style Specification Screen

Figure 5-6

Figure 5-7
Figure 5-8

3-8

3-13

Basic Format

5-2
5-7

5-40
5-43

5-49

5-60
5-61

5-70

DQL Lexicon

Figure 6-1
Figure 6-2

Figure 6-3
Figure 6-4

Volume

- Forms and Relationship Levels


Sample Report Showing Use of Formatting Commands
- Forms and Relationship Levels
Order Entry Form Used for Transaction Processing

6-148

6-160
6-164
6-185

iv

DATABASE REFERENCE MANUAL

Chapter

Introduction to

DQL Advanced

Processing

he DataEase Query Language

(DQL) extends

the data

processing and reporting capabiHties of DataEase far


1

lets

In

you:

Design custom applications

Use

the

that input, manipulate,

and retrieve

DQL Relational Operators to find. list, modify, sort,

group, and summarize data

then go through the example


in

Chapter 3

to

gain a basic

familiarity with the process of


defining queries.

information in multiple database forms.

new user, we
recommend thai you first
read this Introduction and

If you're a

beyond those described for Quick Reports in Volume


addition to giving you full control over all aspects of querying,
report design, and formatting output, DQL Advanced Processing

in related

forms.

Experienced users will find


that the example in Chapter 4
introduces most of the DQL
vocahulaiy and demonstrates
how to construct a DQL
Control procedure.

Call and chain together menus, input forms, reports, data


imports,

- even other programs - and

into a single

link all these actions

automated Control procedure.

among

Use global variables

Create state-of-the-art transaction processing applications that


automatically enter

form

to another,

INTERACTIVE

to pass values

new

procedures.

All users will find the

DQL

Lexicon an easy-to-use. rapid


resource for locating the
correct command syntax for
any query problem.

records, post information from one

and perform batch updates

in

multiple forms.

MODE

Although DQL Advanced Processing uses the DQL to manipulate


and retrieve information from a database, you don't have to spend
time memorizing the query language to use its power. To perform
even the most complicated procedures, all you have to do is make
selections from a series of menus.

DQL Advanced Processing


In Interactive

Mode, DataEase

activates a built-in editor that

prompts you at each step, lists all valid responses, and prevents
you from making syntax errors or spelling mistakes. Because all

features menu or command


driven query definition,
interactive prompts,

and an

automatic syntax checker.

Advanced Processing is supported by context-sensitive prompts,


even new users can easily create applications and generate complex
reports with a

1-1

minimum

of training.

Volume

INTRODUCTION TODQL ADVANCED PROCESSINC;


MODE

EDIT
As you

gain experience, you

the rapid

power

command-driven
In Edit

users.

may choose to work in Edit Mode mode preferred by DataBase

alternative

Mode you

DQL

enter

statements directly,

without the assistance of menus, prompts, or the syntax checker.

WHAT'S A QUERY?
A

query

is

a group of statements that

manipulate the information

Ask

Add,

Call other programs

in

DataBase how to

query can:

a question (e.g., which state has the most customers?)


delete, or

modify data

The DataBase Query Language


that tell

DataBase how

query

often called a report.

is

tell

a database.

words and symbols


The printed output from a
Figure 1-1 shows a report that
is

the group of

to process data.

incorporates a basic query and part of

its

report output.

SAMPLE QUERY AND REPORT OUTPUT


U.S.

Query

for

A query can

ask a question,
add. delete, or modify data,
and/or call other procedures
and external programs. The
printed output generated hy a
query is called a report.

STATE REPORT
Report Output

STATES;

Alabama

records
STATE NAME
list

In

Order

end

Alaska
Arizona
Arkansas
California

Colorado
Connecticut
Delaware
Florida

Georgia

Wyoming

Figure 1-1

Query

that Lists U.S. States in Alphabetical

Order

and the Report Output from the Query

Volume

1-2

DATABASE REFERENCE MANUAL


DQL PROCEDURES
In addition to asking questions, you can use a query to update or
modify data, as well as list information stored in the database like
the example shown above. When the DQL is used to manipulate
data, the query becomes part of a procedure. A DQL Procedure

consists of several elements:

Query - this

Format -

tells

DataEase what information

this tells

DataEase how

Print Style Speciflcation - this


the output. If the output

is

Data-entry

needed

to arrange the output.

tells

DataEase where

to send

sent to a printer, the Print Style also

specifies the page dimensions


characteristics

to process.

and any special printer

to generate the hard copy.

Form - optionally lets you enter additional

information to be used

in

processing just before running the

procedure.

Types

of

Procedures

There are two basic types of DQL Procedures: Processing


procedures and Control procedures.

Processing procedure

add, delete, modify,

list,

used to directly manipulate data - to


and sort data either for the purpose of

is

updating the information stored in database forms or for


generating printed reports.

A Control

procedure does not directly manipulate data. Instead, a

There are m'o types of DQL


Procedures: Processing
procedures and Control
procedures. Processing
procedures manipulate data.
Control procedures link
procedures together. You
can use conditional actions in
both types of procedures.

single Control procedure can be used to link any

number of other
procedures together (like the macros used in many of today's
programs). This makes it possible to automate the whole series of
transactions that occur in accounting, billing, inventory control,
order-processing, and retail point-of-sale systems where data

is

posted from one form to another and records are continuously


updated.

Conditional Processing

DQL

In addition to processing data

and linking transactions, the


includes a complete set of procedural commands (including case,
ir...then, and while...do) that let you use conditional processing in
both types of procedures
run the weekly

1-3

(e.g., if

today

is

the last day of the week,

summary procedure and backup

the database).

Volume

INTRODUCTION

TO DQL

ADVANCED PROCESSING

THE BASIC DQL VOCABULARY


The basic terminology that is used
composed of eight key elements:

Commands enter,

to create a

delete, modify,

and

DQL Procedure

list

is

records; call and

execute procedures or external programs; and generate output


either on the screen, on disk, or in a printed report. There are
three groups of

DQL commands: Processing Commands,

Control Commands, and Procedural Commands.

Operators

refine

commands; they

DataBase how to
by the query's
process records, what

The basic DQL vocabulary is


composed of eight elements:
commands, operators,
functions. keyv.'ords.
relationships, report

formatting commands,
symbols, and values.

tell

execute the various operations specified

commands

(such as in what order to

statistics to generate, etc.).

There are seven groups of DQL

Operators: Comparison Operators, Sorting and Grouping


Operators, Statistical Operators. Relational Operators,

Conditional Statistical Operators, and Relational Statistical


Operators.

Functions return a specified value in a different format.


The 58 DQL functions are divided into nine groups: Date,
Financial, If. Math. Scientific, Spell, Text, Time, and

Trigonometric.

special operations, such as creating


global variables, accessing system variables,

Keywords signal

temporary and
performing conditional actions, or retrieving values from a

Many powerful DQL features;


including all the functions,
relational statistical
operators, and report
formatting options; can also

be used with Quick Reports


to enhance their output
capabilities.

Data-entry form.

Relationships link records in different forms. In a DQL


procedure, you can use both predefined and ad-hoc
relationships to access the information in a related form.
the layout of text and field
Chapter
5 in this volume provides
values for a printed report.
detailed information on how to format a report.

Formatting Commands specify

Symbols

clarify, divide,

and conclude various statements

specified in a query.

Values are the actual data that is processed by the procedure.


A value can be any number, text or numeric character string.
Most values in a query are field values from the specified
forms.

All these terms are individually defined in detail in the DQL


Lexicon, the dictionary-style reference section at the back of this

volume.

Volume

1-4
3

DATABASE REFERENCE MANUAL


HOW TO USE THIS BOOK
This book

is

designed to be used as both a learning tool and a

comprehensive reference manual. Following


the information

Chapter

2.

is

organized

in five

Running Procedures

Defining, Modifying, and

how

provides a detailed explanation of

this Introduction,

sections as follows:

to create or

modify a

DQL

procedure including: modes and levels, prompting, and function key


assignments.

Chapter

Define Query:

3.

A Low

step-by-step example that explains

Level Interactive

Mode

that

Level Example

how

to create a

a simple,

is

query

in

Low

can retrieve information from a pair of

related forms.

Chapter 4. Define Query: A High Level Example is a detailed


example that demonstrates how to create a custom application using
High Level DQL commands to link several Processing procedures
into a single automated Control procedure.
Chapter

5.

Define Format/Print Style provides complete

guidelines for designing report output with numerous examples of


default

and special report formats

that

show you how

to control the

appearance of your reports.

Chapter

6.

The

DQL

Lexicon

is

a dictionary-style reference

command, function, and


DataBase Query Language. The terms are listed in
section that defines every

order, with punctuation

What To Read
you're a

new

feature of the

alphabetical

and other symbols presented

first.

First

we recommend

you first read the


in this manual to gain a basic
familiarity with the process of defining forms and queries.

If

user,

that

DataBase Tutorial and then Chapter 3

More experienced users will find


Chapter 4 introduces most of the

that the

DQL

High Level example

vocabulary

in the

in

process

of building a Control procedure to automate the order-fulfillment

^^"'

"'"'''''

''"'"''^

'"'''''"

"'"''

DatuEase Tutoncl.

system for a hypothetical mail-order catalog company.


All users will find the

DQL

Lexicon an easy-to-use, rapid resource


command syntax for any query problem and
detailed information on the use of each command (with examples).
for locating the correct

1-5

Volumes

INTRODUCTION

TO DQL

ADVANCED PROCESSING

TYPOGRAPHICAL CONVENTIONS
In

the Text

The

narrative text

printed in

Roman

UPPERCASE

is

printed in

type).

type

Roman

type (this paragraph

The names of forms are printed

is

in

(CUSTOMERS. INVOICES). The names

fields are printed in

of

SMALL CAPITALS (LAST NAME. ACCOUNT

DQL terms

are printed in lowercase bold type (for,


in a field (rather
list records, all, data-entry, etc.). When the value
than the name of the field) is meant, it is not capitalized (e.g., the

BALANCE).

customers" names).

Queries and report output are printed

in

Helvetica type as

shown

below:

Report Output

Query

for

STATES
list

Alabama

Alaska

records

STATE NAME

in

Arizona

order

Arkansas

end

Wyoming

The notes

printed in the margins contain important information on

options, and function key assignments. These


notes can also be used as a quick way to browse through the text.

DQL syntax,

On

menu

the Screen

Mode, DataEase displays DQL terms in lowercase


names
of forms and fields are automatically entered in
letters. The
used
in defining the form. When you are creating
the case that was
a query in Edit Mode, however, you can use upper or lowercase for

In Interactive

any part of the query.

When you

create a query, DataEase adds certain spacing and

indenting automatically.

spacing

if

you

like.

You can

DataEase doesn't care how commands are

spaced as long as the syntax

Volume

use different indenting and

is

correct.

1-6
3

DATAEASE REFERENCE MANUAL

Chapter 2

and

Defining, Modifying,

Running Procedures
hen you select

DQL Advanced Processing

(Option 4)

from the DataBase Main Menu, DataBase displays the

DQL

menu.

Procedures

Z.

Run Procedure
Start Neu Procedure

3.

Define Data-entry Fopm

1.

^iijam-niaar
Define Fornat
Define Print Style
7. Saue Procedure
8. Load Procedure
9. Delete Procedure
10. Print Procedure Definition

5.

6.

^=

ESC

[]

^ij

to [E

Bi

F9 3

lili

\:iMtMll

C:\DEASE\TUTORIftL\

Figure 2-

The

DQL menu

is

--

gjg]

Database

The

4/17/89

10:12 an

DQL Menu

the starting point for all actions that utilize the

DataBase Query Language. It's the primary tool that let's you
define, modify, save, and run (execute) DQL procedures.

DQL menu

QBE

Quick Reports menu


discussed in Volume
Chapter 3. There are ten options on the
DQL menu. Of these, eight are named and function like their
counterparts on the QBE - Quick Reports menu. The two different
options on the DQL menu are Define Data-entry Form (Option 3)
and Define Query (Option 4).

The

is

similar to the
1

2-1

The

DQL menu is the starting

point for defining, modifying,


running, loading, saving, and
deleting procedures and for
defining the Data-entry form.
Format, and Print Style for a

procedure.

Volume

DEFINING, MODIFYING, AND RUNNING PROCEDURES

The Define Data-entry Form option on

QBE

the

DQL menu

Quick Reports menu. It is


many features that make DQL Advanced Processing
powerful and versatile than Quick Reports.
counterpart on the

The Data-entry form is a special data input form you


you generate different information each time you run

has no

just
far

one of the

The Data-entry form

is

special data input form you


create that lets you generate

more

different information

create that lets

each

time you run a procedure.

a procedure.

For example, if you have a procedure that lists all the employees in
your company, you can define a Data-entry form with just one field
called DEPARTMENT. Then, just before running the procedure, you
can enter the name of any department on the Data-entry form.
When you run the procedure, DataEase lists only the employees for
the specified department.

For convenience, DataEase


each time the procedure

is

lets

you redisplay the Data-entry form


lets you run the

executed. This

procedure as often as you want, using different input each time.

Using this technique you can easily generate a separate report for
each department in the company simply by entering the name of
each department, one-at-a-time, on the Data-entry form.
Although you define and save a Data-entry form like a regular
Record Entry form, the information entered on a Data-entry form is
only used to process the current procedure - it's never stored in the

DataEase provides three ways


to input information in a
procedure: the Data-entry
form and the DQL input and
record entry commands.

Each of these commands is


compared with the Data-entry
form later in this section and
each has a separate entiy
the

in

DQL Le.xicon.

database. Think of

it as a blackboard on which you enter the


you want DataEase to process. After the procedure
DataEase erases the blackboard and you can then specify

specific data
runs,

different data before running the procedure again.

the DQL menu replaces two options


on the QBE - Quick Reports menu: Define Record Selection (option
3) and Define List Fields (option 4).

The Define Query option on

The query

is

the set of instructions that tells DataEase

the data to process and what to

do with

a series of statements that use the

communicate these
in

What form

Which

What

Volume

It is

DQL vocabulary

instructions. In order to process

a database, a query must

that data.

tell

where

to find

composed of

and syntax to
any information

DataEase three things:

(or forms) contain the data to process.

The query

is

the set of

instructions that tells

DataEase where to find the


data to process and what to
do with that data. A query
must tell DataEase three
things: what form (or forms)
contain the data to process:
which records to process in
each form: and what actions
to perform using the selected
records.

records to process in each form.

actions to perform using the selected records.

2-2

DATABASE REFERENCE MANUAL


QUICK SUMMARY OF THE DQL MENU OPTIONS
1.

Run Procedure

Run Procedure processes the procedure loaded in the computer's


memory. If there is no procedure in memory, DataBase prompts
you to select one from a menu that lists all the procedures available
in the

2.

database.

Start

Start

New

New Procedure
Procedure removes a previously loaded procedure from
this option when you want to create a new procedure,

memory. Use

or you want to

remove

the procedure that's currently in

Define Data-entry Form


Define Data-entry Form lets you

memory.

3.

used

at the start

define a special input form to be

of a particular procedure.

defined and filled

in just like a

Data-entry form

Record Entry form.

It's

is

most often

used to produce different output each time the procedure is run.


Once you have defined and saved the Data-entry Form as part of
a procedure, this

4.

menu

option changes to Modify Data-entry Form.

Define Query

Define Query gives you access to the DataBase Query Language.


Using the DQL, you create a query that can either ask a question,
manipulate data, generate output, or chain together any number of
separate data

management

operations.

When you

select Define

Query, you can use either Interactive Mode or Edit Mode to define
the query. Once you have defined and saved the query as part of a
procedure, this

5.

menu

option changes to Modify Query.

Define Format

Define Format lets you control the appearance of report output.


You can select one of nine predefined report formats, modify an
existing format, or create a custom format on the screen. If you

DataBase has nine predefined

skip this step, DataBase automatically creates a columnar report

custom, mailing label,


GrafTalk. and CrossView.

using field

names

as

column headings. Once you have defined and

report formats includini^:

columnar, field per

line,

record-entry, template, export,

this menu option changes


Modify Format. Chapter 5 in this volume provides detailed
information on how "to format printed reports.

saved the format as part of a procedure,


to

2-3

Volume

DEFINING. MODIFYING. AND RUNNING PROCEDURES

Define Print Style

6.

you control the type style, page size, and


The output can be sent to the
screen, a printer, or a disk file. The default destination is the
screen. Once you have defined and saved the Print Style as part
of a procedure, this menu option changes to Modify Print Style.

Define Print Style

lets

destination of the report output.

7.

Save Procedure

you permanently save a procedure as part of


select this option, DataEase prompts you
to name the procedure. If the procedure is already named,
DataEase asks whether you want to replace the original version

Save Procedure

lets

When you

the database.

with the current procedure or give the current procedure a different

name
8.

(saving both).

Load Procedure

Load Procedure

memory
list

of

you load a previously created procedure into


view it, modify it, or run it. DataEase displays a

lets

to either

the existing procedures in the database. Specify the

all

procedure you want to load by entering


corresponding number from the

9.

its

name

or the

list.

Delete Procedure

Delete Procedure

lets

DataEase displays a

you permanently delete


of

list

all

(erase) a procedure.

the existing procedures in the

database. Specify the procedure you want to delete by entering

name

or the corresponding

verify that

from the

you want

number from

to delete the

the

list.

You

procedure before

it

its

are asked to
is

removed

disk.

10. Print

Procedure Definition

Print Procedure Definition creates printed documentation for the

procedure.

.
It

\..

the layout and field characteristics of the Data-entry form,

if

has been created for the procedure.

NOTE:

includes the query detmition, the report tormat, and

one

You can quicklv and easily


generate a printed conv of the
///// definition of any DQL
Procedure.

Detailed e.xplanations of all these options except


Define Format and Define Print Style begin on the
ne.xt

page. For the explanation of these two options,


Chapter 5 in this volume.

refer to

Volume

2-4

DATABASE REFERENCE MANUAL


Run Procedure
How To

Execute a Procedure

processes the procedure currently loaded


The Run Procedure option
^
,,in the computer s memory. If there is no procedure m memory,
,

DataEase displays a
for

you

to select the

When you

list

of

all

the procedures in the current database

one you want

j
Procedure
executes
Run

the

procedure that's currently

in

memory.

to run.

Run Procedure, DataEase prompts:

select

Please select the procedure

and displays the names of


Procedures

in the

all

database

to run:

the

in a

Quick Reports and

window menu on

DQL

the right side

of the screen.

When you

press

RETURN,

DataEase may display a special input

screen (such as a Data-entry form) depending on


is

how

the procedure

defined. These input screens are labelled for easy reference.

the explanation of

how

to use

For

any of them, see the corresponding

section in this volume.

While executing a procedure, DataEase displays


message in the upper right comer of the screen:
Running procedure

When
want

the procedure

procedure before

to abort the

NOTE:

You can

select

hy typing
typing the
the

PROCEDURE NAME
finished, the

is

its

the following

DQL

DQL menu

it

is

reappears. If you

ESC.

finished, press

Procedure (or any menu item)

number, moving the

hii>hlight cursor,

name of the procedure. As you are

or

typing

name. DataEase highlights the first unique

match. Press

RETURN

to select the

highlighted

item.

2-5

Volume

DEFINING, MODIFYING. AND RUNNING PROCEDURES


Start

New Procedure

How to

Start a

New Procedure

The Stan New Procedure option removes


in the

computer's

the procedure currently

memory

so you can define, load, or run a

Once

a procedure has been loaded into

different procedure.

memory, you must use

the
in

this option before

New Procedure removes


procedure that's currently

Start

memorv.

you can define another

procedure.

When you

select Start

New

Procedure, DataBase displays the

message:

New
in the

Procedure Started

upper right comer of the screen. DataBase removes the

procedure that's currently

Data-entry

Form

option

to define a Data-entry

is

in

memory

(if

highlighted.

any), and the Define

You can

select this option

form or choose any other option

that

you

want.

NOTE:

You must

select the Start

New

Procedure option

before you can run any procedure that includes a


.call

Volume

command.

2-6

DATAEASE REFERENCE MANUAL


Define Data-Entry
What

Is

a Data-entry

The Data-entry form

is

Form
Form?

a special type of form that lets you enter

varying information each time you run a procedure. The Data-entry

form

is

part of the procedure, just like the

report format.

procedure.

commands

You can

query definition and the

create only one Data-entry form for each

The Data-entry form


special form that lets

a
you

is

input varyini^ information


each lime you run a procedure.

However, you can use the DQL input or record entry


to allow muhiple input forms for a procedure.

The infomiation entered on

form is often used to


by a query. For example, if you have a
query that lists customers in all 50 states, you can specify the name
of just one state on the Data-entry form and limit the resulting
report to customers in the specified state. Figure 2-2 shows a
Data-entry form that lets you specify a particular state
each time you run this procedure.
the Data-entry

select the records processed

rorn:

62

Data Entry Forn For Current Balance Report

Run procedure for CUSTOMERS uho

F4iiii;nia EsciaBii

Figure 2-2

Fzama F3Bin

When

the procedure runs,


field

in

State:

FsBiiiB F6i3Hn FTtiiaiwa fbii:hki Fiaiiiaiii:

Data-entry

STATE

Hue

it

Form Used

to Specify a Single State

uses the information entered

on the Data-entry form and

lists

in the

the customers for only

the specified state.

2-7

Volume

DEFINING. MODIFYING. AND RUNNING PROCEDLRES


Define Data-Entry

How To

To

Form

Display the Data-entry Form

create the Data-entry form, select Define Data-entry

DQL

(option 3) from the

menu. DataBase

Form

Select Define Data-entry


to create the Data-entiy

Form

asks:

form.
After running the procedure, display data-entry form again?

Answer no

if

you only want

to run the procedure

once

(rather than several times using different input information

you answer no, when you run the procedure, the


Data-entry form appears on the screen once at the start of the
procedure and you enter the specific data to be used in
processing the query. When the procedure ends, DataBase
returns to the DQL menu.

each time).

If

Answer yes

if

If you tell DataBase to display


the Data-entry form when the

procedure finishes executing,


you can run the procedure
over and over, using different
data each time.

you want to run the procedure more than once


before performing any other task. If you answer yes, each time
the procedure is completed, the Data-entry form reappears and
you can enter different data to be used in processing the query
as many times as you want. When you finish running the
procedure, press ESC when the Data-entry form reappears to
return to the DQL menu.

NOTE:

The Data-entry form is used to input data at the start


of a procedure. In addition, the DQL input
command can he used to input data at any point
during a procedure. For more information about the
input command, see the

Volume

DQL

Lexicon.

2-8

DATABASE REFERENCE MANLIAL


Define Data-entry

Form

Creating the Data-entry Form

how you choose to display the Data-entry form,


DataBase displays a blank screen on which you define the
Data-entry form. In general, you define the Data-entry form the
same way you do a Record Entry form. However, because the
information on the Data-entry form is not stored in the database (as
Record Entry information is), the Data-entry form ra/wor contain:
Regardless of

Indexed

Unique

Sequenced

Data-entry form

exactly like a

is

defined

Record Entry

form.

fields

fields

To save time, you can use the


F5 COPY key to create a
Data-entiy Form hy copvini;

fields

an existing Record Entry form.

Virtual fields
Fields

with security level options

Subforms

In all other aspects, defining the Data-entry

form

is

exactly the

same as defining a Record Entry form. You type in the form


and you press FIO FIELD to define fields on the form.

text,

also use the F5 COPY key to create a Data-entry form by


copying an existing Record Entry form or copying individual fields
from the Dictionary form. See Volume 2, Chapter 2. Form

You can

Definition

and Relationships,

for

more information on how

to

define a form.

2-9

Volume

DEFINING. MODIFYING, AND RUNNING PROCEDURES


Define Data-entry

Form

Using the Data-entry Form

When

you run a procedure that has a Data-entry form, the values


you enter on the Data-entry form are used according to the
instructions in the query. Each time the procedure is run, DataBase
displays the Data-entry form, lets you type in data, and then uses
this data to

process the query.

In addition to selecting the records to

Data

Variables used

Data used

Data

to

to

be entered or modified
in

in

or delete records in the


database: input variables used
in computations: insert data in
the report output: and in many
other ways that help automate
routine data-entiy and record
processing operations.

be processed by a query, a

Data-entry form can also be used to specify:

The Data-entry farm can he


used to select, enter, modify,

one or more database forms

computations

conditional processing

in

be printed in report output

Using a Relationship to Specify Data-entry Values


If

you define a relationship between a Data-entry form and another

database form, you can use a

Lookup formula

to automatically

from the database form to the Data-entry form.


For example, you can define a relationship between a form that

transfer information

You can use a relationship


lookup data in a database

form and

insert

it

to

in the

Data-entry form.

holds the sales tax rate for each state and a Data-entry form. Then,

when you

enter the state to process, the sales tax rate for this state

can be transferred to the Data-entry form each time the procedure

is

executed.

Specifying Data-entry Values


In a query,

you

tell

DataEase

in

Query

to use the field values

on the

Data-entry form by placing the keyword data-entry before the


field

name. For example, the query statement:


for

CUSTOMERS
list

with state

data-entry state

records

The keyword data-entry tells


DataEase to use the specified
value from the Data-entiy
form when processing the
query.

tells

DataEase to

specified in the

Volume

list

only the customers

STATE

field

who

live in the state

on the Data-entry form.

2-10

DATABASE REFERENCE MANUAL


Define Data-entry Form
Alternatives to Using

tlie

Data-entry

Form

The Data-entry form can only be used to input data at the


procedure. DataEase offers two other data-input methods

start of a
in

addition to the Data-entry form.

DataEase offers two data


input methods in addition
the Data-entry form: the

The DQL record entry command allows records to be entered into


a Record Entry form at any point during a procedure. The records
are directly entered into the database; they are not processed by the

query.

The

DQL

input

command also lets you use a Record Entry form to


It may be used at any point during a procedure.

input information.

The input statement provides


it

lets the

all the facilities of Record Entry, and


query process the records before they are entered into the

database.

The differences between the three data


summarized in the table below.

Data Input

Method

input

methods are

to

DQL

input and record entry

commands. For detailed


information on each, see the

DQL Lexicon.

DEFINING, MODIFYING, AND RUNNING PROCEDURES


Define Data-entry Form
Saving the Data-entry Form

After you finish creating the Data-entry form, press F2


save

it.

When you

press F2, the Data-entry form

is

SAVE

Press F2 SAVE to save the


Data-entry form on disk as a
part of the procedure.

to

saved on disk

as part of the procedure.

The information entered


saved on disk;

it

is

into a Data-entry form,

only saved

memory. The information

is

in the

however,

is

never

computer's temporary

erased whenever you

start

new
The Data-entry form
definition can he saved on

procedure or load a different procedure into memory.

disk: Data-entry values are

Recalling Data-entry Values

When

never saved.

the Data-entry form reappears after the procedure

is

run,

it

is

completely blank. Press SH-F5 to recall the Data-entry information


that

was

just used

value for the field

Volume

by the procedure. Press SH-F6


in which the cursor is located.

to recall

only the

2-12

DATAEASE REFERENCE MANUAL


Modify Data-entry Form
Modifying the Data-entry Form

After the Data-entry form

option Define Data-entry

Form.

When you

is

created and saved, the

Form changes

select this option to

Data-entry form, DataBase

first

DQL menu

Modify Data-entry
view or change the
to

Modify Data-entry Form

is

used to modify or delete the


Data-entty form itself.

asks:

Delete the Data-entry Form?

If

Answer no

Answer yes if you want to delete the existing form and/or


define a new Data-entry form. The form is deleted and the
DQL menu remains on the screen.

to

view or modify the Data-entry form.

you answer no, DataBase asks:


After running the procedure, display data-entry form again?

Answer no

or yes depending on whether you plan to run the

procedure again using different data-entry input each time.

When

the Data-entry

way you modify

form

is

displayed, you can modify

a Record Entry form.

it

just the

Remember, however,

if you
add or delete fields on the Data-entry form, you must also modify
the query to reflect those changes.

2-13

You modify the Data-entry


form just the way you modify
a Record Entry form. If you
add or delete fields on the
Data-entry form, you must
also modify the query to
reflect those changes.

Volume

DEFINING, MODIFYING. AND RUNNING PROCEDURES


Define Query
The DataEase Query Language (DQL)

The DataEase Query Language (DQL)

commands

that let

in

tell

sets of instructions are called queries or

query can be simple and direct

live in Connecticut?), or

it

total

The DataEase Query


Language is used to define
questions and sets of
instructions called queries or

procedures.

DQL procedures.

how many of our customers


(How many units
in December? What was the

(e.g.,

can be more complex

of a particular catalog item were sold

value of these sales, and what percentage of that total was

purchased by customers from


is

a powerful group of

DataEase how to
your database. These questions

you ask questions or

manipulate the information stored

and

is

often a

list

New

of items that meet

all

England?). The answer (which


the criteria of the query)

is

called a report.

A more
Advanced Processing capabilities
might be a set of instructions that tells DataEase: when the user
named Carol signs on to the database named DAILY after 5:00
But DataEase can do more than answer tough questions!
sophisticated use of the

DQL

P.M., run the procedure that posts the day's transactions into
several related database forms, print the corresponding invoices and

shipping labels, and generate a

list

of inventory items that have to

be reordered.

DQL Output
Many DQL procedures

when you
records command, DataEase

generate output. For example,

run a procedure that contains a

list

processes the query and generates output

list

of records selected

by the query. Output can be displayed on the screen, printed, or


saved as a file. A visible form of output, particularly when printed
on paper, is commonly called a report. Chapter 5 in this volume
provides detailed information on how to format report output.

Some

procedures create output that

modifies records

in the

is tiot

visible.

database, for example,

A query

may

or

may

that

not

display the modified result. There are also procedures that do not

generate any output.

For example, a query that deletes a group of

records does not generate output.

DQL

output that

is

saved

in a

disk

file

can be converted by one of

the DataEase export formats for use by other programs such as

WordPerfect and Lotus

Volume

The output from a DQL


Procedure can he sent to one
of three destinations: the
computer screen, a printer, or
a file saved on disk. Visible
output printed on paper is
called a report.

1-2-3.

2-14

DATAEASE REFERENCE MANUAL


Define Query
Interactive

Mode

When you

select

Interactive

Mode.

Define Query. DataBase automatically enters


In this mode, DataEase prompts you through

each step of creating a query;

lists all

it

the valid responses for each

prompt, offering only syntactically appropriate

commands

or values

and eliminating needless typing.

//(

Interactive

Mode.

DQL

automatically checks the


syntax and spelling in a query.
This lets you concentrate on
the business at hand rather
than

programming

details.

In Interactive Mode, you choose the appropriate forms, fields,


commands, functions, and operators to create a query from a series
of menus that appear on screen. Figure 2-3 shows one menu that
appears in Interactive Mode.
4 C

Processing procedure

This is

City

State

Specify the iteMs to be listed.


Select field nane

Spouse 3: Street
for CUSTOMERS
uith CURRENT Balance
sea
list records

4:

F4 lll!lilj RSr iaaii Fi rilSra FS W^lll OUERV LEUEL

Figure 2-3

Changing

5:

[^^1

Interactive

b:

Zip

MODE IliUJJ-.IJIUia

Mode

Screen

Move

l\/lodes

Mode, DataEase provides an Edit Mode


you enter DQL query statements without the assistance of
Interactive prompts and menus.

in addition to Interactive
that lets

To

switch from Interactive

the cursor toward the

Edit

2-15

Mode

left

to Interactive

Mode

into Edit

Mode, you simply move

the cursor

up or toward

side of the screen to


change from Interactive Mode
the

left

into Edit

Mode. Press Fl

INTERACTIVE to change
from Edit Mode to Interactive
Mode.

To switch from
INTERACTIVE.

or the top of the screen.

Mode,

press Fl

Volume

DEFINING. MODIFYING, AND RUNNING PROCEDURES


Define Query
Interactive

Mode Prompts and Menus

Throughout the process of creating a query, DataBase displays


prompt messages near the top of the screen that tell you what action
you are trying to accomplish, such as:
Specify the items to be
Select

0:

NONE

field

listed.

name

CUSTOMER NAME

2:

ADDRESS 3: CITY 4: STATE 5: ZIP

Beneath the prompt, DataBase displays a numbered


the valid responses to this prompt; in this case,

it

line

MORE

F1

menu

displays a

of

list

all

of

all the field names defined in your database form (e.g., CUSTOMER
NAME, ADDRESS, STATE, ZIP). If there are too many choices to fit

on one

line, press

window on

When you

MORE to display the rest of the choices in a

Fl

the right side of the screen.

choose a value from the menu,

When all available choices


don't fit on a single line menu,
press Fl
to open a

MORE

window menu of choices.


it

is

automatically

inserted into the query at the current cursor location.

How To Bypass

Interactive

Mode

l\1enus

For each prompt, DataBase displays a numbered


choices.

In

many

cases, the first choice listed

don't want any of the


Alternatively,

menu

you can press

is

items shown, enter

TAB

to

list

Many prompts

of valid

NONE. If you
to select NONE.

0:

bypass the current

menu

cause a series
of menus to appear. If the
choice you want is not on the
first menu, you can skip to the
next menu by pressing TAB.

choices and access the next menu.

Some prompts

value) instead of simply selecting a

prompt, always press

When

menu

item.

To bypass such

you're prompted to enter a constant value,

recommend that you use


skip a menu choice.

TAB.

valid numeric response (instead of 0:

Volume

To cycle through all the menus


in Interactive Mode, press
TAB once for each menu you
want to bypass.

ask you to enter information (text or a numeric

TAB

NONE).

(instead of 0)

For

is

treated as a

this reason,

we

whenever you want

to

2-16

DATABASE REFERENCE MANUAL


Define Query
Typing

DQL Commands in

Interactive

Mode

You can type letters, words, and punctuation symbols in Interactive


Mode instead of waiting for a prompt. For example, you can type a
semicolon or a period where such punctuation
of repeatedly pressing

TAB

until the

menu

is

required, instead

that offers that

punctuation symbol appears.


If you type DQL words or symbols ahead of the prompting,
DataBase immediately displays the appropriate prompt.

When

typing

commands

unless prompted to

do

selection in Interactive

NOTE: When you

If you're familiar with the

DQL. you can always

type

ahead of the prompts in


Interactive Mode. However,
never type numbers unless
prompted to do so: DataBase
treats a number as a menu
selection in Interactive Mode.

Mode, never type numbers


DataBase treats a number as a menu
Mode.
in Interactive

so;

ahead of the prompting, you must


and symbols and insert the
required spaces yourself. DataBase does not
complete a word for you even if it is uniquely
type

type complete words

spelled.

2-17

Volume

DEFINING, MODIFYING. AND RUNNING PROCEDURES


Define Query
High Level and Low Level

Mode

Interactive

divided into two levels: a low level for basic

is

querying, and a high level that

lets

procedures. Press F9

Low Level

LEVEL

to

into

you perform sophisticated

transactions and chain together multiple database

management

change from one level

Mode is divided
Low Level and High
Level. Press F9 LEVEL to

Interactive

change from one

to the other.

level to

another.

from the database, but not


lets you use the
current time) and
values
(such
as
current
system
form,
Data-entry

you

lets

retrieve information

add, modify, or delete records.

the
let

DQL

relational operators.

Low

Level also

DQL relational

The

you retrieve information from related forms

operators

in the database.

High Level gives you access to the full power of the DataEase
Query Language, including mathematical operations, 58 built-in
functions, and procedural and non-procedural

commands

you create complex reports and sophisticated

transactions.

that let

In

High

Level, DataEase can automatically add, delete, and modify records;

and handle point-of-sale


inventory recordkeeping, and other automated

Low Level

lets you ask


and report the
ansM'ers. but you cannot add,
modify, or delete records from
the database. High Level lets

questions

you

link together

procedures

post information into multiple forms;

and build powerful custom

processing, billing,

applications.

transaction processing requirements.

When you

select Define

automatically enters

Query on

Low

DQL

for

want

to erase this default

command

in the

the

DQL menu,

Level Interactive

upper

left

comer of

command and

DataEase

Mode and

displays the

the screen.

restart the

If

you

query in High

Level Interactive Mode, follow these steps:

Press

HOME to move the cursor to the

upper

left

the screen. DataEase switches from Interactive

Edit Mode

2.

Press F7

3.

Press

4.

Press Fl

F9

into

(explained on the next page).

DEL

to delete the for

LEVEL

You can now

comer of

Mode

to switch into

INTERACTIVE

command.
High Level.

to return to Interactive

Mode.

define a High Level query with the help of

DataEase's Interactive menus.

Volume

2-18

DATAEASE REFERENCE MANUAL


Define Query
Edit

Mode

When you

select

Modify Query from the

DQL

menu, DataBase

automatically enters Edit Mode. In Edit Mode, you type the query
directly

menu

on a blank screen. DataBase does not prompt you with

choices.

Edit

Mode when you


you want
Edit

Mode

can be

much

are familiar with the

quicker than Interactive

DQL

and know exactly what

to do.

Mode

Edit Mode is used to create a


query, nwdify a query, add

can be used to create a query or modify a previously

defined query. In Edit Mode, you can freely

move

the cursor

comments, or correct errors


made while working in

around the screen and type specific DQL statements more rapidly
than selecting choices from the Interactive Mode menus. For this
reason, many experienced users work mainly in Edit Mode and
switch to Interactive

Mode

form and

to quickly select

field

names

Interactive

Mode.

if

they want help from the prompts.

To

create a query in Edit

Mode,

first select

Define Query from the

DQL menu. When

the first prompt appears, simply move the cursor


toward the left side of the screen. The prompt disappears and
DataBase switches into Edit Mode. Now you can just start typing
in the query on the blank screen. If you can't recall the correct

DQL

syntax, press Fl

Mode and

Mode

INTERACTIVE

to switch into Interactive

tlie

tlie left

cursor up or toward

side oftlie screen to

change from Interactive Mode


into Edit Mode. Press
El INTERACTIX'E to cliange
from Edit Mode to Interactive
Mode.

bring the prompts up to help you.

comments, or copy
blocks of text. If you make an error or want to change a query
while working in Interactive Mode, just move the cursor up or left
to switch into Edit Mode. In Edit Mode you can backspace, type
over mistakes, add comments, and use the function keys F3 CUT,
F5 COPY, F6 PASTE, F7 DEL LINE, and F8 INS LINE exactly as
you do in Form Definition. To return to Interactive Mode, press
Fl INTERACTIVE, and the prompting resumes immediately.
Edit

Move

is

also used to correct mistakes, add

You can annotate your queries


Edit Mode. See Comments
in the DQL Lexicon for an

in

explanation

comments

to

oflww

to

add

a query.

Syntax Errors
DataBase helps you create queries by preventing you from saving a
query that contains a syntax error. DataBase checks the entire
query and places the cursor on the first syntax error it detects. All
syntax errors must be corrected before a query can be saved.

If you press F2 SAVE to save a


query that contains an error.

DataEase automatically
switches to Interactive Mode
and positions the cursor on the
first error.

2-19

Volume

DEFINING. MODIFYING. AND RUNNING PROCEDURES


Modify Query
Modifying a Query

in Edit

Mode

After you define a query. Option 4 on the DQL menu changes from
Define Query to Modify Query. When you select Modify Queiy,
DataEase begins in Edit Mode when the query displays on the
screen.
In Edit

Mode you

can

make any changes you want

appropriate keys to insert, delete, and alter text (including the

CUT. F5 COPY. F6 PASTE. F7 DEL LINE, and


F8 INS LINE). If you need prompting, move the cursor to the
problem and press Fl INTERACTIVE to switch to Interactive
Mode.
function keys F3

When you

modifying the query, press F2


modified query and return to the DQL menu.
finish

Copying From One Query

SAVE

Mode \ou can use F3


CUT. F5 COPY. F6 PASTE.
F7 DEL LINE, and F8 INS
LINE to insert, delete, and
In Edit

using the

alter text.

to save the

Another

to

DataEase lets you define up to 2,000 procedures per database.


As your list of procedures grows, you may find it convenient to
copy part or all of a query and use it in another query. DataEase
provides two ways to do this:

For convenience, DataEase


existing query and use

it

lets

you copy

is

displayed, use F5

Do you want

to

or part of an

as a starting point for a

as an addition to another existing query.

exit this procedure.

all

COPY to copy

all

new query

While the

or part of

it,

first

or

query

or as an addition to another

and then

existing query.

DataEase prompts:

Paste Block

in

For convenience, DataEase


lets you copy all or part of an
e.xisting query and use it as a
starting point for a new query

another Query?

Answer yes to this prompt. Now load an existing procedure


start a new procedure, and select Modify Quer\' (or Define
Query). Then use F6 PASTE to paste the copy of the first

or

query into the second query.

OR
Save Procedure and save the existing query under a new
name. This lets you keep the original procedure intact as well
as use the new ly named copy as the starting point for defining a

Select

new

Volume

procedure.

2-20

DATABASE REFERENCE MANUAL


Modify Query

How to

To

Switch Modes

switch from Interactive

Mode

to Edit

cursor toward either the top or the

left

When you

Mode

switch from Interactive

Mode, simply move

the

side of the screen.


to Edit

Mode,

the

prompts and menus are removed from the screen.


In Edit Mode, you can easily make corrections or type in the
whole query without waiting for menu choices to appear.
interactive

To switch from Edit Mode


INTERACTIVE.

When you

to Interactive

Move

the cursor

up or toward

side of the screen to


chanf>e from Interactive Mode
the

left

into Edit

Mode. Press Fl

INTERACTIVE to change
from Edit Mode to Interactive
Mode.

Mode, press Fl

Mode to Interactive Mode, DataEase


menu for the current cursor position in the

switch from Edit

displays the appropriate

query.

2-21

Volume

DEFINING. MODIFYING. .AND

N N

N G

PROCEDURES

Save Procedure
Saving a Query

In

Memory

While you are working on a query, you can press F2 SAVE to save
what you have entered up till now. The following actions take place:
DataEase scans the query

If there are

2.

to Interactive

first

error

it

If there are

3.

any errors

you

to

be sure

in the quer\'.

Mode w ith

it

is

Press F2
in

SAVE to save

a query

memory.

correct.

DataEase returns

the cursor placed

on the

detects.

no

errors,

menu from Low

DataEase returns

Level.

places the cursor

at the

In

to the

DQL

High Level. DataEase

end of your work ready for

additional input.

When you

F2 SAVE, DataEase saves the query in memory: it


does not create a disk file. The query remains in your computer's
temporary memory until you start a new procedure, load a new
procedure, delete the procedure, or exit from the DQL menu. To
save the query on disk, use the Save Procedure option on the DQL
menu as explained on the next page.
press

Automatic Syntax Scan


If you're in Interactive Mode. DataEase automatically scans the
query for errors and returns you to the DQL menu when you

answer the
In

Low

last

appropriate prompt.

Level Interactive Mode,

Any more items


if

you press

TAB

to

be

when DataEase prompts:

listed?

(or select

NONE), DataEase

automatically scans

the query.
In

High Level

Interactive

Mode, when DataEase prompts:

Select the desired action

The Automatic Syntax Scan


feature checks the quetyfor
errors and returns you to the
DQL menu as soon as you
indicate that there are no
more list items (in Low Level)

or no more actions
if

you press

TAB

(or select

NONE), DataEase

automatically scans

(in

High

Level).

the query.

Volume

i.il

DATAEASE REFERENCE MANUAL


Save Procedure
Saving a Procedure

To permanently save
(option 7) on the

On

Disk

on disk, select Save Procedure


menu. DataEase prompts:

the query

DQL

Save Procedure saves a


procedure on disk. The name
of a procedure can he up la 20
characters in length.

Please enter the procedure name:

The procedure name can be up to 20 characters long. It can be any


name you like, but all procedures and forms in the same database
must have unique names. After you specify the name and press the

RETURN

key. DataEase saves the procedure on disk.

When you

select

Save Procedure,

if

the procedure

was previously

saved, DataEase asks:

Do you want to save


name?
If

you answer

yes,

the modified procedure under another

DataEase asks:

Please enter the new procedure name:

new procedure name, the modified procedure


saved under the new name. DataEase also retains the original
(unmodified) procedure under the original name.
After you enter a

If

is

you answer no, DataEase saves the modified procedure under the
name. The original procedure is deleted.

original

NOTE: When

using DataEase on a Local Area Network,


you
attempt to save a procedure while any other
if

user is viewing or running it, DataEase displays a


Resource Conflict message. See Volume 2. Chapter

System Administration, for more information about


Multi-User operations.
4,

'23

Volume 3

DEFINING, MODIFYING, AND RUNNING PROCEDURES


Load Procedure
Loading a Procedure

into

Memory

In order to view, modify, or run a previously defined procedure,

you must load the procedure

into

your computer's temporary

""'^

memory.

To

Load Procedure loads a


previously defined procedure

load a procedure, select

menu. DataEase

Load Procedure (Option

8)

on the

''"'

computer's memory.

DQL

asks:

Please select the procedure

to load:

DataEase displays the names of all the previously saved Quick


Reports and DQL Procedures in the current database in a window
menu on the right side of the screen. You can load either a Quick
Report or a DQL Procedure.

DataEase displays the

DQL menu.

The

DQL menu

options that

begin with the word Define are changed from Define to Modify
for each part of the procedure that was previously defined (i.e..
Data-entry Form, Query, Format, Print Style).

Once

a procedure

is

loaded you can choose any of the

menu

options to modify the procedure, including Modify Data-entry

Form, Modify Query, Modify Format, or Modify Print


If

you load a Quick Report from the


Convert

this

(Quick Report) into a

DQL

DataEase asks:

Procedure?

Quick Report to a DQL Procedure. If


DataEase immediately exits from
Processing and displays the QBE - Quick Reports menu.

Answer yes

to convert the

you answer no

DQL

QBE

DQL menu,

Style.

Volume

to this question,

2-24

DATABASE REFERENCE MANUAL


Load Procedure
Converting a Quick Report into a

Many

powerful

DQL features,

DQL Procedure

including any of the functions or

added to a Quick Report


using the Report Field Definition screen to enhance its output

relational statistical operators, can be

capabilities.

In addition,

DataBase

you convert a Quick Report

lets

Procedure with a single keystroke. Once

it

is

into a

DQL

converted, you can

use the procedure just like a procedure created with the Define

Query option on

To

the

DQL

DQL

Procedure, either:

Load Procedure (Option 8) on the


name of the Quick Report.

DQL menu

and

OR
With a Quick Report

in

memory,

Using either method, answer yes


Convert current

QBE

Quick Reports.

The Query By E.xample format


used in Quick Reports can

specify the

menu.

convert a Quick Report into a


Select

You can create a DQL


Procedure independently or
by converting a Quick Report
into a DQL query. For
information on how to define a
Quick Report, see Volume I
Chapter 3. Query By Example

DQL key.

press the F9

to the question:

(Quick Report) into a

DQL

automatically he converted
into a DQL Procedure with a
sin,^le keystroke. This is a
good way to learn how to use
the DQL - convert a simple
Quick Report into a DQL
Procedure and then view the
query.

Procedure?

DQL menu appears and the Quick Report definition is


converted to a DQL query. The query can then be edited through
the DQL menu Modify Query option.

The

NOTE: When

you save a converted Quick Report as a

Procedure, the Quick Report

is

both versions on disk, save the

forfeited.

DQL

To

DQL

retain

Procedure

under a different name than the Quick Report. Also,


once you convert a Quick Report into a

DQL

Procedure, you cannot reverse the process


it

hack

3, for

2-25

into a

Quick Report. See Volume

to
,

change

Chapter

complete information on Quick Reports.

Volume

DEFINING. MODIFYING. AND RUNNING PROCEDURES


Delete Procedure
Permanently Removing a Procedure

To permanently remove

a procedure from the database,

first select

Delete Procedure (option 9) on the DQL menu and then select the
procedure you want to delete from the windovv menu. DataEase

Delete Procedure permanently


removes a procedure from the
database.

asks:

Please select the procedure

When you

be deleted:

select a procedure to be deleted,

Are you sure you want


If

to

DataEase prompts:

to delete it?

you answer no. the request is cancelled. If you answer yes. the
is permanently removed from the database and cannot be

procedure

recovered.

Volume

2-26

DATABASE REFERENCE MANUAL


Procedure Definition

Print

Printing the Definition of a Procedure

The Procedure Definition is a printed summary of the procedure


that is similar to the summary created by pressing SH-F9 PRINT
in Form Definition. The definition is composed of the following
four items:

Print Procedure Definition

summary of the
procedure that's currently in
memory, inchuUng the query,
the Data-entry form, the
prints a

format, and field descriptions.


1

2.

copy of the query.

copy of the Data-entry form

if

one

is

defined for the

procedure.

3.

copy of

80-column
4.

the format as

it

would appear printed on an

printer.

description of each field included in the format.

The

field description includes the Field

Name, Type,

Length, and a yes or no answer indicating whether


leading and trailing spaces in the field are to be

removed when

To

the output

print the definition of the

is

displayed.

procedure currently

Print Procedure Definition (option 10) on the

you

in

DQL

memory, select
menu. When

DataBase automatically sends the output


At the end of the output, DataBase lists the
amount of memory it requires to store the procedure definition.
select this option.

to

the default printer.

An example

of a printed Procedure Definition

is

shown

in

Figure 2-4 on the next page.

NOTE: The

Print Procedure Definition cannot he used to

display the Procedure Definition on the screen.


If you select this option

and

there

is

no correctly

configured printer connected to the computer,

DataBase displays an error message and cancels


the print command.

2-27

Volume

DEFINING. MODIFYING. AND RUNNING PROCEDURES


Print

Procedure Definition

Procedure Definition

Example

QUERY
for

CUSTOMERS
list

records

FIRST

NAME

LAST NAME

ADDRESS
CITY

STATE
ZIP

end

FORMAT
10

20

30

40

50

60

70

80

+ + +. +- +. +. + -+- + + + + +-+- +-

.Items

Name
Address
.end

+ + + + ++++ +- +- +- +- +- +- +-
10

20

30

FIELD DESCRIPTIONS
Mo

40

50

60

70

80

DATAEASE REFERENCE MANUAL

Chapter 3
Define Query:

A Low

Level Example
how to create a query in Low Level
Mode, we have defined two forms named

o demonstrate
I

Interactive

CUSTOMERS

and

INVOICES

as

shown

Figure 3-i. The

in

forms share a predefined relationship based on the linking

CUSTOMER

Both forms store the same information

# field.

in this

a unique number assigned to each customer.

field:

CUSTOMERS

INVOICES

Starling on this

page

is

step-hy-step example that


demonstrates how to create

Field

Names

Field

Names

a query

\ INVOICE #

CUSTOMER NAME
r ADDRESS
1.

DATE

o.

CITY

^.

CUSTOMER*

".

STATE

".

PART#

..

ZIP

ACCOUNT BALANCE
CUSTOMER #

,.

8.

Primary Form

in

Interactive

Low Level
Mode.

As you read through this


example, you don't have to
actually perform the
keystrokes mentioned in the

DESCRIPTION
QUANTITY

text. Just mentally follow the


prompts, referring to the DQL
Lexicon for an explanation of
any terms yon don'
understand.

COST EACH
ORDER TOTAL

Secondary Form

If you

want

to perform the
you have to first
define the forms and fields.
For information on how to
create forms, see Volume I
Chapter 2. Form Definition

keystrokes,

Figure 3-

The

CUSTOMERS

to the

INVOICES

CUSTOMERS

- Low

Level Example Database Forms

form

said to have a one-to-many relationship

form, there

INVOICES form

(all

The INVOICES form


the

CUSTOMERS

the

INVOICES form

CUSTOMERS

3-1

is

form. This means that for any one record

may

be

many

related records in the

same CUSTOMER

the invoices that have the


is

#).

said to have a many-lo-one relationship to

form. This
related to

means

there

may

any one record

be

many

and Relationships.

in the

records in

The example is based on the


forms shown in Figure .?-/.
The fields are numbered on
the DalaEase menus in this
example exactly as they're
numbered in this figure.

in the

form.

Volume

DEFINE QUERY:

LOW LEVEL EXAMPLE

THE PURPOSE OF THE QUERY: A REPORT


In this example,
The

we want

to generate a report that displays:

customers' names listed

in alphabetical order.

The

The balance each customer owes

date of each customer's most recent purchase.


us.

The customers' names and account balance data

CUSTOMERS
INVOICES

form; the date of each purchase

form.

To

generate the report,

are stored in the

is

we have

stored in the
to create a

query

DataEase to combine information from these two forms


and display the output as a screen report. Figure 3-2 is a sample of
the type of report output we want (although it hasn't yet been
that tells

alphabetized).

Sample Report Output


CUSTOMER NAME

DATE OF PURCHASE

Jensen, Dave
Fisher, Jay
Cooper, Mary

Davis,

Pam

Ivers, Clark

Adams, Sam
Baker, Fred
Evans, Rick
Hill,

$210.00
S195.00

12/30/89
12/20/89
12/10/89
12/24/89
12/22/89
12/18/89
12/15/89
12/27/89
12/31/89
12/19/89

Gomez, Louis

Brenda

Figure 3-2

ACCOUNT BALANCE

;;350.00

S725.00
S175.00
;;675.oo

S595.00
;;240.oo

S865.00
S525.00

Account Balance Report

we want to generate,
who purchased something in
we want to know the date of each

Figure 3-2 represents the type of report

but

it

includes only the customers

December. In our report,


customer's most recent purchase, regardless of which month

it

was.

WHICH RECORDS TO SELECT


As we

create the query, we're also going to

add selection

who owe

criteria to

more than

limit the report to only those

customers

$500.

DataEase which records


want DataEase to select only the

In a query, the selection criteria

to select for processing.

Volume

We

tell

us

Selection criteria

DataEase

tell

to select

some

rather than all the records in a


form when processing a query.

3-2

DATAEASE REFERENCE MANUAL


CUSTOMERS

records in the

500

we must

In creating any query,

What form

Which

form

ACCOUNT BALANCE

in the

What

that

have a value greater than

field.

tell

DataBase

at least three things:

(or forms) contains the required data.

records to process in each form.

action to perform on the selected records (in this

we want

example,

to

list

the information in those records in our

report).

CREATING THE QUERY


To begin

creating the query for the Account Balance report, select

Define Query (Option 4) from the DQL menu. DataBase switches


to Interactive Mode and displays the word for in the upper left
hand comer of the screen. The word for is a DQL command that
is

always the

first

word

in a

Low

The DQL command for is


always the first word in a Low
Level query.

Level query.

The for command

tells DataBase from which form to gather


information for the report. If information is gathered from more
than one form, the first form specified in the query is called the

Primary form, and the other forms are Secondary forms.

The for command


form and perform
After

all

record

is

DataBase

to select records in a particular

the specified actions on each of those records.

the actions are performed for the first record, the next

and

read,

continues until

Now,

tells
all

let's

all

all

the actions are performed again. This

The menu
1

On

begin to create the query.

the screen, the prompt

name

line lists the available

SYSTEM 2: CUSTOMERS

NOTE: These

3;

forms from which you can pick:

INVOICES

4:

menu choices

example are valid only

F1

MORE

Low

Level

INVENTORY

are the only forms used in the

example. The

that

if you

appear

additional prompts

The first form named in a


queiy is called the Primary
form. A form related to the
query's Primary form is called
a Secondary form. A form
related to a Secondaiy form is
called a Tertiary form, etc.

in this first

are defining a

Level query. In High Level, there are

3-3

each of those records.

the records in the form have been processed.

line reads:

Select form

The for command tells


DataBase to select records in
a particular form and perform
all the specifed actions on

Low

many

and commands.

Volume

DEFINE QUERY:

LOW LEVEL EXAMPLE

The form you select from this first menu is the Primary form for
the query. The Primary form should be the form that holds the key
data you want to view or manipulate.

forms that are related


example.

The Primary form

for

later in this

The Primary form

the

is

form

CUSTOMERS.

is

the form

that holds the key data

want

for this query

after the for

also access data in

Primary form, as you'll see

to the

customers' names, so select

form name

You can

to

you

view or manipulate.

that contains the

DataBase adds the

command. The query now

reads:

CUSTOMERS

Next, DataBase prompts:

Any record

selection criteria?

and offers two choices:


0:

NONE

with

DataBase is asking if you want it to use all the records in the


Primary form, or use certain criteria to select only some of them.
We only want to see some of the records - the records for
customers who have an account balance greater than S500.

You

DataBase

tell

inserting the
that

that

you want

keyword with

you want

to include selection criteria

in the

to select only

query.

by

Select with to indicate

some records from

the

CUSTOMERS

form. The query reads:


for

The keyword with tells


DataBase that you want

CUSTOMERS

to

specify selection criteria.

with

DataBase displays another prompt:


Select

0:

NONE

Now

field

name

CUSTOMER NAME

DataBase

is

ADDRESS 3:

asking for the

selection criteria is based.

customers

2:

who owe

us

We

CITY

name of

4:

STATE

the field on

want DataBase

more than $500.

5:

In

ZIP F1

MORE

which the

to select only those

DQL,

this criterion is

specified by the following statement:

Volume

3-4

DATABASE REFERENCE MANUAL


ACCOUNT BALANCE

> 500

To

insert this selection criterion into the query, first press

Fl

MORE

Now

to see the rest of the fields in the

account balance. The query

select

form.

CUSTOMERS

for

with

Now

CUSTOMERS

reads:

account balance

DataEase prompts:

Select a comparison operator or not'


2:> 3:<

4:

<=

5:

6:

between

7:

There are seven

not

DQL

Comparison Operators:

DataEase is now asking us to specify exactly what selection criteria


we want to use to select records. Since we only want records for
customers who have an account balance greater than $500,
select

>

(the greater than symbol).

The query

= {equals). > (greater than}.


< (less than), <= (less than or
equal to). >= (greater than or
equal to), between, and not.

reads:

CUSTOMERS

for

with

account balance

>

DataEase displays another prompt:


Specify comparison value
Select field name

We

don't want to compare the current balance to a field value. We


to compare it to a numeric constant (500). Press TAB (or 0:
NONE) three times to skip the next three prompts until the
following prompt appears:

want

Specify a constant value


Enter a numeric string without punctuation. To skip

hit

TAB

Now DataEase is asking us to finish the selection criteria by


comparing the account balance to a specified numeric value.
We want to see a list of customers who have an account balance
greater than S500. so type

statements or punctuation to
the query. When typing a

CUSTOMERS

currency value in a query, do


not include the dollar sign.

with

3-5

the Spacebar.

reads:

The query now


for

500 and then press

After entering a constant value

you must insert a space before


you make any additional menu
selections or add any further

account balance > 500

Volume

DEFINE QUERY:
Next, DataBase asks

if

you want

to specify

LOW LEVEL EXAMPLE

any additional selection

criteria:

Any more
0:

NONE

and

criteria?

2: or

To specify more selection criteria (such as only those who


purchased something last month) we'd select and and follow the
same procedure to specify the additional criteria. However, since
we don't want to specify further criteria, press TAB (or select
NONE). DataBase displays a different prompt:

The keywords and and or are


used to combine different sets
of selection criteria.

Low Level, when you tell


DataBase there are no more
In

Specify the items to be


Select

0:

NONE

listed.

selection criteria,

name

field

CUSTOMER NAME

2:

ADDRESS 3: CITY 4: STATE

5:

ZIP F1

MORE

Beneath the menu, the query reads:


for

CUSTOMERS
ACCOUNT BALANCE > 500

with
list

it

automatically places a
semicolon at the end of the for
statement and inserts the list
records command on the next
line in the query.

records

The semicolon

is

DQL

it marks
end of the for statement
which specifies the queiy's
Primary form. You must insert
a semicolon at the end of the
for statement and after each

synta.x requirement:

Notice that when you selected

NONE,

DataBase automatically
added a semicolon (;) after the account balance value and inserted
the phrase list records on the following line. The list records

command

is

you cannot

Low Level Low Level query.

the only processing option available in

enter, delete, or

modify records

in

the

item specified in the

list

records section of the query.

The

list

items

command

records

we want

alphabetical

to

list

report output

is

appear

DataBase we're ready

list

the

first item we want in the


customer name. Select customer name
DataBase inserts the fieldname customer

after list records.

ACCOUNT BALANCE > 500


list

to

we want an

of our customers, the

CUSTOMERS

with

Since

the field

and press RBTURN;


name on the next line
for

tells

in the report output.

records

CUSTOMER NAME

The list records command


DataBase which items to

tells

display in the report output for

each record processed by the


;

queiy. The most common type


of list item is the name of a
field.

Volume

3-6

DATABASE REFERENCE MANUAL


Now, DataBase

displays another prompt:

Specify the items to be


Select records
0:

NONE

in

order

in

2: in

listed.

groups or

reverse

3: in

in

a specific order?

groups

4: in

groups with group-totals

DataEase is asking in what order to list the customers' names. If we


choose NONE, DataEase lists the customers in the order in which
were entered into the database. If we choose one of
DataEase lists the customers according to the

their records

the other options,

chosen option (explained below):

in

order

(putting

sorts the records in ascending alphabetical order

Adams ahead

in reverse sorts in

of Coolidge).

descending alphabetical order (putting

Washington before Lincoln).

groups sorts the records in ascending order into groups that


have the same value in the specified field (for example, all the
in

Democratic presidents could be


their

names arranged

in

listed together as a

group with

alphabetical order, followed by

all

the

Republican presidents).
in

groups with group-totals

you generate

sorts records into

statistical totals for

numbers of Democratic and Republican


For our alphabetized report, select in order.

The query
for

presidents.

lets

total

DQL Sorting and

used on any type offield: in


order sorts records in
sequence from least to
greatest value (least recent to
most recent, earliest to latest,

lowest choice

number

to

highest, etc): in reverse sorts


in the opposite sequence.
Refer to the DQL Lexicon for
a more detailed explanation of
each of these operators.

reads:

CUSTOMERS

with

ACCOUNT BALANCE > 500


list

records

CUSTOMER NAME

3-7

groups and

each group, such as the

The

Groiipini> Operators can he

in

order

Volume

DEFINE
Although

in this

E R

'I-

example we only need

LOW LEVEL EXAMPLE

to sort our

customers

alphabetical order, sorting operators can be combined.

example, we want
their

names

to

group the customers by

we

in alphabetical order,

STATE

groups

in

CUSTOMER NAME

When combining

sorting

state

If.

in

for

and also

sort

use:

in

Order

commands

in

a query, items sorted in

Figure 3-3 shows


two separate queries: the customers sorted in order by
name in Query on the left, and the combined alphabetical sorting
and grouping by state in Query 2 on the right.

groups

are listed before items sorted in order.

In a query, always list items in


groups before in order.

a portion of

Query

CUSTOMER NAME

in

order

Query

STATE

in

groups

CUSTOMER NAME

in

order

Report Outputs

Alabama
Adams, Sam

Adams, Sam
Baker, Fred
Cooper, Mary
Davis,

Ivers,

Pam

Evans, Rick
Fisher, Jay
Gomez, Louis
Hill,

Brenda

Ivers,

Clark

Gomez, Louis

Jensen, Dave

Fiaure 3-3

Volume

Clark

Alaska
Cooper, Mary
Jensen, Dave
Arizona
Baker, Fred
Evans, Rick
Fisher, Jay

Sort

Commands

3-8

DATAEASE REFERENCE MANUAL


now

Returning
for

to our

example, the query reads:

CUSTOMERS

with

ACCOUNT BALANCE > 500


list

records

CUSTOMER NAME

in

order

DataBase prompts:

Any more items

to

be

listed?

and offers two choices:

0:NONE

1:

select NONE, DataBase automatically inserts a period after


order statement and scans the query. If no errors are
detected, the query is saved in memory and you are returned to the
DQL menu.
If

you

the in

If

your query

not finished select

is

inserted after the in

more

(semicolon).

semicolon
to

is

list

items.

For now, select the semicolon; the cursor moves


and we again see the prompt:
Specify the items to be
Select

DataBase
report.

field

is

We

now

want

not in the

to the next line

//(

Low Level, when you

tell

DiitaEase there are no more


items to he listed, it
automatically inserts a period
and then scans the query finsyntax errors.

listed.

name
we want

to list any other items in the


most recent date each customer placed
information doesn't appear on the menu because

asking
to

an order, but that


it's

order statement and you can continue

list

if

the

CUSTOMERS

form

(it's in

the

INVOICES

form).

However, because the INVOICES form is related to the Primary


form CUSTOMERS, we can access any information we need on
the

3-9

INVOICES

form.

Volume

DEFINE QUERY:
To

get the order date information,

the

INVOICES

fields, press

we have

LOW LEVEL EXAMPLE

to tell

DataEase

to use

form. So instead of selecting any of the displayed

TAB

twice to skip this

menu and

the next.

DataEase

generates a different prompt:

Select a relational operator

Beneath

this

prompt, DataEase displays a

menu

of seven operators.

The

DQL Relational

any, count of,


lowest of sum of,
and mean of) let you access
information in related forms.

Operators

0:

NONE

all 2:

any

3:

count of

4:

highest of

5:

lowest of 6:

sum

of F1

highest

MORE

These relational operators let you retrieve information from a form


related to the Primary form (similar to pressing FIO MULTI when
you define list fields in a Quick Report). Each option is fully
explained

in the

(all.

of,

DQL Lexicon.

The information we want

to retrieve

is

the

most recent invoice

for

each record selected from the CUSTOMERS form. Because


DataEase treats dates as a series of progressive numbers, the most
recent date

So, to

tell

customer,

is

the highest

DataEase

number

to find the

first select

in the

sequence of DATE values.

most recently dated invoice

the highest of relational operator.

for each

The query

reads:
for

CUSTOMERS

with

ACCOUNT BALANCE > 500


list

records

CUSTOMER NAME

in

Order

highest of

This

tells

Read

all

DataEase:

form (which we're about to


specify) and report the highest value in the field (which we're also
going to specify) among those records. The next few prompts will
ask us to specify the name of the related form and the field from
which we want the highest value (most recent date) reported.

Volume

the records in the related

3-10

DATABASE REFERENCE MANUAL


First

DataEase asks us to specify the related form:

Specify the items to be listed.


Select a predefined relationship?

and offers a menu


0:

NONE

1:

listing the related

forms

in the

database:

INVOICES

The information we want is in the INVOICES form, so


INVOICES. The form name is added to the query:
for

select

CUSTOMERS
ACCOUNT BALANCE > 500

with

list

records

CUSTOMER NAME in order


highest of INVOICES

Next. DataEase prompts:


Specify the items to be listed.
Specify any additional relationship criteria?
0:

NONE

with

DataEase is now asking if we want to specify additional criteria to


determine which records to select in the related form. We want
DataEase to read all the related INVOICES records and find the
most recent invoice for each selected customer. Therefore, select

NONE or press TAB.

NONE

Now

INVOICE #

DataEase

is

INVOICES form
field

3-11

name

is

2:

'"

^'^'^^''

'^'"''^^ '" 'elated


'" "'^

^p'"!^.Z
Z'l"'
Primary form.

DataEase prompts:

Specify the items to be


Select field name
0:

Selection criteria can he used

DATE

listed.

3:

CUSTOMER

4:

PART #

F1

MORE

asking us to specify which field on the


to look at for the highest value.

added

to the

query which

now

Select date.

The

reads:

Volume

DEFINE QUERY:
for

LOW LEVEL EXAMPLE

CUSTOMERS

with

ACCOUNT BALANCE > 500


list

records

CUSTOMER NAME in order


highest of INVOICES date
;

DataBase next asks

we want

if

the records sorted

by the values

in

the DATE field:

Select records

We

want

in

to list the

groups or

TAB

to

bypass the

Any more items

a specific order?

most recent invoice

TAB

chronological order, so press


pressing

in

to

be

menu

date, not sort the records in

to skip this

menu. Keep

choices until DataBase prompts:

listed?

and displays two choices:


0:NONE1:

We

want one more item: the account balance owed by each

customer, so select

Since

we bypassed

(semicolon).

Select

field

from the

INVOICES

CUSTOMERS

form again:

further choices

next prompt refers us to the

form, the

Note that

name

usini> afield in tfie

selection criteria doesn'

0:NONE :CUSTOMER NAME 2:ADDRESS 3:CITY 4:STATE


1

5:ZIP F1

MORE

insert

have

it

in the report:

you

to specify list items

separately.

In order to include the account balance information in the report,

press Fl

MORE

After this press

and

TAB

Any more items

Volume

select
in

to

account balance

answer

be

to

again.

each prompt

until

you reach:

listed?

3-12

DATAEASE REFERENCE MANUAL


Now

press

TAB

again and note what happens. In a

Low

Level

when you indicate there are no more items to be


DataEase knows the query is completed. The final query

Interactive Query,
listed

looks like

this.

for

ACCOUNT BALANCE > 500


list

'Z:2,^i^-ns:ns a period,
scans the query for syntax
errors, saves the query in

CUSTOMERS

with

Low Level, when you tell


DataBase there are no more
I"

memory, and returns you


the DQL menu.

to

records

CUSTOMER NAME in order


highest of INVOICES date
ACCOUNT BALANCE
;

After an automatic syntax scan, DataEase inserts a final period to


it saves the query in memory and returns you to

end the query; then


the DQL menu.

the DQL menu. Option 4 has been changed from Define Query
Modify Query. You can now define a custom report format

On
to

(Option 5) or run the procedure immediately using the default


Select Run Procedure. DataEase displays the output
on the screen in columnar format. After editing the column
report format.

headings (as explained

in

Chapter

report format might look as

shown

5), the

in

output in the defauh

Figure 3-4 below:

Report Output

CUSTOMER NAME

LAST INVOICE DATE

Adams, Sam
Cooper, Mary

12/15/89
12/24/89
12/31/89
12/19/89
12/18/89

Evans, Rick
Hill,

ACCOUNT BALANCE

Brenda

Ivers, Clark

$595.00
S725.00
S865.00
!;525.00

$675.00

Figure 3-4--Alphabetized Account Balance Report

As you

see, the selected customers (those who owe more than


$500) are listed in alphabetical order with the date of their last
order and the balance they owe listed in columnar format.

NOTE: DataEase
time.

can only keep one report

If you

want

to

in

memory

at

use this report again, before

beginning another report, select Save Procedure


(Option 7) on the

^13

DQL

menu.

Volume

DATABASE REFERENCE MANUAL


Chapter 4
Define Query:
A High Level Example
hile

Low

Level queries

one or more forms

let

you

retrieve information

from

High Level gives you


access to the full power of the DataBase Query
Language, including Global and Temporary Variables,
35 Procedure Commands, and 58 Math and Text Manipulation
Functions. In High Level, DataEase can create two types of
in a

database.

procedures:

A Processing procedure can enter, delete,

list,

and modify

records; and create screen, disk, or printed output.

Control procedure cannot

output, but

it

itself

access records or create

can link any number of Processing and/or other

Control procedures together

an automated chaining process.

in

many operations
shown on DataEase menus such as Record Entry, Run
Procedure, Backup Database, Install an Application, etc.
In addition, a Control procedure can invoke

HIGH LEVEL DQL


In

COMMANDS

High Level there are a total of 35 DQL commands available


These commands are divided into three groups:

(see

list at right).

Processing

Commands (numbered

1-9) can be used in a

Processing procedure, but cannot be used

in a

Control

procedure.

Procedural

Commands (numbered

10-23) can be used in any

procedure.

Control

Commands (numbered

procedure, but cannot be used

NOTE:

24-35) can be used

in

in a

There is no need to memorize these restrictions.


DataEase automatically prohibits the use of an

command in a procedure, hi Interactive


Mode, ineligible commands do not appear in the list
ineligible

of commands available.

Control

a Processing procedure.

Window Menu
Of High Level

List

Commands

DEFINE QUERY:
In this example, we'll create a

from related forms


enters

new

like the

HIGH LEVEL EXAMPLE

High Level query

preceding

Low

that retrieves data

Level query but also

records, modifies existing records, and calculates

new

information based on the existing data.


In our example, the Down East Company - a New England-based
mail-order business - is developing a single Control procedure to

automate

its

whole order processing system, including adding new

customer records, maintaining inventory records, calculating


customer discounts, and generating invoices, shipping labels,
out-of-stock notices, etc. We'll use the following set of forms

from the

Down

East database.

DATABASE REFERENCE MANUAL


PROCEDURE
The

Post Orders

POST ORDERS

procedure posts new order information from


form (Primary form) into two related
Secondary forms: the customer information is posted into the
CUSTOMERS form and the order information is posted into the
the

ORDER ENTRY

INVENTORY
Query

form.

for the Post

The query

for the

Orders Procedure

POST ORDERS

procedure

shown below:

is

ORDER ENTRY
POSTED = NO

for

with

if

CUSTOMER

# = blank then
in CUSTOMERS
ORDER ENTRY

enter a record

copy

ail

from

end
for

LINE ITEMS

modify records

in

INVENTORY

QTY ON HAND != QTY ON HAND


LINE ITEMS QTY ORDERED
end

end

Explanation of the Query


Now,

examine

let's

for

this

query one statement

The Primary form


it

for this report

contains the data

forms. The

POSTED

a time:

ORDER ENTRY
POSTED = NO

with

because

at

is

the

we want

ORDER ENTRY

to post into the

form

two other

ORDER ENTRY

form contains a yes/no field named


of no each time a record is
changed to yes when a record gets

that is assigned a default value

This field value is


posted by the procedure. Since
entered.

we only want to post the records


have not already been posted, the selection criteria on the
second line reads: posted = NO
that

The next

line in the

if

^3

query reads:

CUSTOMER

= blank then

Volume

DEFINE QUERY:

HIGH LEVEL EXAMPLE

two lines of the query tell DataEase which records


select from the ORDER ENTRY form. The third line tells
DataEase specifically which records to post into the

The

first

CUSTOMERS

to

form.

always assigned a customer # the first time he


if an ORDER ENTRY record has no
(specified by the DQL keyword blank), it must be an

Since a customer

is

or she places an order,

CUSTOMER

new customer.

order from a

For each new customer, we want DataEase


the

CUSTOMERS

The

form. This

known

is

instructions that follow the

to enter a

new

record in

as a conditional action.

statement are only executed for

if

records that meet the specified condition (only the records that have
a blank value in the

customer

# field).

blank

The next two lines in this part of


if the customer # is blank.

the query

tell

DataEase what

to

do

is

DQL keyword that

means "no

value".

in CUSTOMERS
ORDER ENTRY

enter a record

copy

all

from

query reads "CUSTOMER #


the field contains a
null value. A null value is an
undetermined value, not a

If a

The

first line is

new

record in the

DataEase to enter a
form. The second line tells

very straightforward.

CUSTOMERS

DataEase what information

It

tells

to enter in the

new

CUSTOMERS

= blank",

zero.

record.

For a new customer, the operator manually enters all the customer
information in the ORDER ENTRY form when the order is
received. This line tells DataEase to copy that information into
the CUSTOMERS form. The CUSTOMERS form automatically
derives a customer # for the new record using a sequence from
Field Derivation Formula.

The copy

from command

all

is

the last action to be performed

the records selected from the Primary form, so

period.

In addition, an

preceding

if

end command

is

it

is

An end command marks


end of all actions

the

initiated by

the preceding if command.

on

followed by a

inserted to terminate the

command.
In

This part of the query reads:

High Level, a period ends


it does not end

a statement:
the query.

ORDER ENTRY
with posted = NO
for

if

CUSTOMER

# = blank

copy

all

from

then

CUSTOMERS
ORDER ENTRY

enter a record

in

end

Volume

4-4

DATABASE REFERENCE MANUAL


This completes the

form
post

(if

from

first

(ORDER

It

tells

= blank), what information to post (copy all


ENTRY), and in which form to post the information

CUSTOMER

ORDER

DataEase which
ENTRY), what records to

half of the query.

records from

to select

A High Level query can have


more than one for command.

A Low Level query can have


only one for

command.

is

(CUSTOMERS).
The second

half of this query tells DataEase to modify the

INVENTORY form by subtracting the ordered LINE ITEMS


from the INVENTORY quantity on hand fields.

semicolon

only required

afar command if it
refers to the query's Primary
after

First, let's

look

at this section

of the query as a

unit.

form.
for

LINE ITEMS
modify records

in

INVENTORY

QTY ON HAND := QTY ON HAND


LINE ITEMS QTY ORDERED
end

end

Now,

let's

for

look

at this part

of the query one statement

at

a time.

LINE ITEMS

contains a second for command. Unlike a


Level query, a High Level query can contain more than one
for command. This second for command tells DataEase that we
First, notice that this line

Low

want

to select records

from a form other than the Primary form.

The Secondary form we now want to select records from is the


LINE ITEMS form. The LINE ITEMS form has a predefined
relationship to the ORDER ENTRY form based on the order #
field. Since no selection criteria are specified with this for
command, DataEase selects all the records in the LINE ITEMS
form that are related to the records processed in the first part of
the query when it processes the second part of the query.

The next

line in the

modify records
This line

ITEMS

is

When you use the modify


records command for a form
other than the queiy's

query reads:

straightforward.

in

Primary form, the keyword in


must precede the form name.

INVENTORY

It

tells

DataEase

The next two

lines of the

to use these

INVENTORY

records to modify the records in the

LINE
form.

query read:

QTY ON HAND := QTY ON HAND


LINE ITEMS QTY ORDERED

These two

lines tell

INVENTORY
4-5

DataEase how to modify the records in the


As each LINE ITEMS record is processed.

form:

In the modify records

command, field names are


separated hy the special
symbol := which is called an
assignment operator. This
symbol

tells

DataEase

to

modify the field to the left of


the symbol by assigning it the
value specified to the right of
the symbol.

Volume

DEFINE QUERY:
subtract the value in the

record from the value

INVENTORY
INVENTORY
The second
commands:
for

in

HIGH LEVEL EXAMPLE

qty ordered field on each LINE ITEMS


the qty on hand field in the

record for that item.

In other words, reduce the

qty-on-hand by the amount

part of the query

is

was ordered.

that

completed by adding two end

LINE ITEMS
modify records

INVENTORY

in

qty on hand := QTY QN HAND


LINE ITEMS QTY ORDERED
end

end

To

DQL

satisfy the

end command

command. The end command

after the

part of the query completes the preceding if statement, not the

first

for statement. Therefore two

first

the

syntax requirements, a query must contain one

for each for

modify records

The complete query

end commands

part of the query,

are required after

procedure reads:

The second part of this query


is

initiated

CUSTOMER

all

from

each record selected hy the

in CUSTOMERS
ORDER ENTRY

first for

command. For

further explanation, see


nested actions in the DQL

end
for

hy the second for

command are performed for

= blank then

enter a record

copy

nested within the first. This


that all the actions

means

ORDER ENTRY
with POSTED = NO
for

if

in

the query.

one for each for command.

POST ORDERS

for the

There must he one end


command for each for, if,
while, and case command

Le.xicon at the hack of this

LINE ITEMS
modify records

in

volume.

INVENTORY

QTY ON HAND := QTY QN HAND


LINE ITEMS QTY ORDERED
end

end
This

fulfills the

The

first

procedure's two-part objective:

half of the query tells DataEase to select the

ENTRY records that haven't


new customer

The second

ORDER

already been posted and post the

information into the

CUSTOMERS

fomi.

half of the query tells DataEase to select the related

LINE ITEMS

records and modify the

INVENTORY

form by

subtracting the quantity ordered from the quantity on hand.

Volume

4-6

DATABASE REFERENCE MANUAL


Saving the Procedure
If

you are creating

this

the next section, select

procedure as you read, before proceeding


Save Procedure (Option 7) on the DQL

to

menu.
DataBase prompts:
Please enter the procedure name:
In response, type:

POST ORDERS

saves the procedure on

dist;

and press RETURN. DataBase


and returns you to the DQL menu.

is saved on disk, you can


any of the following methods:

After the procedure

1.

later

execute

it

by

Load Procedure (Option 8) on the DQL menu


select the procedure name from the list of
procedures DataBase displays. Binally, select Run
Procedure (OpUon 1).
Select

and then

OR
2.

With no procedure loaded in memory, first select Run


Procedure and then select Post Orders from the list of
procedures DataBase displays.

OR
3.

Specify the

command

name of

the procedure in a

run procedure

within a Control Procedure query or on a

custom menu.
Next, we'll create a procedure that determines the discount given to
who places an order from the Down East Christmas

each customer
catalog.

4-7

Volume

DEFINE QLERY;
PROCEDURE 2:

Calculate Discount

The second procedure

the

is

based on the

fact that the

Down

East

grants a Christmas discount to each customer based on

Compan\
the

HIGH LEVEL EXAMPLE

amount the customer purchases from the company throughout


year. The object of the procedure is to calculate the following

for each customer:

amount ordered

since the start of the year.

The

The total dollar amount of the customer's order from


company's Christmas catalog.

The

total dollar

total dollar

the

amount of the discount on each customer's

Christmas catalog order.

Once each of these

totals is

determined,

we

use a variable (an

expression that represents a varying value) to store the calculated


result. This lets us use the values as often as we want without

having to repeat the formulas used

The query
DataBase

1.

for the
to

do

all

them.

to derive

CALCULATE DISCOUNT procedure

must

tell

an expression
used
during the processing of a

of the following:

customer's Christmas order

total,

one

customer's annual purchase

total,

and one

calculating the

sum

to store

each

to store

and global. A temporary


each

total.

Process the unposted

2.

is

query. DataBase uses rviv)


r)'pes of variables: temporary

Create three separate variables: one to store each

customer's discount

variable

that represents a value

ORDER ENTRY

records

of the Christmas order total for

each customer.

variable can only hold a value


during the current procedure;
a global variable can pass a
value from one procedure to
another. In all other respects,
the two types of variables
function identically.

Set up discounts based on annual purchase totals with

3.

the discounts expressed as a dollar

amount

to

be

subtracted from the Christmas order total.

Process the related

4.

the

sum of

all

LINE ITEMS

the orders

records, calculating

made by each customer

since

the start of the year.

Modify

5.

the

ORDER ENTRY

customer's discount

Volume

in the

records, entering each

discount

field.

4-8

DATAEASE REFERENCE MANUAL


Query

for the Calculate Discount

The

query for the

full

Procedure

CALCULATE DISCOUNT procedure

reads as

follows:

define
define
define
for

temp "Christmas" Number


temp "annual" Number
temp "discount" Number

ORDER ENTRY
POSTED = NO

with

assign temp Christmas

QTY ORDERED)

:=

sum

of

LINE ITEMS (unit cost

'

assign temp annual := sum of ORDER ENTRY named


YTD" with (DATE between 01/01/88 to current date and
customer # = ORDER ENTRY customer #)

sum

LINE ITEMS (unit cost

of

qty ordered)

case (temp annual)


value < 300
:

assign temp discount := temp Christmas


value between 300 to 1000
assign temp discount := temp Christmas
others
assign temp discount := temp Christmas

0.10

0.15

0.20

end
modify records

discount

:=

temp discount

end

Explanation of the Query


Notice

When

first that this

at the start.
if

in a

This makes

necessary, and

query does not

using variables

it

also

it

start

with a for

command.

query, you should define the variables


ea,sy to find

makes

(and change) the variables

the query easier to follow.

Volume

DEFINE QUERY:
Now,
The

let's

look

hne

first

query one statement

at this

in the

..

HIGH LEVEL EXAMPLE


at

a time.

query creates and names a temporary variable

To define a variable you must


specify the variable' s

to hold the Christmas order total for each customer:

and

This

first line

name

You can use any

name you like, but the name


must be enclosed in quotes.

temp "Christmas" Number

define

type.

After specifying the type,

has five elements:

insert a space followed by a

The

DQL define command.

This

tells

DataEase

to create a

period. The define

command

always followed by a
period, not a semicolon.
is

variable.

The keyword temp. This

The name of the

tells DataEase the variable


temporary variable, not a global variable.

variable (Christmas

must be enclosed

in

quotes

when

).

it is

The name of a
first

is

variable

specified

in a query.

The

type of the variable (a Number). A variable can be a


number, a text expression, or any other DataEase field type
except Choice, Dollar, or Yes/No.

The

A period.

The denne command must always end with

a period.

three lines of the query are similar in purpose:

first

define
define
define

temp "Christmas" Number


temp "annual" Number
temp "discount" Number

These statements create three temporary variables: one to store


each customer's Christmas order total, one to store each customer's
ANNUAL purchase total, and one to store each customer's discount
total.

The next
the

part of the query tells

DataEase which records

to select in

Primary form:
for

ORDER ENTRY
posted = NO

with

As

in the previous procedure, the first group of records we want


DataEase to select are the unposted ORDER ENTRY records.
These records contain the orders from the Christmas catalog.

Volume

4-10

DATABASE REFERENCE MANUAL


The next

part of the query tells

Christmas order

total for

DataBase how

to calculate the

each customer (the value

we want

The name of a variable

to

only placed

assign to the "Christmas" variable):

assign temp Christmas

QTY ORDERED)
First, the

:=

when

sum

of

LINE ITEMS

(unit

cost

in

it is first

is

quotes
defined.

No

quotes are used after


the variable is defined.

above statement introduces the

assign temp Christmas

DQL assign

command:

:=

tells DataBase to assign Christmas a value.


DataBase automatically inserts the assignment operator symbol (:-)
after the name of the variable. This operator tells DataBase that the
value of the variable is determined by the expression on the right of
the symbol (it functions very much like an equals sign). The
remainder of this line reads:

This statement

sum

of

LINE ITEMS

(unit

This part of the assign statement


assign to the Christmas variable

LINE ITBMS

tells

the

qty ordered)

DataBase what value

sum of the

cost of

all

used

is

assign a value to a
temporary or global variable.
Like the define command, the
assign command must specify
the variable's name and is
followed by a period, not a
semicolon.
to

to

the

related to this order.

In other words, as

DQL sum

cost

The assign command

each

ORDBR ENTRY

record

is

processed, the

DataBase to find the related


LINE ITEMS records with the same order # as the record that is
currently being processed (the Christmas catalog order). DataBase
then multiplies the unit cost by the qty ordered, totals the result,
and stores the calculated total in the Christmas variable.
of relational operator

tells

The sum of relational


operator returns the total of
the values in specified fields

on a related form.

The whole query up


define
define
define
for

to this point reads as follows:

temp "Christmas" Number


temp "annual" Number
temp "discount" Number
In a query, values in a

ORDER ENTRY
posted = NO

with

math

formula are enclosed

in

parentheses to

the

assign temp Christmas

cost

sum

:=

QTY ORDERED)

of

LINE ITEMS (unit

clarifif

meaning and the sequence of


the math operations.

Volume

DEFINE QUERY:
The next

part of the query tells

DataBase

order total for each customer (the value

ANNUAL
Taking

HIGH LEVEL EXAMPLE

to calculate the

we want

annual

to assign to the

variable).
this section a step at a time,

assign temp annual

:=

we

sum

of

begin with:

ORDER ENTRY named

"YTD"

DataBase to assign the annual variable a value


group of ORDER
ENTRY records. This new group of records is distinguished by the
name "YTD" (YEAR TO DATE) and the following new selection

This statement
equal to the

DataBase automatically
assignment
operator symbol (:=) after the
name of the variable. This
operator tells DataBase that
the value of the variable is
determined by the expression
given to the right of the
symbol (it functions like an
equal sign).
inserts the

tells

sum of

the values in another

criteria:

with (DATE

between 01/01/88

customer

to

current date and

ORDER ENTRY CUSTOMER

#)

Selection criteria used after a


relational operator are always

enclosed

in

parentheses.

DataBase to select a new group of


ORDER ENTRY records those that have a date between the first
day of the year and today's date, and the same customer # as the
current ORDER ENTRY record being processed by the for

These new selection

criteria tell

command.
This

new group of

ORDER ENTRY

records

is

related to the

group by an ad-hoc relationship. An ad-hoc relationship is


a relationship that's created to access a group of records during a
query - by inserting a relational operator and additional selection
criteria into the query, instead of predefining the relationship on the
original

An ad-hoc

relationship is a
relationship that's created

during a queiy (instead of


being predefined on a
Relationship form during

Form

Definition).

Relationships form.

During a query, whenever you want to change the criteria that are
used to select records from a form, you must create a new
relationship. When you change selection criteria, you must assign
each distinct group of records a unique name using the DQL

named

create an ad-hoc

you must give

that relationship a
differentiate

it

name

to

from other

groups of records selected


the same form.

from

operator.

The unique name

When you

relationship,

DataBase distinguish different groups of


records selected from the same form. In the example above, the
second group of ORDER ENTRY records is assigned the name
YTD to distinguish it from the original group of unposted ORDER
ENTRY records selected by the for command.
lets

The named operator

is

used

to

give a relationship a unique

name. You can use any name


you like. The name must be
enclosed

in

quotes when

first specified: thereafter

it is

no

quotes are used.

Volume

4-12

DATAtASE RbHERENCE MANUAL


The

last line in this

section reads:

sum of LINE ITEMS

(unit cost * qtv ordered)

As we explained

for the Christmas variable, this statement tells


DataEase to total the cost of the LINE ITEMS ordered by the
customer whose ORDER ENTRY record is currently being
processed. But now. instead of totalling just this customer's
Christmas catalog order, as each ORDER ENTRY record in the
"YTD'

group

ITEMS
orders

is

processed, DataEase totals all the related

records for that customer.

In effect.

DataEase

LINE

totals all the

made by each customer since the start of the year and


annual variable (see Figure 4-2 below).

stores

the result in the

Predefined
Relat ionsh ip

fld-Hoc

Relationship

Predefined
Relat ionsh p
i

ORDER ENTRY RECORD


processed by the
for comand

ORDER ENTRY RECORDS


uith sane CUSTOMER n
and DTE belueen Bl^BVaa
and CURRENT DATE

Total the LINE ITEMS RECORDS


related to each of the
ORDER ENTRY RECORDS at left
NOTE:

The double arrouhead faces the Many side of the relationship

Figure 4-2-- Calculation

The whole query up


define
define
define
for

Of Annual

Variable

to this point reads as follows:

temp "Christmas" Number


temp "annual" Number
temp "discount" Number
.

ORDER ENTRY
POSTED = NO

with

assign temp Christmas

QTY ordered)

:=

sum

of

LINE ITEMS (unit cost

assign temp annual := sum of ORDER ENTRY named


"YTD" with (date between 01/01/88 to current date and

customer

sum

4-13

of

ORDER ENTRY

LINE ITEMS (unit cost

customer
*

#)

qty ordered)

Volume

DEFINE QUERY:
In the next part of the query

purchase

the records in each group.


that

we

we want DataBase

to divide the annual

groups and assign a different discount to

totals into three

command

HIGH LEVEL EXAMPLE

This process

used to select records

is

similar to the

if

POST ORDERS

in the

procedure:
if

CUSTOMER

# = blank then

enter a record

in

CUSTOMERS

But, instead of specifying only one condition,

we want DataEase

evaluate each record against several values as

shown below:

if

ANNUAL < 300 then assign discount a

ANNUAL between 300


DISCOUNT B - (15%)
if

if

ANNUAL

>1

to

:=

to

(10%)

1000 then assign

000 then assign discount c

However, instead of specifying multiple


single case command (as shown below):

if

:=

(20%)

commands, we can use

case (temp annual)


value < 300
:

assign temp discount := temp Christmas


value between 300 to 1000
assign temp discount := temp Christmas
others
assign temp discount := temp Christmas

0.10

0.15

0.20

'

end
In effect, the case

commands.
enclosed

in

It

command w orks

consists of the

like a series of nested if

parentheses. This object can be a field, a constant

The object

value, an expression, or a variable.

is

DQL case command


evahiates a series of
conditions and executes
different actions based on the
The

word case followed by an object


tested against

one or more value statements each of which specifies a comparison


value. The comparison value may be a constant value, an

result of this evaluation.

expression, a variable, or a range of values.

Each value statement

As

in the if

is

command,

followed by one or more action statements.

these actions are conditional

performs the actions that follow the


the comparison

is

first

- DataEase

value statement in which

true for the current record being processed.

The case command must include


also include an others statement.

a closing
If

end command.

It

may

none of the preceding value

Like the if command, the last


statement in a case command

must he followed by an end

command.

statements are true. DataEase automatically executes the actions

following the others statement.

Volume

4-14

DATABASE REFERENCE MANUAL


In our example, the object

annual

stored in the
take

is

we want DataBase to test is the value


The action we want DataBase to

variable.

modify the value stored

to

Christmas variable by the

in the

appropriate discount rate.

Now.

let's

look again

at the

case in question:

case (temp annual)


value < 300
assign temp discount := temp Christmas
value between 300 to 1000
assign temp discount := temp Christmas
:

0.10

0.15

others
assign

temp discount

:=

temp Christmas

0.20

end

The

first

value statement

is true for customers whose annual


S300. These customers are assigned a
10% discount on their Christmas catalog order total. The second
value statement is true for customers whose annual purchases are
between $300 and $1000. These customers are assigned a 15%
discount on their Christmas order. All other customers are assigned

purchases

20%

total less than

discount on their Christmas order.

To

generate the net total for each Christmas order invoice, we must
subtract each customer's discount from his order total. But so far

we haven't slored the discount amount for each customer


procedure, we've just calculated it.
The

final part

customer, so

in this

of this query stores the discount amount for each


use this amount later to generate an invoice.

we can

modify records

DISCOUNT

:=

temp discount

end
These three

lines tell DataBase: as the

unposted

ORDER ENTRY

records are processed, modify each record by posting the value


calculated for the discount variable into the discount field on the

ORDER ENTRY

4-15

form.

Volume

DEFINE QUERY;
The completed query

for the

HIGH LEVEL EXAMPLE

CALCULATE DISCOUNT procedure

reads as follows:
define
define
define
for

temp "Christmas" Number


temp "annual" Number
temp "discount" Number

ORDER ENTRY
posted = NO

with

assign temp Christmas

qty ordered)

:=

sum

of

LINE ITEMS (unit cost

assign temp annual := sum of ORDER ENTRY named


"YTD" witfi (DATE between 01/01/88 to current date and
customer # = ORDER ENTRY customer #)

sum

LINE ITEMS

of

(unit

cost

qty ordered)

case (temp annual)


value < 300
:

assign temp discount := temp Christmas


value between 300 to 1000
assign temp discount := temp Christmas
others
assign temp discount ;= temp Christmas

0.10

0.15

0.20

end
modify records

discount

:=

temp discount

If no form

snd
If

name

is

specified in

a modify records command.

DataBase modifies records


the Primary form.

you're creating this query as you read, press F2

in

SAVE. Then

Save Procedure (Option 7) on the DQL menu to save the


procedure on disk. When DataEase asks you to name the
select

procedure, enter

Volume

CALCULATE DISCOUNT.

4-16

DATAEASE REFERENCE MANUAL


PROCEDURE

3: Print

Invoices

The PRINT INVOICES procedure


to print

tells DataEase what information


on each customer's Christmas order invoice as shown in

Figure 4-3.
DOUN EfiST
Rockport,
(see) 485

DEFINE QUERY:
Query
To

for the Print Invoices

HIGH LEVEL EXAMPLE

Procedure

generate a report that can be formatted like the invoice

shown

in

Figure 4-3. the query reads:


for

ORDER ENTRY
POSTED = NO

with

list

records

ORDER
DATE

groups

# in

CUSTOMER
NAME
ADDRESS

CITY

STATE
ZIP

DISCOUNT
LINE ITEMS PART #
all LINE ITEMS description
all LINE ITEMS UNIT COST
all LINE ITEMS oty ordered
all LINE ITEMS (unit cost * oty ordered)
sum of LINE ITEMS (unit cost * oty ordered)
sum of LINE ITEMS (unit cost * oty ordered)
- discount
;

all

In addition to listing this information


this

procedure to do one

POSTED

more

field

from

NO

to

on the invoice, we also want

important task: change the value

last

YES. This

is

in the

specified by adding three

lines to the query:

modify records

posted

:=

YES

end

Volumes

4-18

DATABASE REFERENCE MANUAL


Explanation of the Query
Now,

let's

for

review

this

line

by

line.

ORDER ENTRY

The for command

ENTRY

query

selects the query's Primary

form - the

ORDER

form.

with

POSTED =

NO

The with operator introduces the record selection criteria: process


only records with the value no in the posted field.
list

The

records

command

tells DataBase what items we want to


These items (called list items) follow
the list records command. In this report there are two types of list
items: fields from the Primary and/or Secondary forms and values
that are calculated during the query but do not actually appear on
any database forms.
list

appear

records

in the output.

order
This

tells

order

groups

in

DataBase

to

group

LINE ITEMS

records with the same

together and to arrange the groups in ascending order.

DATE

CUSTOMER
NAME
ADDRESS

CITY

STATE
ZIP

DISCOUNT

Each of these eight


form.

semicolon follows each list


item except the last in a list
records command.

Here,

we

lines specifies a field

on the

ORDER ENTRY

are telling DataBase to include the value in each of

these fields in the report output.

4-19

Volume

DEFINE QUERY:
all
all

all
all

ITEMS part #
ITEMS description
ITEMS unit cost
ITEMS oty ordered

LINE
LINE
LINE
LINE

HIGH LEVEL EXAMPLE

Each of these four lines specifies a field on the LINE ITEMS form.
The relational operator all tells DataEase to find every LINE
ITEMS record that has the same order # as the ORDER ENTRY
record that's currently being processed

ITEMS

(it

finds all the

LINE

related to the Christmas catalog order).


all

LINE ITEMS (unit cost

oty ordered)

The relational operator all


tells DataEase to find each
related record: the relational

operator any tells DataEase to


find the first related record.
These operators can he used
to access information in both
predefined and ad-hoc
relationships.

DataEase to multiply the unit cost by the quantity


ordered for each item ordered from the Christmas catalog and list
This line

tells

this total in the report.

Total

Column on

sum
This line

LINE ITEMS (unit cost

of

tells

LINE ITEMS

This information

is

displayed

in the

Line

the invoice.
*

qty ordered)

DataEase to calculate the sum of the costs of all the


ordered from the Christmas catalog and list this

calculated total in the report. This information

is

displayed as the

Overall Line Total on the invoice.

sum
-

This line
list

of LINE ITEMS (unit COST


discount

qty ordered)

tells

DataEase

to calculate the

item and then subtract the value

same sum

in the

as the previous

ORDER ENTRY

amount. The result is the net total for each


order, taking into account each customer's discount as calculated in
this procedure. This information is displayed as the Order Total on

discount

field

from

this

the invoice.

modify records

POSTED
end

The
is

;=

YES

last three lines tell

processed, change the value in the

Volume

ORDER ENTRY record


posted field from NO to YES.

DataEase: as each

4-20

DATABASE REFERENCE MANUAL


THE CONTROL PROCEDURE:

Mail Order

As we mentioned at the start of this volume, a Control procedure


can be used to manage almost every element of DataBase, including
combining menus, input forms, procedures, conditional
output into fully automated business applications.

Control procedure can be used

and

menu

However, they

let

you

conditionally display forms,

run reports,

etc.

DataEase

versions 4.0 or higher link the


power of transaction

to:

Execute any DataEase menu option from within the procedure.


In this respect. Control procedures are similar to the chain
menus available in previous DataEase versions. However,
Control procedures let you combine DQL conditional logic
with the chain

processing with the


ease-of-use approach
DataEase has always

championed.

processing capabilities.

DQL Procedures together and execute them automatically.

Link

Pass values

Now,

actions,

Control procedures function


similarly to chain menus in
previous DataEase versions.

among

we'll demonstrate

procedures.

how

the

Down

East

Company can

three preceding procedures together to automate their

link the

whole process

and posting orders, calculating each customer's


To do this, you create a new
combines the three Processing procedures into a Control

for entering

discount, and printing the invoices.

query that
procedure.

The query

for this Control procedure is listed immediately below.


Following the query, the purpose of each line in the Control
procedure is explained.

Query

for Mail

Order Control Procedure

The Control procedure query contains only

ten lines:

The form name

is enclosed in
a record entry
command. A period is

quotes

current date < 12/25/89 then


record entry "ORDER ENTRY"
run procedure "POST ORDERS"
run procedure "CALCULATE DISCOUNT"
run procedure "PRINT INVOICES"
else
message "<Merry Christmas!>|
There are only 300 shopping days left before
we mail our next Christmas Catalog." window
if

end

4-21

in

inserted after specifying the

form name.
The procedure name
used

text constant
is

enclosed

in

{like

any

a query)
quotes in a run
in

procedure command.
A period is inserted after
specifying the procedure name.

Volume 3

DEFINE

QLER\-:

HIGH LE\EL EXAMPLE

Explanation of the Control Procedure


The Control procedure

with the

starts

command w hich

if

sets

up a

conditional action:
if

This

current date < 12/25/1989 then

DataBase

tells

commands

else

to

execute

all

the actions

as long as the current date

is

between the
before

if

and the

December

25th.

on or after 12/25/89. DataBase ignores the commands


the
if
and else commands and resumes processing with the
between
If the

date

is

command.

statement after the else

first

The Control procedure then introduces


record entry

the first action:

"ORDER ENTRY"

The record entry command lets you enter records from within
procedure. The entered data can then be processed by other
procedures specified

command

This

specified form.

tells

in the

Control procedure.

DataBase

In this case

it

to

perform one action: displa\ the


ORDER ENTRY form

displays the

so the operator can enter orders.

The Order Entry form was defined so that DataEase automatically


generates the order # (a sequenced field) as each order is entered.
The name and address information for new customers is manually
entered by the operator. The name and address information for
previous customers is retrieved from the CUSTOMERS form when
the operator enters the customer # in the ORDER ENTRY form.

The

third line of the Control procedure specifies:

run procedure

"POST ORDERS"

The run procedure command executes a procedure just as if you


selected the Run Procedure option on the DQL menu. When
DataEase reaches the end of the procedure,
executes the next

When
record
the

the

command

POST ORDERS

in the

LINE ITEMS

QTY ON HAND

The

automatically

is

run.

DataEase creates a new

new customer, copying


information from the ORDER ENTRY' form.
form

The merchandise ordered from


the

it

Control procedure.

procedure

CUSTOMERS

name and address

in the

for each

the Christmas catalog

is

posted

in

form and ordered items are subtracted from the

fields in the

INVENTORY

form.

fourth line specifies:

Volume

4-22

DATABASE REFERENCE MANUAL


run procedure

command

This

"CALCULATE DISCOUNT"

executes the

CALCULATE DISCOUNT procedure

amount ordered by a customer


from the company's Christmas catalog, 2) calculates the total dollar
amount ordered by that customer since the beginning of the year,
and 3) calculates and posts a discount on the Christmas order based
on the customer's total annual purchases.
that

The

1 )

calculates the total dollar

Control procedure specifies:

fifth line in the

run procedure

"PRINT INVOICES"

This command executes the final PRINT INVOICES procedure.


This procedure prints an invoice for each customer's Christmas
order by 1) retrieving and totalling the cost of all the ordered items

from the LINE

ITEMS

discount (as calculated

form and
in the

2) applying the customer's

previous procedure) to yield a net

amount.

The
The

sixth line in the Control procedure contains the else

else

command

current date

is

tells

on or

DataEase what action

after

December

to

command.

perform

if

the

25th.

else

message "<Merry Christmas!>|


There are only 300 shopping days left before
we mail our next Christmas Catalog." window

end

The next

line contains the

command
marks. In

DataEase

DQL

message command. The message

DataEase to display the text enclosed in quotation


the message text itself, the angle brackets < > tell

tells

to display the text in red (a user-defined color choice),

each vertical

line

tells

DataEa.se to insert a line break, and the

window command following the quotation tells DataEa.se


the message in a window in the center of the screen.

to display

The last line in the Control procedure contains the end command.
marks the end of the actions initiated by the if command. The
Control procedure does not require a second end command, as
there

4-23

is

no other command

in the

It

procedure that requires an end.

Volume

DEFINE QUERY:
Summary

(Putting

In this example,

menu and
the

All

when you

specify the

MAIL ORDER

displays the

It

HIGH LEVEL EXAMPLE

Together)

select

Run Procedure from

MAIL ORDER

the

DQL

Control procedure (or specify

option on a custom User menu). DataBase

ORDER ENTRY

form.

You

can then enter records

in

DataBase Record Entry procedures.


Each time you press F5 FORM CLEAR, DataBase displays a new
blank record just like normal record entry.
the form using the standard

When you

finish entering records

and press ESC. DataBase

command in the Control procedure


the PRINT INVOICES procedure.

automatically executes each


until

it

When

reaches the end of

the Control procedure

returns to the form or

is

completed. DataBase automatically

menu from which

the procedure

was

originally called.

Volume

4-24

DATAEASE REFERENCE MANUAL

Chapter 5
Define Format/Print Style:

Designing Report Output


QL
I

procedures are often used to create report output for


printing and display. DataBase provides eight predefined

formats that

can create your

let

you easily produce

own custom

reports.

formats. All of the

In addition,

DQL

you

fomiatting

The format defines how data


is

output. All the

DQL

formatting options can also he


used with Quick Reports to
design report output.

options can also be used with Quick Reports to design or enhance

procedure output.

For more precise control of your output. DataEase also provides the
DQL output command. The output command can be used
anywhere in a query to specify the exact location of the output. For
more information on the output command, see the DQL Lexicon at
the back of this volume.

THE PURPOSE OF THE REPORT FORMAT


Although the query
include in a report,

information.

DataEase what

tells
it

field values

and

how to physically
DataEase how to arrange

doesn't specify

The forrtial

tells

statistics to

lay out the

the output

mailing labels, invoices, checks, tabular

produce form
Defining the format is complementary to Form
Definition. In Form Definition you define the format for data

to

letters,

DataEase what
required for a
report. The format tells
DataEase how to lay out thai
query

tells

information

is

data.

reports, etc.

input; the report format defines

how

the data

is

to be

output.

REPORT FORMAT ELEMENTS


A

report format consists of three elements:

Formatting Commands: Special commands

DataEase
how to layout the information requested in the query. There
are eight Formatting Commands: .header, .footer, .group
header, .items, .group trailer, .end, .page, and .call. All
formatting

commands

that tell

are preceded by a period, so they are

commands. A format must contain an .items


command and an .end command. The other commands are
optional. Dot commands must begin in column 1 of the format.
often called dot

5-1

A DataEase format can

store

up to 4000 characters and


occupy up to 16 screens. The
format is composed of three
elements: Formatting

Commands. Format

Te.xt.

and

Output Fields.

Volume

DEFINE FORMA

Format Text:

T/P

RINT STYLE: DESIGNING REPORT OUTPUT

Descriptive text such as the Titles, Headers,

Page Numbers, Boundary Lines, etc. You enter Format Text


in the format directly where you want the text to appear in the
output.

Format

text

Fields: Locations

is

an optional part of the format.

where the

field values

processed by the query actually appear

To

insert a field in a report format,

from the records

in the

move

report output.

the cursor to the

Then press

position where you want the field values to appear.

FIO FIELD and

from the menu DataBase


and type in a new field formula.

select the field

RETURN

displays, or press

To insert afield in a report


format, move the cursor to the
want the
appear and

location where you


field values to

FIO FIELD. When


DataBase displays a menu,
select the field from the menu
or type in a new field formula.

press

shows a sample report that uses many of the report


formatting commands. The text shown in the report (such as
Department Total) is Format Text, and the shaded rectangles
represent areas where the field values from each processed record
Figure 5-

are displayed or statistically summarized.

Note

that Figure 5-1 represents the report output (with annotated

formatting commands),

command must

begin

report formats appear in

In the format, each


on a separate line. Examples of
the reference pages throughout this section.

iiol

in

the report format.

column

DOUN EAST COMPANY


Monthly Report
October 1989

header

Marketing Departnent

.footer

*-

.group header

Departnent Total

Grand Total

Figure 5-1

Volume

- Sample

itens

.group trailer

.end

Page Z

Report Showing Formatting

Commands

5-2

DATABASE REFERENCE MANUAL


HOW THIS CHAPTER IS ORGANIZED
This chapter

tells

you how

and modify formats.

to select, create,

It

includes numerous example formats with the query that generates


the format and the report output

produces (as

it

predefined formats are presented

first.

detailed instructions that explain

how

edit a predefined format.

It

may

They

in

Figure 5-1). The

are followed by

to create a

custom format or

be helpful to review the examples

in this section before trying to design

your

own custom

reports.

PREDEFINED FORMATS
DataEase provides several predefined formals which you can use to
save time. These system-defined formats can be used "as is" or can
be edited to reflect personal tastes. In general, many users find that
the best

way

to

format a report

is

to generate the report in a

predefined format and then modify

it

until they are satisfied

with

DataEase has nine predefined


formats. Often, the easiest
way to produce a report is to
use a predefined format and
then modify it to meet your
requirements.

the report's appearance.

CUSTOM FORMATS
you can create a custom format

Alternatively,

that lets

you design

own specifications. In creating a custom format, you


Formatting Commands that tell DataEase how you want your

report to your

enter

However, a report format can also include titles,


boundary lines, page numbers, field names, and other descriptive
information. When you are designing a custom report format, you
must position this information where you want it to appear in the
report formatted.

The custom format lets you


design a report to your own
specification. It skives you
complete control over the
appearance of a report.

output.

Adding form
a centered

and placing fields in a format is almost identical


form in Form Definition. For example, if you want

text

to designing a

title at

the top of the report,

you type

top center of the format exactly where you want


Similarly,

you position

a field

where you want

it

the
it

title text at

the

to appear.

to

appear by

moving the cursor to the appropriate position and pressing


FIO FIELD to insert the field in the format. After each field is
inserted, press F2 SAVE to save the field location as part of the
format.

5-3

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


DEFAULT REPORT FORMAT
If

you don't define a format

for a procedure,

automatically creates a default

columnar

DataEase

format.

The columnar

format displays each record on a separate line with fields laid out
one beside another in vertical columns. If you have specified

grouping

in the

DataEase automatically
creates a columnar format
you don't select a different
format option.

if

query, DataEase automatically prompts you for the

additional information

it

requires to properly format the output.

SAVING A FORMAT
To

save a format, press F2

SAVE.

temporarily in the computer's memory.

To

permanently, select Save Procedure on the


the procedure and the format

on

Select

This saves the format

the

save the format

DQL

menu. This saves

Save Procedure from

DQL menu

to

save a

format on disk as a part of the


procedure.

disk.

MODIFYING A FORMAT
Once you have saved a format, the Define Format option on the
DQL menu changes to Modify Format. You can modify a format
at

any time. In order

to

modify a previously defined format, the

procedure has to be loaded into memory.

If the

procedure

is

not

memory, select Option 8. Load Procedure,


and then select the name of the procedure to load from the menu of
procedures displayed by DataEase. Once the procedure is loaded,
currently in working

select

Option

5,

Modify Format.

When you modify

an existing format, DataEase asks:

Do you want to keep the

existing format?

Answer yes

if you want to make changes to the existing format.


you answer no. DataEase abandons the existing format entirely,
and you must redefine your format from the beginning.

If

TYPES OF REPORT FORMATS


select Define Format from the DQL menu (or from the
Quick Reports menu), DataEase displays a menu of the nine
available report formats as summarized on the next page:

When you

QBE

Volume

5-4

DATAEASE REFERENCE MANUAL


QUICK SUMMARY OF THE FORMAT MENU OPTIONS
1

The columnar format displays one record on each


fields laid out

one beside another (similar

line

2:

The

3:

The record entry format uses a Record Entry form


report format (identical to Form View).

4:

The template format uses an

field

per line format displays one

field

with

Table View).

to

on each

line.

as the

existing user-defined form as

the report format.

5:

The GrafTalk format automatically sends


DataEase GrafTalk

to

have GrafTalk to successfully use

6:

The custom format

the report data to

produce a chart or graph. You must

lets

this format.

you design a report

to

your

own

specifications.

7:

The export formats prepare data for use in other programs.


They include WordPerfect, Mail-merge, MultiMate,
GrafTalk, Lotus 1-2-3/Symphony,

DIP (Data Interchange

Pormat), and Pixed and Variable Length

8:

The mailing

labels format

is

ASCIL

used to automatically format

output to be printed on "multi-across" mailing labels.

9:

The CrossView format automatically sends


DataEase CrossView for statistical analysis.

the report data to

you select any format except custom. DataEase prompts you for
any additional information it requires and then displays the report

If

format. You can use the format "as is" or edit it (except the Lotus
export format, which cannot be edited). To use the unmodified
format, press P2 SAVE. To display the report in the chosen

format, select

format

is

Run Procedure (Option

described in detail

in the

except the CrossView format, which


the

end of

this

1)

on the

DQL

menu. Each

reference pages of this chapter,


is

described in an

addendum

volume.

If you select the custom fonmat, DataEase displays a blank screen


on which you design your own format.

5-5

at

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Report Formatting

How to

Define a Format: Overview

is defined after you write a DQL query (or select list


Quick Reports). Follow the steps below to define a
format. See specific reference pages for more information on a

The format
fields in

particular topic.

2.

Format from
Reports menu.
Select Define

DataBase

lists

the

DQL or the QBE

the available formats.

format you want to use from the

3.

Answer

to format.

Quick

Select the type of

list.

the questions DataBase asks.

from format

The questions vary

See the reference pages on the

format you've chosen for more information on specific


questions.

4.

DataBase displays the format. You can now

edit the

format

as desired, except for the Lotus 1-2-3 export format, which

cannot be edited.

5.

Add

format text by simply typing the text on the format

where you want

it

to appear.

You

can add

titles,

draw

borders, or add any desired text to a format.

6.

Add

fields to the format

want the

field to

by positioning the cursor where you

appear and pressing FIO FIELD.

DataBase displays a menu,

When

you want

to insert

text, just as

you can

select the field

in the format.

7.

You can cut and paste fields and


during Form Definition.

8.

When

the format

is

defined as you want, press F2

save the format in memory.

on

disk,

(or

Save Report from the

Volume

format

To

you must select Save Procedure from the

QBE

SAVE

to

save the format permanently

DQL menu

Quick Reports menu).

5-6

DATABASE REFERENCE MANUAL


Report Formatting

How to

To

Define a Format: Overview

illustrate the

processs of formatting a report, Figure 5-2 shows

the query, format, and output for a procedure that Hsts the state.

LAST NAME, and ACCOUNT BALANCE


the

CUSTOMERS

Query

form.

field values for

each customer

in

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Format Types
Columnar Format

The columnar format places each


column and uses the Field Names
report.

If the

Field

Name

DataBase

splits the

is

as the

column headings

in the

longer than the field length, DataBase

more lines. If you don't like the way


Field Names, you can edit the format.

name onto two

splits the

field in a separate vertical

or

The columnar format prints


each fie Id in a separate
vertical cohimn and uses the
field names as the column
headings.

Report Width
In a

columnar

format. DataBase automatically assigns each

column

a width equal to the Field Length, and then totals the width of all
the columns plus a varying number of spaces to determine the line
length required for the report.

You need

this

much

space on a line

to be able print the report correctly.

After making the calculation, DataBase displays the message:

Minimum
where nnn
length

is

is

line length for

a columnar report

is

nnn

the length of the line in characters. If the

less than

minimum

80 characters. DataBase generates the format,

evenly spacing the fields across the report width.

If the

minimum

length exceeds 80 characters (the default screen width), DataBase

asks you to specify the width you want for the report and evenly

spaces the fields across the specified length.

DataBase always inserts 1-2 spaces at the beginning of the line,


from 1-4 spaces between each vertical column, and from 1-4 spaces
at the end of the line to evenly space the columns.
See the following page for an example.

Volume

5-8

DATABASE REFERENCE MANUAL


Format Types
Columnar Format

(cont.)

For example, assume we want to include each customer's first


NAME, LAST NAME, ADDRESS, CITY, STATE, and ZIP CODE in the report
output. The query contains the following six list items:
Field
FIRST

Name
NAME

Field

Length

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Format Types
Columnar Format

(cont.)

Automatic Spacing
you specify a report width longer than the minimum required line
DataBase tries to evenly increase the spaces in the line. For
example, if you specify a line length of 150 characters, DataBase
If

length,

assigns a width of 133 characters calculated as follows: 107 field


characters,

spaces
line.

at

The

20 spaces between

fields (4

between each column), 2

the beginning of the line, and 4 spaces at the end of the


actual report width (133 characters)

specified width of 150 characters, because the

system-defined spacing

is

less than the

used.

The following two pages show examples of


output for two different columnar reports.

Volumes

is

maximum

the query, format,

and

5-10

DATAEASE REFERENCE MANUAL


Format Types
Columnar Format

(cont.)

This page contains the default columnar format and part of the
report output for a query that asks DataBase to Hst the

CUSTOMERS

records,

ACCOUNT balance

Query

showing the state, last name, and

field values for

each customer.

EFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Format Types
Columnar Format With Grouping and

Group
If

Statistics

Statistics

you have specified grouping on any

fields in the query,

DataBase

prompts:

Do you want Group Headers and Group

Trailers?

If you answer yes DataBase creates group headers and


each grouped field.

Group headers
in the

query

is

are group names.

The

automatically included

field

in the

trailers hold group statistical totals; they

specified statistics.

You can

to generate a

used to group the data

group header. Group


group totals for any

grand totals by
command. This position

The .group header and .group


commands are used to

trailer

position group-level statistics


in the report output.

also generate

positioning a total field after the .end

DataBase

list

trailers for

grand

total rather

tells

than a total for a specific

group.

Using the example on the previous page, we can group the records
by STATE and generate statistical totals for each state with the
following query:

Query
for

CUSTOMERS
list

records

STATE in groups with group-totals


LAST NAME
ACCOUNT BALANCE item sum

end

Format
ACCOUNT BALANCE

LAST NAME

STATE

.group header
.items

.group

trailer

State Total

.end

Grand

Volume

Total

5-12

DATAEASE REFERENCE MANUAL


Format Types
Columnar Format With Grouping and

In this example, the

.group header

Statistics (cont.)

is the state field value.


which is }wl a field value, is
typed in the format directly where you want the text to appear in
the report output. Report boundary lines (===) are manually
entered in the report format where you want them to appear in

The .group

text

trailer text {Stale Total),

the report output.

Report Output
LAST NAME

STATE

ACCOUNT BALANCE

CT
Brown

$250.00

Davis
State Total

;;3oo.oo

McDonald

$425.00
$425.00

$550.00

FL
State Total

NJ

Adams

$595.00
$525.00
$1,120.00

Hill

State Total

NY
Anderson
Cooper
Evans

$350.00
S725.00
;;865.00
;;675.oo

Ivers

Jenkins
State Total

$140.00
$2,755.00

Grand Total
In addition to

Grand Total
command.

5-13

group

statistic

$4,840.00

totals, this report

which appears

format includes a

after the .end formatting

Volume

DEFINE FORMA

RINT STYLE: DESIGNING REPORT OUTPUT

T/P

Format Types
Field per Line

Format

per line format produces a report with one field on each


This format is used when printing a large
that
cannot fit across the width of a page.
number of fields

The

field

line of the report.

The field per line format


pn/ifi one field on each line of
the report. A blank line is
inserted between records.

When you

select field

per

DataBase positions each output

line.

on a separate line. The name of the field appears at the left


margin and the field value begins in column position 40. The fields
in each record appear directly below one another. A single blank
field

line

is

inserted

between records.

For example, suppose you want to include all the following fields
from an INVENTORY form in the report output. The query looks
as follows:

Query
for

INVENTORY
list

records

PART NUMBER

DESCRIPTION
STORAGE LOCATION
;

VENDOR CODE
VENDOR NAME
COST PER UNIT
QUANTITY ON HAND
REORDER LEVEL

LEAD TIME

REORDER AMOUNT

end

Format
.items

PART NUMBER
DESCRIPTION
STORAGE LOCATION

VENDOR CODE
VENDOR NAME
COST PER UNIT
QUANTITY ON HAND
REORDER LEVEL
LEAD TIME

REORDER AMOUNT
.end

Volumes

5-14

DATABASE REFERENCE MANUAL


Format Types
Field per Line

Format

(cont.)

Report Output
PART NUMBER

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Format Types
Record Entry Format

The record entry format produces a

report that duplicates the

layout of the specified Record Entry form.

The record entry formal prints


the output using the layout of
the specified Record Entry

When you

form.

select the

record entry format. DataEase creates a

format with the same lasout as the Record Entr\' form. DataEase
automatically uses
specify

list

from the form; you only have to


you want to group, sort, or generate statistics.

all fields

fields if

For example, suppose you want

to include

NAME. ADDRESS. CITY. STATE, and


query looks as follows:

ZIP

CODE

each customer's flll

in

your report output. The

Query
for

CUSTOMERS
records
FULL NAME
list

ADDRESS
CITY

STATE
ZIP

end

Format
.items nosplit

FULL NAME
ADDRESS
CITY

STATE

.end

Report Output
full NAME John Adams
ADDRESS
8 Smallwood Drive
CITY
Longbranch state NJ

zip

07740

NY

zip

11725

FULL name Pat Brown


ADDRESS
25 Evergreen Circle
CITY
Norwalk
state CT

zip

06851

FULL NAME
ADDRESS
CITY

Lvnn Anderson
30 Bainbridge Ave

Commack

Volume 3

state

5-16

DATABASE REFERENCE MANUAL


Format Types
Template Format

The template fomiat


shared

among

is

used to create a generic format that can be

a variety of users to create standardized reports.

Even users whose databases are named and structured differently


can use report templates for common or roll-up reporting.

You

define the template

Form

first in

Definition.

The template format

is

specially designed form that

can he used as a generic


format for a variety ofDQL
Procedures and Quick Reports.

Define a template

any other form, except you enter report formatting


commands directly on the form (the formatting commands are
explained in the custom formats section). Type the form text and
position fields in the appropriate places on the form. Specify Field
Type, and Length, and skip all other field questions. Use generic
Field Names (such as name, id#, etc.) to make the format

just like

compatible with as

many

different output requirements as possible.

You should create and store your template forms in a separate


database so you don't confuse them with your Record Entry forms.
It's also important to keep track of the DOS filename for each
template since you must use this name to specify the template.

When you
Name

select template.

of the

Template

Enter the template's


press

RETURN.

DOS

file:

filename (including drive

If

By

field

you

order 2: By

select

By

template fields

letter)

and

DataEase then asks:

Match Template Fields


1

DataEase asks:

field

to report fields by:

name

field order, the report output is

matched

to the

order the fields are listed in the query.

If you
matched to the template
fields by Field Name (name in the output is matched to the name
field on the template, state is matched to the state field, etc.).

select

By

field

NOTE: If the

in the

name,

template

the report output

is in

is

a directory other than the database

you must use the DOS SUBST command to


substitute a drive letter for the name of the directory
where your templates reside. For example: SUBST Q:
directory,

C:\DEASE\TPLATES.
DataEase does not
5-17

let

This

is

the only place

you enter a

where

DOS PATH.
Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Format Types
Template Format

To maximize
in

Field

Names
#.

Names

to

make

it

template field

(e.g., a

INVOICE

PART

#.

and ? wild card symbols


match report output
named *# can be matched with
the *

you can use

flexibility,

template Field

CUSTOMER

(cont.)

#,

easier to

etC).

For example, assume we create a template with a field called


*NAME. We want to include each customer's full name, address,
CITY, STATE, and ZIP code in the report output. The query looks as
follows:

Query
for

CUSTOMERS
records
FULL NAME

list

ADDRESS
CITY

STATE
ZIP

end
In this example,

if

we

FULL NAME field data


If

we

tell

is

DataEase

to

match By field order, the

assigned to the first field

in the

template.

DataEase to match By field name, the full name


is matched to the first template field with a Field
that contains the text string name. In either case, the

tell

information

Name

template format looks as follows:

When using the template


format, if two or more fields
in the qiieiy match a single
field in the format, only the
first query field appears in the
report output. Ifnw or more
format fields match one field
in the query, each format field
receives a matching value.

Format
.items

NAME
address
STATE

CITY

ZIP

.end

The

report output for this query appears on the next page.

Volume

5-18

DATABASE REFERENCE MANUAL


Format Types
Template Format

(cont.)

Report Output
NAME
ADDRESS
CITY

NAME
ADDRESS
CITY

NAME
ADDRESS
CITY

The dotted
format

text.

John Adams
8 Smallwood Drive
Longbranch
state NJ

zip

Lynn Anderson
30 Bainbridge Ave.
Commack
state

zip

11725

zip

06851

NY

Pat Brown
25 Evergreen Circle
Norwalk
STATE CT

line

(...)

It is

that

typed

07740

appears between one record and the next


in the

is

format immediately above the .end

command.

5-19

Volume

DEFINE FORMAT/PRINT STYLEiDESlGNING REPORT OUTPUT


Format Types
GrafTalk Chart Format

The GrafTalk Chart format

translates the output

from a

DQL

Procedure into a chart or graph created by DataBase GrafTalk. our

companion business graphics product. To use this format,


DataEase and GrafTalk must be installed on the same computer
directories located in the DOS PATH. When you run the

The GrafTalk Chart format


lets you create a chart using
data generated hy a DQL
Procedure or Quick Report.

in

procedure, DataEase invokes GrafTalk and displays the output in a


business graphic format, such as a bar or pie chart. For example,

assume we want

BALANCE

to

produce a chart

information for each

shows the ACCOUNT


The query looks as follows:

that

state.

Query

CUSTOMERS

for

list

records

STATE

in

groups

ACCOUNT BALANCE

sum

end

When you

select the

GrafTalk Chart format. DataEase displays


The format looks as follows:

the Formatting screen.

Format
ACCOUNT

STATE
.items

.end
.call

GrafTalk /D

This format

is

%r %e

explained as follows:

GrafTalk puts the Field Names


column headings for the chart.

The

.call

to invoke

command
GrafTalk

at the

at the

top of the format as

bottom of the format

tells

after all the records selected

DataEase

by the query

have been processed.

The /D parameter

tells

GrafTalk to draw a chart using the data

transferred from DataEase.

The

%r parameter specifies the GrafTalk chart filename


DBG extension).
%e parameter specifies the DataEase data filename

(the report filename with a

The

(DAT extension).
Volume

5-20

DATABASE REFERENCE MANUAL


Format Types
GrafTalk Chart Format (cont.)

When
can

1.

the

GrafTalk Chart formal is displayed on the


column headings within these restrictions:

screen,

you

edit the

GrafTalic uses the

first

eight characters of the field

name

as

column name, which can include single embedded spaces


only. The first character of each column name must be a
the

letter.

2.

Column names must be

3.

The column name format


formatting command.

separated by

line

two or more

spaces.

must remain above the .items

The

first time you run the procedure, DataBase automatically


invokes GrafTalk so you can define the GrafTalk chart (unless you
have already created the chart
see the note below). In GrafTalk

you specify the

details about the chart, for

example, whether

it

is

bar chart or a pie chart and whether it should display on the screen
or be drawn on a plotter. Refer to the Graffalk manuals for
information on

NOTE:

how

to create charts.

You can also create the chart


running the

DQL

chart the same

.DBG

in GrafTalk before
Procedure. Be sure to give the

the DQL Procedure with a


Refer to the GrafTalk manuals for

name as

e.xtension.

information on creating a GrafTalk chart.

To export data to GrafTalk to he used independent of


DataBase, use the GrafTalk export format (see the
Export section of this chapter for more information).

5-21

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Format Types
GrafTalk Chart Format (cont.)

DataBase automatically assigns a disk destination on the Print Style


screen when you save a GrafTalk chart format. When the
procedure is run, the output is written to a file which is passed to
GrafTalk. DataBase automatically creates a unique DOS file name
for this file. If you wish, you can overwrite this filename on the
Print Style screen (be sure to include the drive letter

from

if

it

is

different

the default data drive).

When

the procedure

is

run.

DataBase executes the

.call

command,

invoking GrafTalk and providing both the GrafTalk chart (the %r


parameter) and DataBase data filename (the %e parameter). After
the chart

created. GrafTalk automatically returns control to

is

DataBase.

To modify

the GrafTalk chart definition, enter GrafTalk and use the

Restore Chart Utility to load the chart and


wish. After you save the revised chart

in

make any changes you


GrafTalk.

it

is

automatically called by DataBase whenever you run the report.


It's

the

procedure

is

run.

not necessary to resave or modify the DataBase procedure in

any way
report.

to reflect the

changes to the

chart.

Whenever you run

this

GrafTalk recreates the chart with your new data.

How to
The

When

DataBase executes the .call


command, invoking GrafTalk
and specifyini^ both the
GrafTalk chart and
DataBase datafde names.

Create a GrafTalk Chart Format

steps to automatically create a GrafTalk chart format from

DataBase are summarized below.

1.

Define your query as desired.

2.

Select GrafTalk chart as the format.

3.

Save the procedure using Option

DQL

7.

Save Procedure, on the

menu. You must save the procedure before going any

farther,

because DataBase uses the name of the procedure

when

names

Volume

it

Whenever you run this


procedure. GrafTalk
recreates the chart with your

new

data.

the GrafTalk chart.

5-22

DATAEASE REFERENCE MANUAL


Format Types
GrafTalk Chart Format (cont.)

4.

Select Option 2. Start


to help

5.

New

memory

Procedure. This clears

DataEase run the procedure.

Select Option

Run Procedure, and

1,

select the procedure

you

have just saved.

6.

If the Print

Style Screen displays, just press F2

SAVE. Do

not change anything on this screen. GrafTalk uses the


values that have been automatically entered there by

DataEase.

7.

In a

few moments, the GrafTalk Main Menu displays.

Design your chart as desired, following the instructions in the


GrafTalk manuals on how to create a chart. Make sure you
specify whether you want your chart to display on the screen
(the default) or

8.

go

to a printer, plotter, etc.

You do

not have to enter data, since your data will come


from DataEase automatically. However, you must use the

GrafTalk Select Data option to select the data to be included


in the chart. See the GrafTalk manuals for more information.
9.

Use the GrafTalk Chart Utilities to save the chart. Do not


change the default name provided by DataEase. DataEase
uses this

Be

name

to find the chart

sure to answer

no

to the

when

save

the procedure

data'.'

DataEase provides new data each time you use the


10.

From now

on.

when you

is

run.

question, since
chart.

run the procedure, the chart will

automatically display (or print).

You

will not

have to use the

GrafTalk menus again.

5-23

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Format Types
GrafTalk Chart Format (cont.)

1.

Any changes

you make

that

to the data in

your form will be

automatically reflected in the chart the next time you run the

procedure.

12. If

you want

to

make changes

chart in GrafTalk.
restore the chart,

Use

to the chart,

you must

the GrafTalk Restore

edit the

Chart option

to

and then make any desired changes. The

changes will be reflected the next time you run the

DQL

Procedure.

NOTE: DataBase and GrafTalk

each create unique

filenames for the chart based on the DataBase report

Do

name and do not save the


B3 to save
the chart, then return to the GrafTalk Main Menu
and e.xit. You automatically return to the menu from
which the DataBase procedure was run.
name.

not change

this

current data with the chart. Simply Press

Volume

5-24

DATAEASE REFERENCE MANUAL


Format Types
Mailing Labels Format

The mailing

labels format lets you quickly generate mailing label

output that can be used with preformatted label sheets.

It

can also

be used for any "multi-wide" output report.

The mailing labels format produces output

similar to the field per

The mailing labels format


generates output that can he
used for mailing purposes with
or without preformatted label
sheets.

DataEase positions each output field on a separate


are omitted from the format. Each field
value begins at the left margin. The fields in each record appear
directly below one another. A single blank line is inserted between
line format.

The Field Names

line.

records.

When you

select

How many

mailing labels, DataEase prompts:

labels across?

Enter the number of records to be printed across


direction).

(in a horizontal

DataEase then asks?

How many columns

per label?

Enter the number of characters

in the

widest

answered both of these prompts, press F2

field.

SAVE

When

you've

to save the format.

For example, suppose you want to print each customer's full


NAME, ADDRESS, CITY. STATE, and ZIP CODE on mailing labels that

come

3 across on preformatted sheets. We'll assume that the

widest field

is

25 characters. The query looks like

this:

Query
for

CUSTOMERS
records
FULL NAME
list

ADDRESS
CITY
state;
;

ZIP

end

5-25

Volume

DEFINE FOR MAT/ PRINT

DESIGNING REPORT OUTPUT

ST'tLE:

Format Types
Mailing Labels Format

answer to the labels across? question, type 3. In answer to the


columns wide!' question, type 25 (each column is one character).
The report format and output are shown below.
In

Format
.items across 3 wide

25

.end

To
1

print the city, state,

move

and zip code on one

line,

the cursor into the city field, press FIO.

on the format
and specify

suppress spaces; 2) type a comma after the cit'i


paste the state and zip fields onto the same line.

Report Output
John Adams

Lynn Anderson
30 Bainbridge Ave.
Commack, NY 11725

8 Smallwood Drive
Longbranch, NJ 07740

NOTE: When printing


specify the

on continuous form

page length as on
shown

Specification screen (as


chapter).

It

may

format, adding

Volume

field;

labels,

3) cut

and

Pat Brown

25 Evergreen Circle
Norwalk. CT 06851

be sure to

the Print Style


at the

end of this

also he necessary to modify the

e.xtra

blank lines between records.

5-26

DATAEASE REFERENCE MANUAL


Format Types
Export Format

The export format


program.

creates a disk file to export data to another

merge a DataBase data file with a


word processed document such as a form letter, or to export

The export format is used to


export data to another

numerical data from DataBase into a spreadsheet or business


graphics program. DataBase provides eight export formats,

program.

It is

often used to

including tho,se for Lotus 1-2-3, Lotus Symphony, WordPerfect,


WordStar, MultiMate, and most other programs.

When you
What

select export,

is

DataBase asks:

the export format?

DataBase can export data in


formats used hy Lotus 1-2-3.
Lotus Symphony. WordPerfect,
WordStar. MultiMate. and
most other popular programs.

and displays the available formats.


1

Mail-merge

2:

MultiMate

3:

WordPerfect

4:

GrafTalk

5:

Lotus 1-2-3

Export to a Wordstar document.

Bxport to a MultiMate document.

Export to a WordPerfect document.

Export to DataBase GrafTalk.

Export to Lotus 1-2-3 or Lotus

Symphony.
6;

Variable Length

Export variable length ASCII

records.

7:

Fixed Length

8:

DIF

Bxport fixed length ASCII records.

Bxport using the Data Interchange Format.

Files created using export formats are intended to be read


into other
programs. Therefore, the formats do not include headers, footers,
or other non-data output. When creating an export,
be sure to
direct the report output to a disk destination

screen and be sure no printer

5-27

name

is

on the

Print Style

specified.

Volume

DEFINE FORMAT/PRINT

ST'iLE:

DESIGNING REPORT OLTPLT

Export Format
Mail-merge

The Mail-merge export format generates a disk file


merged with WordStar documents (such as merging
information

form

in

that

can be

the addressee

letters).

The Mail-merge export format displays one record on each

carriage return

is

used to separate records and a

comma

is

The Mail-merge export format


exports data in u format that
can he merged with documents
created with WordStar or
other programs that use the

line.

used

Text fields are enclosed in quotation marks.


and Numeric String Fields are listed without quotation
marks (if quotes are required, you can edit the format, inserting the
quotes at either end of the field, before the field separators). After
selecting Mail-merge, you have the option of including Field
to separate fields.

Mail-merge communications
format.

Number

Names

as the first line of the output (the Field

enclosed

Names

are also

in quotes).

For example, suppose you want to include each customer's full


NAME, ADDRESS. CITY, STATE, and ZIP CODE, with the Field Names

in

your report output. The query looks as follows:

Query
for

CUSTOMERS
records
FULL NAME

list

ADDRESS
CITY

STATE
ZIP

end

Format
FULL NAME
.items

_M

ADDRESS

",.,-,,"
,

CITY

",
,

-*

STATE
_ll

"-.r^"
,

ZIP

.end

Report Output
"FULL NAME", "ADDRESS", "CITY", "STATE", "ZIP"
"John Adams", "8 Smallwood Drive", "Lorigbranch", "NJ", 07740
"Lynn Anderson", "30 Bainbndge Ave.", "Commack", "NY", 11725
"Pat Brown", "25 Evergreen Circle". "Norwalk", "CT", 06851

Volume

5-28

DATABASE REFERENCE MANUAL


Export Format
MultJMate

The MultiMate export format generates a disk file that can


be
merged with MuhiMate documents. When you create a
MultiMate
export file, remember to add the .doc filename
extension used by

"

MultiMate.

documents.

The MultiMate format positions each Field Name on


line. The field value is inserted under
the Field Name

The MultiMate expon format


exports data in a format that
^^ merged with MultiMate

a separate
in the

format. DataEase inserts special codes in the


format to delimit
(I-) and records
(j_).

fields

For example, suppose you want to include each


customer's full
NAME, ADDRESS, CITY, STATE, and ZIP CODE, with the Field
Names
your report output. The query looks as follows:

in

Query
for

CUSTOMERS
records
FULL NAME

list

ADDRESS
CITY

STATE
ZIP

end

Format
.items
l-FULL NAMEI-

l-ADDRESSIl-CITYI-

_L
.end
.call

MMERGE

-q

%m %e

5-29

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Export Format
MultiMate (cont.)

In this format, the

MuhiMate

formatting

commands

(|-)

are inserted

by DataBase on either side of the Field Names and after each


value. The (J) formatting command is the MultiMate end of

field

record symbol.

The

.call

named

command

calls a special

DataBase conversion program

MMERGE that converts the output into the required

MultiMate format.
After DataBase generates the format:

SAVB

1.

Press F2

2.

Select Option 6, Define Print Style on the

DQL menu.

3.

When

is

to save the format.

the Print Style Specification screen

displayed, select

the disk destination.

4.

When you name

the output

file,

be sure to include the

DOS

path for the MultiMate directory, and the MultiMate filename

extension .doc as shown below.

C:\MM\MAILLIST.DOC

When you

select

Run Procedure,

the output file

is

automatically

formatted for use as a MultiMate secondary merge document, with


the following restrictions from the MultiMate program:

The maximum number of records


time

is

The maximum

The maximum number of fields

Field

Volume

that

can be converted

at

one

254. Excess records are discarded.


field

width

Names of more

than

is

156 characters.
is

64 per record.

2 characters

may be truncated.

5-30

DATABASE REFERENCE MANUAL


Export Format
WordPerfect

The WordPerfect export format generates a disk


merged with WordPerfect documents.

The WordPerfect format


line separated

end of each

Field

can be

positions field values in one continuous

by a hexidecimal code (@[120A])

field.

file that

Names

The WordPerfect export


format exports data in a
format that can he merged
with WordPerfect documents.

that signals the

are omitted.

For example, suppose you want to include each customer's full


NAME. ADDRESS, CITY, STATE, and ZIP CODE in your report output.

The query looks

as follows:

Query
for

CUSTOMERS
records
FULL NAME
list

ADDRESS
CITY

STATE
ZIP

end

Format
.items

^@[120A]i

i@[1 20A]s3a8@[1 20A]i@[1 20A]^i@[050A]\

.end
In this format, the

@[120A]

that

generates the WordPerfect Merge

The @[050A] generates

is

DataEase
each field value.
the WordPerfect "end

inserted by

Code C^R)
C^E) Merge Code,

after

of record" code.

5-31

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Export Format
WordPerfect

(cont.)

After DataBase generates the format:

F2

Press

SAVE

to save the format.

2.

Select Option 6, Define Print Style on the

DQL

3.

When

is

the Print Style Specification screen

menu.

displayed, select

the disk destination.

4.

When you name

DOS

the output

file,

be sure to include the

full

path for the WordPerfect directory, or the directory

where you want

to store the file.

When you

select Run Procedure, the output file is generated as a


WordPerfect secondary merge file. There are no restrictions on the

number of records or

Volume

the length of the fields.

5-32

DATA EASE REFERENCE MANUAL


Export Format
GrafTalk

The GrafTalk Export format creates an output file in a format


can be read by GrafTalk, our companion business graphics
program. Unlike the GrafTalk Chart format described earlier

that

in

chapter (which calls GratTalk and creates a chart from within a


DQL Procedure), the export format creates a file that you use
separately to create a chart or graph with GrafTalk, after you've
exited from DataEase. Use this format if you have DataEase and
this

The GrafTalk Export format


exports data in a format that
can he used to create GrafTalk
charts and graphs.

GrafTalk installed on different computers.

When you
you want
yes, the

select the

GrafTalk Export format, DataEase asks

to include the Field

record

first

in the

Names

output

file

in the

format.

If

you

contains the Field

Names

which are used as column names by DataEase GrafTalk.


select no, Field

Names

and give the

file,

of the

file

DataEase

created by DataEase.

eight characters of the DataEase Field


in

you

enter GrafTalk and use the data to

In GrafTalk, specify the input as a

DOS name

If

are not included in the report output.

After you create the export


create a chart.

if

select

Names

file,

The

first

are available for use

GratTalk as column names.

For example, suppose you want to produce a chart that shows the
account balance information for each customer. The query looks as
follows:

Query
for

CUSTOMERS
list

records

CUSTOMER #
ACCOUNT BALANCE
;

end

Format
CUST

ACCT BAL

.Items

.end

NOTE: When

usin^^ GrafTalk. field names cannot he longer


than H characters. For this reason, we've changed

the format to CUST #

5-33

and acct

bal.

Volume

3
I

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Export Format
GrafTalk (cont.)

Report Output
ACCT BAL
CUST #
2235
4009
3525
6420
1248
5512
7860
1514
0900
6002

595.00
350.00
250.00
725.00
300.00
865.00
525.00
675.00
140.00
425.00

Once you've created a GrafTalk export


column names within these restrictions:
1

GrafTalk uses the

first

format, you can change the

eight characters of the Field

Name

as

column name, which can include single embedded spaces


only. The first character of the column name must be a letter.
the

2.

Column names must be

3.

The column name format


formatting command.

separated by

line

two or more

must remain above

spaces.

the .items

For further information on DataBase GrafTalk, see the GrafTalk


Reference Manuals. The Reader section provides information on
GrafTalk Menu Mode.

Volume

5-34

DATABASE REFERENCE MANUAL


Export Format
Lotus 1-2-3

When you

Lotus 1-2-3 export format. DataBase creates a

select the

report format file that can be read by Lotus 1-2-3 or Lotus

Symphony.

To

create the

appropriate

Lotus 1-2-3 format, specify a disk filename with


extension on the DataEase Print Style Screen;

can he read into a Lotus


spreadsheet. Do not send a
Lotus export to the screen:
doing so can lock your system.

file

.WKS

for Lotus 1-2-3 Version

.WKl

for Lotus 1-2-3 Versions 2

.WRK

for Lotus

When

the

The Lotus 1-2-3 export format


exports data in a format that

the Lotus

columnar format

file,

the data

is

arranged

spreadsheet. DataEase creates a

spreadsheet for each record

column containing a

and 3

Symphony

program reads the


in the

field.

in the

source data

file,

in a

row

in the

with each

Since DataEase exports values, not

formulas, the data exported by DataEase

is

compatible with

all

three Lotus formats.

The format

for a Lotus 1-2-3 export looks like this:

Format
.export Lotus 1-2-3

There are three special considerations to keep


preparing a Lotus 1-2-3 export:

DataEase does not display the

in

mind when

field layout

and you

cannot edit the Lotus 1-2-3 export format.

2.

The Lotus
it

3.

1-2-3 output

is

not in

ASCII

format. Sending

to the screen can lock the system.

You cannot
totals, or

use the in groups, in groups with

any type of

DQL

statistical

group

operator in a

Lotus export.

5-35

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Export Format
Variable Length ASCII

The Variable Length export format generates an ASCII

file that

can be easily imported and used by most popular programs.

The Variable Length export format displays one record on each


line. If the program employs specific record and field separator
characters, use these in the format.

If not,

The Variable Length export


format exports data in a
format that can he read hy
most popular programs.

use a carriage return to

separate records, and use any character that does not appear in the

DataBase also asks

data to separate fields.


the Field

Names

as the

first line

if

you want

to include

of the output.

For example, suppose you want to include each customer's full


NAME, ADDRESS, CITY, STATE, and ZIP CODE, with the Field Names in
your report output and you specify a tilde (~) as the field separator
character.

The query looks

as follows:

Query
for

CUSTOMERS
records
FULL NAME
list

ADDRESS
CITY

STATE
ZIP

end

Format
FULL NAME-ADDRESS-CITY-STATE- ZIP
.

items

.end

Volume

5-36

DATABASE REFERENCE MANUAL


Export Format
Variable Length ASCII (cont.)

Report Output
FULL NAME-ADDRESS-CITY-STATE-ZIP

When

choosini; field

and

the data will incorrectly interpret the characters in the data as field

record separators, never itse


any character that appears in
your data. If you use any
character other than a
carriage return as the record
separator, you must enter that
character at the end of the
format line followed hy a

or record separators.

backslash.

John Adams~8 Smallwood Drive~Lonqbranch~NJ~07740


Lynn Anderson~30 Bainbridge Ave. -Cfommack-NY-1 1725
Pat Brown~25 Evergreen Circle~NonA/alk~CT~06851

When

choosing

field

and record separators, be careful not to use a


in your data. If you do, the program reading

character that appears

you use any character other than a carriage return as the record
separator, enter that character at the end of the format line followed
by a backslash. For example, if the
sign is used as the record
separator, it is inserted at the end of the format line followed by a
If

backslash as shown below.

5-37

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Export Format
Fixed Length ASCII

The Fixed Length export format

many programs,

read by

but

it

creates an

ASCII

should be used only

can be
no other

file that
if

export format can be used by the target program.

The Fixed Length export


format exports data in a
format many programs can
it should only he
used when no other export
format can he used hy the
target program.

read, hut

Because each output record


export format produces a

ASCII

is

file

the

same

length, the

Fixed Length

containing a continuous stream of

There are no field or record separators. For example,


each customer's full name, address, city, state, and zip
your output, the query and format look as follows:

data.

to include

CODE

in

Query
for

CUSTOMERS
records
FULL NAME
list

ADDRESS
city

state
ZIP

end

Format
.items
-\

.end

DataBase automatically

inserts a backslash character at the

end of

the format line to suppress the carriage return. This character does

not appear in the output.

Report Output
John Adams
Lynn Anderson
Pat Brown

NOTE:

8 Smallwood Drive
30 Bainbridge Ave.
25 Evergreen Circle

Longbranch NJ

Commack
Norwaik

07740

NY 11725
CT 06851

Because the Fixed Length export format has no field


or record separators,

it

can lead

errors in the target program.

to

For

data import

this reason,

we

recommend that you only use this format if no other


formal

Volume

is

acceptable.

5-38

DATA EASE REFERENCE MANUAL


Export Format
DIF (Data Interchange Format)

The DIF export report format generates a file in Data Interchange


Format. The DIF format was established for VisiCaic and can be
used by many other programs to import and export data.

When you

select the

DIF

format, DataBase asks whether you

v\

DIF export formal


exports data in a format that
The

can he read hy many popular


programs.

ant

to:

Include

If

field

you answer

names

yes.

in

the format

DataBase includes the Field Names in quotes as


you answer no, the Field

the first record just before data output. If

Names

are not included in the export format.

DIF

is a very specialized format; do not try to edit a DIF export


unless you're thoroughly familar with the Data Interchange Fonmat.

5-39

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Format Types
Custom Format

The custom format

you design any kind of format you want.


form letters or designing
output to conform to preprinted business forms. However, because
you must design a custom format from scratch, it should only be
used if none of the predefined formats can produce output close to
the final format you want. If a predefined format produces output
close to your requirements, use the predefined format and then edit
it to serve your custom report requirements.
It is

lets

particularly useful for generating

When you

The custom format gives you


complete control over the
appearance of a report, but it
requires a little extra work to
design a custom format. For
this

reason,

we recommend

whenever possible you


select one of the predefined
formats and modify it to suit
your needs.
that

custom, DataBase displays a blank screen.


You design the report format from this starting point, using any
combination of formatting commands, form text, and fields.
Remember that a format must always include at least two
commands: .items and .end. Other formatting commands are
optional. A custom format with several formatting commands is
shown below.
select

header

footer

itens

Add header text/fields here.

.end

ftdd

footer text/fields here

Add forMat text and


list fields here.

F4

F5

ESC

Fia

- Sample Formatting Commands


Used to Create a Custom Format

Figure 5-3

Volume

5-40

DATABASE REFERENCE MANUAL


Format Types
Custom Format

(cont.)

Specifying Fields

in

Custom Format

When you

design a custom format from scratch, you have two


options for specifying fields. One method is to select all the fields
as

items in the query and then simply position them


format.
list

in the

Report fields are usually


specified as list items in the
query. Fields that do not
require sorting, grouping, or

can he specified in
the report format without
statistics

The other method

is

to specify only those fields that require sorting,

grouping, or

may

statistical output as list items. The remaining fields


be directly specified in the format. However, you are not

assisted by

menus

to select Field

Names from

if

you use

appearing

in the query.

this

second method.

Cursor Movement on the Format Screen


DataBase formats can be up
screens long.

To

to

4000 characters wide and up

scroll the display to the right or left, just

to 16

move

the cursor off the

A format van have up

scrolls

characters and occupy up to


16 screens.

edge of the screen. The display immediately


one half-screen (40 characters) in the chosen direction.
Alternatively, hold down the CTRL key while pressing either
Arrow key for "express" cursor movement. CTRL -> moves the
cursor 40 positions to the right; CTRL <- returns immediately to

Column

NOTE:

4000

1.

The Formatting Comrtiaiids and procedures


described in the pages that follow can he used
create a custom format or to edit a predefined
formal.

to

When you move the cursor off


the side of the screen, the
display automatically scrolls
in the

5-41

to

chosen direction.

Volume

DEFINE FOR MAT,'PRINT ST\LE: DESIGNING REPORT OUTPUT


Custom Format
Formatting

Commands

DataBase provides eight Formatting Commands that control the


appearance of report output, whether it is displayed on screen or
printed as hard copy. Formatting

Commands

are inserted in the

report format, but they are not displayed in the report output.

Each Formatting
placed

in

Command

Column

When you

is

at the left

type a period in the

displays the following menu:

preceded by a period and must be


margin of the format.
first

column of

the format. DataBase

DATABASE REFERENCE MANUAL


Custom Format
Formatting

Commands (cont.)

The page-level Formatting Commands are .page, .header, and


.footer. The page commands can be used as options in any
report format. The .header and .footer commands specify text
and/or field values that you want to print

at the

top and/or

bottom of the pages of the report. The .page command


advances the report to a new page even if the output has not
reached the end of the current page.

The external call Formatting Command can be used


option at the very end of any format.

When

all

Formatting Commands can he


used in any combination as
long as the format contains an
.items command, an .end
command, and a .group
trailer command for each
group header command.

as an

the records

have been processed and the output created, the program


specified by the .call command is automatically invoked.
When the called program is completed, control returns to
DataEase. You must select Start New Procedure before
running a procedure that contains a

The

DQL

Formatting

Commands

.call

can be used

as long as the format contains an .items

command.
in

any combination

command, an .end

command, and one .group trailer command for each .group


header command. Figure 5-4 shows a basic format that includes
only the two required commands, .items and .end. All the
formatting commands are discussed in greater detail in the pages
that follow.

itens

FULL NftME
ADDRESS
CITY
end

Figure 5-4

5-43

Basic Format

Volume 3

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Custom Format
Required Formatting

Commands

The Required Formatting Commands


format must contain one .items

and

are .items

and .end.

command and one

command

.end

cannot contain more than one of each of these commmands.

it

The .items Command


above the .items and any .header command
lines is known as the Report Header Area. Any information placed
in the Report Header Area before the first Formatting Command
prints once at the beginning of the report.
In the format, the area

The area between

known
.items

command and the next command is


Any information placed between the

The area before the .items and


.header commands is called
the Report Header Area. The
information in this area is
printed once at the beginning

of the report.

the .items

as the Items Area.

command and

the next Formatting

Command

is

printed once

for each record processed by the query. The Items Area usually
contains all the fields and form text you want repeated for each
record.

The area between the .items

command and the


Formatting

ne.xt

Command is

called the Items Area.


Information in this area is
printed once for each record
processed by the queiy.

The .end Command


end of record processing. The area
following the .end command line is known as the Report End Area.
Any information following the .end command is printed once at the
end of the report, after all the records have been processed. If you
place a field after the .end command, statistics for that field can be

The .end command

specifies the

generated from all the records processed


for an individual group.
field
all

If

and place the

field after the

records in the report

a .page

command

End Area,

For example,

is

is

you request a

is

Information in this
printed once at the end

of the report, after all the


records have been processed.

sum

for a

a grand total for

placed after

all

output lines

in the

the printer skips to the top of the next page

in the

area

in the report, rather than

command,

.end

End Area.

generated.

report has finished printing.

placed

if

The area following the .end


command is called the Report

If

a .call

Report End Area and

it

command

is

when

used,

must be the very

Report

it

the

must be

last line in

the format.

Volume

5-44

DATABASE REFERENCE MANUAL


Custom Format
Required Formatting

Commands (cont.)

To

illustrate the Required Formatting Commands, the


example
below shows a query, a predefined columnar format, and output for
a report that lists the state, last name, and account balance
field

values for each customer.

Query
for

CUSTOMERS
list

records

STATE
last name
;

account balance

end

Format
STATE

LAST NAME

ACCOUNT BALANCE

.Items

.end

Report Output

STATE

LAST NAME

ACCOUNT BALANCE

NJ

Adams

NY
CT
NY
CT

$595.00

Anderson
Brown
Cooper

S350 00

Davis

$300.00

;;250.00
1725.00
!

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Custom Format
Required Formatting

Commands (cont.)

Remember that anything between the .items command line and the
command line displays once for each record processed by the
query. For example, if we edit the format adding a dotted line in
next

the Items Area, like this:

Format
STATE

LAST NAME

.items

.end

The

altered output looks like this:

Report Output
STATE

ACCOUNT BALANCE

DATABASE REFERENCE MANUAL


Custom Format
Command Options

Required Formatting

There are two options you can add to an .items command to control
how the information in the Items Area of the format appears in the
output:

The .items
The

nosplit

.items nosplit

Command

command

tells

DataBase not

When

from a record between two pages.


end of a page, if there are not enough

to split information

the output approaches the

on the page to print


DataBase automatically

lines left

the required output for the current record,

The .items nosplit command


prevents data from a single
record appearing on tvi-o
different pages.

advances to a new page.

M Command

The .items across N wide


Normally, information
record

in vertical

command

lets

in the

Items Area

output lines.

you

is

record every

wide

prints

When you

use this

records across the page, starting a

M characters.

You

and M, as long as the product

The .items across

N wide M

command prints several

print this information horizontally as well as

vertically (as mailing labels often require).

option, DataBase

printed once for each

The .items across

new

records across the page.


This is useful for printing
special jobs like "3 across"

mailing labels.

can assign any value you want to

M does not exceed the total

specified width for the report.

N wide option, either value may be


you specify one and not the other, DataBase
divides the output device width by the specified value and
calculates the other value. For example, if you are using an
80-column printer, .items across 3 would print the second record
beginning in column 27 and the third in column 53 (80 / 3 = 26
When

using the across

specified

first.

If

plus).

The nosplit and/or across


the .items

command on

the

wide
options must appear after
same line in the format. These two

options can only be used in conjunction with the .items Formatting

Command

(they cannot be used to

modify header, group, or

trailer

output).

5-47

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPL'T


Custom Format
Required Formatting

How to Use the


If

you

Command Options

.items across

are printing mailing labels

Command

and the label sheet has two labels

per row and each label (including the space between the labels) is
option in
30 characters wide, you could insert the across N wide

a predefined Record Entry format as follows:

Format
.items across 2 wide

30

.end

The

final report output

starting in

column

might look

like this,

with the second label

Report Output
John Adams
8 Smallwood Drive
Longbranch, NJ 07740

Lynn Anderson
30 Bainbridge Ave.
Commack, NY 11725

Pat Brown
25 Evergreen Circle
Norwalk, CT 06851

64 Lake Street
Alameda, CA 94501

NOTE: The

Paul Carter

mailing labels format, which

is

designed to

speed address label printing, incorporates the .items


across

and

Volume

wide

M values.

M option and prompts you for the N

5-48

DATAEASE REFERENCE MANUAL


Custom Format
Group Level Formatting Commands

The Group Level Formatting Commands


.group

are .group

header and

Group Level Formatting

Commands

trailer.

when

Group Level Formatting Commands are used with a query that


includes fields specified either in groups or in groups with
group-totals (groups in Quick Reports). The Group Level
Formatting
in the

Commands

control

how and where

query's grouped fields appears

in the

in the

the information

There must he one group


command for each
.group header command in
the format.

trailer

query.

For each .group header

specified in groups or in
groups with group totals.

output.

The Group Level Commands are always used in pairs. There must
be one .group header and one .group trailer in the report format
for each li.st field specified in groups or in groups with
group-totals

should he used

the query contains fields

command

a coirespondinii .group trailer

in a report

command.

If

format there must be


you have more than

one .group header and .group trailer in a format, they correspond


to each other as follows: \hQ first .group header corresponds to the
last .group trailer, the second .group header corresponds to the
second from last .group trailer, etc. They are paired from the top
and bottom inward as shown in Figure 5-5.

.group header

.group header B
.items

.group
.group

trailer

trailer

.end

Figure 5-5

5-49

Pairing

Group Formatting Commands

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OLTPLT


Custom Format
Group Level Formatting Commands (cont.)

The area between


Formatting

.group header

Command

information placed

is

in a

known

command and

as a

the next

Group Header Area. Any

Group Header Area

prints

of each group. The area between a .group trailer


the next Formatting

Any

Command

information placed

in

is

known

Group

end of each group. Fields with group

Group

as a

Trailer

once

the start

command and

Group

Area

at

Trailer Area.

once at the
must be placed

prints

level statistics

The area between a .group


header command and the ne.xt
Formatting

Command is

called the Group Header


Area. The information in this
area is printed once at the
start of each group.

Trailer Area.

in

field that has statistics specified in the

than one position

in the

format.

query can appear

For example, you

in

may want

more
the

ACCOUNT BALANCE field valuc to appear in the .items area, the group
of the account balance field to appear in the .group trailer
area, and the overall account balance total to appear at the end of
total

the report.

NOTE:

You can include a .page command

Header or Group

in the

Group

Trailer areas to print each group

on a separate page.

Volume

5-50

DATAEASE REFERENCE MANUAL


Custom Format
Group Level Formatting Commands

(cont.)

The example on

this page and the next contains a query, format,


and part of the output for a report that asks DataBase to list the
STATE. LAST NAME, and ACCOL NT BALANCE for cach customer in the

CUSTOMERS

form.

Group

level totals are included in the output.

Query
for

CUSTOMERS
list

records

STATE in groups with group-totals


LAST NAME
ACCOUNT BALANCE item SUm

end

Format
LAST NAME

STATE

ACCOUNT BALANCE

.group header

.items

.group

trailer

State Total

.end

Grand

Total

$^^m

example, the .group header text is the state field value.


trailer form text (State Total), which is not a field
value, is typed directly in the format where you want the text to
appear in the report output. The report boundary lines (===) are
In this

The .group

entered in the format where you want them to appear


output.

In addition to

group

totals, this

Total statistic which appears after the .end formatting

5-5

in the report

format includes a Grand

command.

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Custom Format
Group Level Formatting Commands

(cont.)

Report Output
STATE

CT

LAST NAME

ACCOUNT BALANCE

DATAEASE REFERENCE MANUAL


Custom Format
Page Level Formatting Commands

The Page Level Formatting Commands


information to print

advance

to a

new

page.

tell

DataBase what

top and bottom of each page and

when
The Page Level Formatting Commands

at the

to

.page, .header, and .footer are explained below. An example that


illustrates the use of the Report Header, the .header command, and
.footer

commands appears on

the facing page.

The .page Command


The .page command tells DataBase to immediately advance to a
new page before continuing to print any further output. If the .page
command line is placed first in a Group Header Area, each group,
including Group 1, starts printing on a new page. If it is placed
first in a Group Trailer Area, each group's detail information and

The .page command advances


the printer to a

new pa^e.

on a new page. If you want each


on a new page, but you want Group
on
the same page as the Report Header, place the .page command last
group-level statistics

start printing

group

to begin printing

in the

Group

Trailer Area.

If you place the .page command at the end of the Report End Area.
DataBase advances to the top of a new page when the report
completes printing. If it is placed first or last in the Items Area,
each record is printed on a new page (placing it between fields

causes the records to be


can be used in a format.

The .header

[N]

split).

Any number

of .page

commands

Command

The .header command specifies information to be printed at the top


of each page in a report. The .header command should be placed
near the beginning of the format. There can be only otw .header
in a format, although none is required.

command

The area between

Command

the .header

known

command and

the next Formatting

Page Header Area. Any information


placed in the Page Header Area prints once at the top of each page.
The most common use of a Page Header is to repeat column
headings at the top of each page of a report that prints on more than
one page.

is

printed at the top of each page


in a report. There can he only
one .header command in a
format.

as the

you don't want Page Header information to appear


you can add the optional N parameter to the
.header command, where N is a page number. For example, if you
specify .header 3, in the report format, the Page Header
information begins on page 3 and prints on every following page in
If

until a certain page,

The .header command


specifies information to he

The area between between the


.header command and the
next formatting command is
called the Page Header Area,
hiformation in this area is
printed at the top of each page.

the report.

5-53

Volume

EFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Custom Format
Page Level Formatting Commands

(cont.)

Format
For example, the following format:

DATAEASE TRAINING COURSE SCHEDULE


CITY

DATE

LOCATION

DATE

LOCATION

.header 2
CITY

(cont.)

.footer

For more information, contact the DataBase Training


Department at (203) 374-8000.
.items

.end
in which the report title (DataBase Training
Course Schedule) appears only on the first page and the column

produces a report

heading information
every page.

(cit^',

date, location) appears

at the

top of

important to understand the difference between the Report


Header Area (the area above the first formatting command), and the
Page Header Area in a report format. Information in the Report
Header Area prints once at the start of the/;/-.?? page of a report.
Information in the Page Header Area prints once at the start of each
page of a report. Note that if your report includes a Report Header
Area and a Page Header Area which is to print on the first page,
the Page Header prints before the Report Header.
It's

You cannot use more than


one .header command in a
format. The command
named .header 2 in this
example is t/ie only .header
command in the format. The
information that appears
only on the first page is the
Report Header (it is not part
of the .header command).

example above, in order to avoid printing the column


heading information before the report title, it is placed under the
report title in the Report Header Area (to be printed only on
In the

Page

and then is repeated in the Page Header Area, using the


.header 2 command in the report format (to be printed on every
1

page, starting on Page

Volume

2).

5-54

DATAHASE REFERENCE MANUAL


Custom Format
Page Level Formatting Commands

The
The

.footer [N]

.footer

(cont.)

Command

command

specifies information to be printed at the

bottom of each page in a report. The .footer command should be


placed at the beginning of the format, right after the .header

command. There can be only one


although none

is

placed

is

in the

command

in a

format,

the .footer

known

the bottom of each page in a


report. There can he only one
.footer

command in

a format.

command and

the next Formatting

Page Footer Area. Any information


Page Footer Area prints once at the bottom of each
as the

The most common use of a Page Footer is to place page


numbers, running totals, footnotes, etc.. at the bottom of each page

page.

of a multi-page report.
If

specifies

information to he printed at

required.

The area between

Command

.footer

The .footer command

you don't want Page Footer information

page, you can add the optional

to

appear

until a certain

The area hcnvecn

the .footer

command and the next


formatting command is
the

called

Page Footer Area.

Information in this area is


printed at the bottom of each
page.

parameter to the .footer


command, where N is a page number. For example, if you specify
.footer 3 in the format, the Page Footer information begins on page
3 and prints on every following page in the report.
Fields with

placed

summary

in the

statistics (for example: salary: sum) can be


Page Footer Area. Field statistics placed in the Page

Footer Area represent statistical information for all records


processed up to the end of the current page (unlike after the .end
command, where the statistical information takes into account every
record processed in the report).

5-55

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Custom Format
The

.call

Command

.call command is a Custom Formatting Command that lets you


and run another program at the end of a DataBase procedure.
DataBase swaps itself to either disk or expanded memory (EMS),
thereby freeing most conventional memory for the guest program.

The
call

.call command is inserted after the .end command. The .call


command should be the last line in the report format (it is executed
last, regardless of where in the format it appears). When the
DataBase procedure is completed. DataBase frees as much memory

The

as possible and immediately calls the specified program.

The

called

program must be

in the

in a different directory located in

same

your

directory as DataBase, or

DOS PATH. When

program ends, control automatically returns


menu from which the report was run.
called

The syntax of the

.call

command

is

to the

the

DataBase

shown below:

The

.call

command lets you

execute an external program

PROGRAM [/D] [%e] [%r]

.call

at the

end of a DataBase

report.

PROGRAM

is the name of the program to be executed


.BAT, .COM, or .BXB command for this program).

(the

DOS

The /D option generates


called

program

to store

a unique disk filename for use by the


any output it may generate.

%e option returns the output filename entered on the


DataBase Print Styles screen. This is the name of the
DataBase data file to be used by the called program.

The

The

%r option returns the DOS filename of the DataBase

procedure. This
the called

There

is

Volume

is

program

used to return control to DataBase when


is

an example of the

completed.
.call

command on

the next page.

5-56

DATABASE REFERENCE MANUAL


Custom Format
The

.call

Command

(cont.)

The following command


procedure and
the

list

records

named on
.call

it

to

calls DataBase GrafTalk at the end of a


draw a chart using the data generated by

command

in the

The data generated by

Report).
file

tells

the

query (or
the query

list
is

fields in the

Quick

stored in the output

DataBase Print Styles screen.

GrafTalk /D

%e %r

The /D parameter creates the unique filename of the GrafTalk chart


definition. The %e parameter passes the output filename specified
on the DataBase Print Styles screen. The %r parameter passes the
filename of the DataBase procedure.

NOTE: A

procedure containing a

.call

command cannot be

memory. You must first unload


the procedure using the Start New Procedure option
on the DQL menu (he sure to save the procedure
first). Then use Run Procedure and select the
run while loaded

in

appropriate procedure from the

5-57

list.

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Editing Formats
Editing Function

When you

Keys

custom format or modify any predefined format


created by DataEase, you follow the same basic procedures you use
create a

in defining

and modifying a DataEase database form. Function keys


summarized below:

The function keys can he used


to cut, copy,

and move

text in

a format just as they are used


in

Form

Definition.

are assigned editing functions as

Function Key

F2

Use

SAVE

Saves the format

F3CUT
F5

Removes

COPY

Copies

F6 PASTE
F7

in the

computer's memory.

fields or text for pasting or deletion.

Command menus.

fields and/or text.

Pastes cut or copied text onto the format.

DELLN

Deletes the line on which the cursor

F8 INSLN

rests.

Creates a blank line immediately above the


line

where the cursor

rests.

SH-F9 PRINT

Prints the procedure/report specification.

FIO FIELD

Adds

the specified field into the report format

where the cursor

NOTE: When

Editing functions are also


available from the Pull Down

editing a format, keep in

Formatting

Commands must

is

currently positioned.

mind

that all

begin with a period

column 1 at the left margin of the report format.


Although all Formatting Commands can be edited,
moved, and deleted like form text, you must be
in

when changing or repositioning commands


since they control when and where various output
careful

lines are created.

Volume

5-58

DATAEASE REFERENCE MANUAL


Editing Formats
Format Text

You can
The

any format text in the format.


page numbers, column header information,
and other format text can be changed without

edit, delete, or fully replace

report

boundary

titles,

lines,

Format

text can he freely


edited without affecting
report data.

affecting the report data output.

For example, if you're using the default Columnar format, you


might want to change the column headings selected by DataBase.
Simply cursor down to the text and type over them. Alternatively,
you can press F7 DELLN to delete the default Field Names. Then

INSLN to insert a new


own column headings.

press F8

your

blank line on which you can type

ASCII Extended Character Set


When you press ALT-FIO, DataBase gives you
Extended Character

set.

access to the

These characters can be used

ASCII

to create a

number of

special format effects, including single or double borders

around

or part of the report layout. Refer to

2,

all

Form

to use the special

5-59

Volume

2.

Chapter

and Relationships for more information on how


ASCII characters in form design and modification.

Definition

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Editing Formats

Adding and Modifying Fields

How To Add
You

or Modify Fields

can add or modify fields

in a

To

format just as you do on any

inside the field

you want

to modify),

insert afield in a format,

just place the cursor

form. Just place the cursor where you want to add the field (or

where

vow want the field to appear


and press FIO FIELD.

and press FIO FIELD.

you are adding a field, DataBase displays the Report Field


Definition screen and a menu that lists the names of all the output
If

fields specified in the report

query (see Figure 5-6). Select the

field

you want from the menu by highlighting it, then press RETURN.
The field (represented by a shaded rectangular area) is immediately
inserted at the cursor position in the format on the screen.

BOK^SSQ^

^aBSSS^MSHE
header

HasSOMESMSBMia^SSr
Mane ^^^^^^^^^^^^^^^^^^^^^^^^^^|
(for neu field, leave blank and press RETURN)

footer
itens

Field Type
end

Suppress Spaces

iitFiy^ Fsri^m F78Rim

r&iannnMBff; F7nraron

Figure 5-6

Report Field Definition Screen

you are modifying a field, when you position the cursor in the
and press FIO FIELD the current field definition is displayed
on the Report Field Definition screen. If the field you specify is a
Number field, DataBase asks which type it is. If you want to
change the number's appearance in the report, you can change the
type in the format (for example, from Floating Point to Fixed Point
or Integer). This change affects only the current report, not the
If

field

actual field definition.

Volume

5-60

DATAEASE REFERENCE MANUAL


Editing Formats
Adding and Modifying Fields

If

you want

add a

to

skip the

menu

window

inset in the

field tliat

(cont.)

you have not specified in the query,


RETURN. DataBase displays a

choices and press

Report Field Definition screen (see Figure 5-7).

If you want to add afield that


you have not specified in the

query, skip the menu choices,


press RETURN, and type the

name of the field or afield


derivation formula in the
window

that

DataBase

displays on the Report Field


Definition screen.

Suppress Spaces

Sgjgj Fhjp

Figure 5-7

qp

F7|q5pp[g
l^"tBFP|il

Report Field Formula

in

Window

Report Field Formula window, you can enter the name of a


from any form specified in the query, a current system

In the
field

variable (such as current date), or a Derivation

4000 characters

in length.

You cannot

use the

Formula up

all operator,

to

or any

sorting, grouping, or statistical operators (except relational


statistical operators) in the

Report Field formula.

You can

use

relational statistical operators in the formula.

When

the

entered

DQL Procedure

in this

items specified

window
in the

In certain cases, if

DataEa,se
field

may

Quick Report)

you misidentify

named SHIP TO

report field formula,

is

run, the fields


list

query.
a field in a report field formula,

nevertheless use the correct

value from the SHIP

5-61

(or

are included in the report output just like

is

field.

incorrectly called SHIP

For example,

TO ADDRESS

if

the

in a

DataEase may accept the formula and use the

TO

field.

Volume

DEFINE FORMAT/PRINT STYLE; DESIGNING REPORT OUTPUT


Editing Formats

Adding and Modifying Fields

(cont.)

Field Lengtlis and Field Types


The second question on the Report Field Definition screen is Field
Length. If you want, you can specify a length greater or less than
that of the field itself.

You might do

this to

avoid truncating an

output value or taking up unnecessary space in the report output.


Again, this change affects only the current report, not the actual

DataEase asks you

Number fields.
yes. the output

want

If you
is

answer

modified as

is no
on the Field Definitions.

requested, hut there


effect

field definition.

if you

suppress commas and


decimal points from list item
to

you specified more than one statistic for the field in the query,
DataEase also asks what statistical value should be output in this
position in the format. If you want the field value itself to appear,
specify item; if you want the total of the field values (such as for a
group total or grand total), specify sum, and so on.
If

Depending on

Type. DataEase asks one

the specified Field

additional questions

when you

to three

are creating or modifying a report

format.
If

Number

you specify a

field,

Suppress the commas?


Press

RETURN

commas

included in the output.

If

answer of no and include


you don't want commas

to accept the default

in the output.

which commas

DataEase asks:

Answer yes

You might

if

use this for an export format in

are used to separate fields.

you specify a non-integer

Number

Suppress the decimal point?

RETURN

field,

DataEase asks:

answer of no and include


the decimal point in the output. Answer yes if you don't want a
decimal point included in the output. You might use this for an
export format where the target program works with an assumed
Press

to accept the default

decimal point, or
(percentages,

Volume

if

the field value

is

normally not decimalized

etc.).

5-62

DATABASE REFERENCE MANUAL


Editing Formats
Adding and Modifying Fields

(cont.)

Suppressing Spaces
For any type of

field.

DataBase asks:

Suppress Spaces?
Press

RETURN

spaces

answer of no and include


you don't want the unused

to accept the default

in the output.

Answer yes

if

spaces from the field definition included in the output. This


you print related fields (such as first name and last name)
adjacent to each other without a
spaces.

If

you answer

yes, all

on the same

line

move

DataBase asks

number of empty intervening

unused spaces before the

character in the field and after the


fields

lets

last

first

character are deleted. Other

a corresponding

number of spaces

to

the left in the report output.

For example,

if

Answer

yes:

John

Answer

no:

the format has a

John

if you

want

to

suppress leading and trailing


spaces from list item fields. If
you answer yes. the spaces are
suppressed in the report only
(there is no effect on the Field
Definition).

hrst name and last name

field:

Adams

Adams

format has a line with just fields (no form text) and all fields
are set to Suppress Spaces, the line does not print if all the fields
If the

for

any record are blank. Instead, the line is moved to the end of
This feature can be very helpful if you are printing

the print area.

mailing labels with a variable number of lines (such as optional


lines for a person's title or a second address line). All lines are
printed together with no inappropriate blank lines, and the first line
printed on the next label (or preprinted form) is always printed in
the right place.

For other information on printing

labels, see the mailing labels


and the Print Style Specification
Example: Printing on Continuous Labels at the end of this chapter.

format earlier

5-63

in this chapter,

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Editing Formats
Saving a Format

After inserting or modifying each field in the format, press


F2 SAVE to include the field in the format. When you finish

all

make, press F2 SAVE to save


the modified format in memory. Then, select Option 7, Save
Procedure on the DQL menu. This saves the format on disk as

the additions or changes

you want

to

When you finish all the additions


or changes you want to make,
select Save Procedure to save
the modified format as part of
the procedure.

part of the procedure.

Volume

5-64

DATABASE REFERENCE MANUAL


Editing Formats
Printer Control

Commands

DataEase provides a number of special Printer Control commands


you can use to control highlighting and spacing for any part of the

When you
enclose

report.

precede
In addition to the

commands provided by DataEase, you can send

any control

you want

string

specif)' the

siring in the forma!,


it

it

in t>rackets

with an

control

you must

and

@ sign.

your printer. When you specify the


you must enclose it in brackets and
for example: @[1B4333]. However,
to

control string in the format,

precede

it

with an

@ sign,

DataEase does not check these strings for validity or check the
results in any way. Consult your printer manuals for information
on control strings accepted by your printer.

The
The

@ (At Sign) Command

@ command

italics,

you highlight report information

lets

or any special feature your printer supports.

placed anywhere

in a

in boldface,

The

@ can be

format except on a line containing a

Command. The
character must be immediately
followed by a special character or character group representing the
Formatting

printer function

The

you want

@ Formatting Command and

Entry form

is

highlight
report information in boldface,
italics, or any special feature
your printer supports.

following characters do not

its

do not advance

@ commands are ignored when the report

rather than to a printer

@ sign Printer Control

Command lets you

to use.

take up space in your output; they

The

The

(i.e.,

not displayed

text that
in

appears

in

is

the print head.


sent to the screen

color on the Record

color in the record entry report

format).

However, the corresponding

example,

if

print

text is highlighted with the

command

@u command

is

used.

For

during

Record Entry, when the record entry format is used, that text will
be underlined. See the section on Field Highlighting in Volume 2,
Chapter 2, Form Definition, for more information. If the report is
depends on the printer defined on the Print
is designated on the Print Style screen, the
printer control codes generated by the
commands are written in
the disk file as printer codes. If there is no printer designated on
sent to disk, the output

Style screen. If a printer

the Print Style screen, the

NOTE: If you

@ commands are ignored.

want an

output, enter

at sign (@) to appear in a report


two consecutive at signs (@@) in the

format.

5-65

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Editing Formats
Special Effects (Highlighting)

your printer definition includes special effects options, you can


access them in the report by specifying the
sign and any
one of the following commands in the format. For complete
If

information on defining printers, see


Administration.

Command

Volume

2,

Chapter

4,

System

DATAEASE REFERENCE MANUAL


Editing Formats
Characters per Inch (CPI)

If your printer definition includes multiple CPI options,


you can
access them during the report by specifying the
sign and any
one of the following commands in the format:

Command

The CPI (Charaeters per Inch)

Commands

control the
character width in a report.

Print Effect

cl

First

CPI (Character Per Inch)

setting in

printer definition.

c2

Second CPI

c3

Third CPI setting

c4

Fourth CPI setting

For example,

CPI and

if

is

command

@c3This

in printer definition.

in printer definition.

your printer definition supports

the default

following

setting in printer definition.

text will

10 (the

first

in the report

specified),

if

10, 12, 16 and 4


you enter the

format:

be sixteen characters per inch.@c1

The @ci command causes the printer to switch to 16 CPI.


The (cl command returns it to the default 10 characters per
See Volume

2,

Chapter

4,

inch.

System Administration, for more

information on printer definitions.

5-67

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Editing Formats
Lines per Inch (LPI)

your printer definition includes multiple LPI options, you can


access them during the report by specifying the
sign and any
one of the following commands in the format:
If

Command

Print Effect

11

First

LPI (Line Per Inch)

The LPI (Lines per Inch)

Commands
interline

control the

spacing

in

a report.

setting in printer

definition.

12

Second LPI

13

Third LPI setting

14

Fourth LPI setting

setting in printer definition.

in printer definition.

in printer definition.

For example, if your printer definition supports 6, 8, 12, and 16


LPI, and your default is 6 LPI, if you enter the following command
in the format:

@l4This text would appear in the smallest available LPI, in this


case 16 LPI (since there are more than 6 lines per inch, the
text is more compressed). This is considered compressed
format. @I1

The @14 command causes the printer to switch to 16 LPI.


The @11 command returns it to the default 6 lines per inch.
See Volume

2,

Chapter

4.

System Administration, for more

information on printer definitions.

Volume

5-68

DATAEASE REFERENCE MANU

A L

Editing Formats

Page Size

Page Size
DataBase creates and transmits printer control
use of the special

strings based

@ report formatting commands.

on your
However, it

does not adjust page breaks to take into account the spacing
changes made by
formatting commands.

DataBase inserts page breaks


based on the margin and page
length information you enter
on the Print Style
Specification screen.

DataBase provides automatic page breaks based only on the


page
size, margins, and lines per inch specified
on the Print Style
Specification screen. Therefore, if in the middle of a page,
you
change to a type style using fewer lines per inch, the page
may fill
before DataBase provides the automatic page break. If
you change
to a type style with

more

lines per inch,

the bottom of a page.

Similar problems

automatic line wrap

you change type

if

empty space may be

may occur
sizes in the

in

left at

providing

middle of a

line.

You can compensate

for these formatting adjustments by specifying


and margins on the Print Style Specification
screen. For example, when using more compressed
LPI (lines per
inch), specify a shorter page length; with less
compressed LPI,
specify a longer page length.

different page sizes

5-69

Volume

DEFINE FORMAT/ PRINT STYLE: DESIGNING REPORT OUTPUT


Define Print Style
The

The

Print Style Specification

Print Style Specification screen

is

a special

DataBase System

used to specify the destination, margins, spacing, type

form

that is

size,

and other physical characteristics for report output.

The Print Srsle Specification


defines die destination

and

dimensions of the report


output. It can he used to

select Option 6, Define Print Style on the DQL menu,


DataBase displays the Print Style Specification screen (shown
below). The values you enter in the fields on this screen define the
report destination and the physical appearance of the report output.

When you

temporarily override the


settings stored in the Printer

Definition record.

For more

information see "Define


Printers." in

Chapter

4.

Volume

2.

System

Administration.
1:

Screen

Printer

DiEk
PRINT STVLE SPECIFICflTION
flllou Style nodif ication at run-tine
Report Destination: ^^^^|
If disk Output, Filenane:
Z:

J:

Nou press DEFAULT UIEU to get default ualues for the renaining fields.
Printer Nane
Pause after each page 7
IF PRINTER NAME IS

SPECIFIED flBOUE

-HeaderPAGE SIZE AND P OSITION ON


Uidth
Length

^m

Text

^H
^^M
^^|

TVPE STYLE
Characters Per Inch
Highlights 1

-Footer-

Fscjaii fz^w^ Fni^ii/Jinamjiii rsfjiiaagiiaari FftHippiBaiiiRni

Figure 5-8

NOTE: If you
output

Volume

inches)

Starting position

MARGINS (in inches): SEE F IGURE ON LEFT


l.Left
Z. Right
4. Header to Text
3. Top to Header
S. Footer to Botton
b.Text to Footer

ftrea

F4'aaiBiaiR]

C flRRIflGE (in

HHJ

Print Style Specification Screen

do not specif- a Print Style Specification, the


is sent to the screen by default.

5-70

DATABASE REFERENCE MANUAL


Define Print Style
Defining the Report Destination

The

first choice on the Print Style Specification screen lets you


choose the report's destination. You can send a report to either the
Screen, a Printer, or a Disk File. The default destination is Screen.

Each destination

is

report can either he sent to


the screen, sent to a printer, or
it

can he saved as a disk pie.

defined as follows:

Screen: displays the report on the computer's monitor.


Printer: sends the report to a printer device to generate hard

copy output.

Disk: creates a disk


printed

at

file for storage. The disk file may be


a later time or used as input by another program.

Each report destination

5-7!

is

described in detail in the following pages.

Volume

DEFINE FORMAT /PRINT STYLE: DESIGNING REPORT OUTPUT


Define Print Style
Report Destination: Screen

you select Screen as the report destination, you don't have to


answer any other questions on the Print Style screen. Just press

If you select the

If

F2

SAVE

When
is

questions to answer.
SAVE to save the

to save the destination.

Press F2

always pauses after each page


displayed. You must tap the Spacebar to continue running the
a report

is

Screen
no

destination, there are

sent to the screen,

destination.

it

report.

Screen Report Scrolling


When a report is sent to the screen,

the following keys are used to

through the report.

scroll

To

Key

Scrolls

PgDn
PgUp

Next Screen
Previous Screen
Start of the Report
Next Screen if you haven't viewed the

HOME
END

Report yet

OR

Highest Numbered Page that you

have viewed so

CTRL^
CTRL^

Half Screen (40 columns) to the Left


Full Screen (80 columns) to the Right

->
<-

Full Screen (80 columns) to the Left

Reports with

Two

If a report is usually

need

far

Half Screen (40 columns) to the Right

be printed,

to

Destinations

displayed on the screen but

fill

then go back to the destination and change


pressing F2

SAVE.

modification

at

If

may

occasionally

in the fields as if the report is to

you also

run-time,

when

change the report destination

tell

it

DataEase

the report

is

be printed,

to Screen before
to allow style

run you only have to

to print the report.

If a report is usually printed, but

may

occasionally need to be

exported, don't specify any printer values (they cause problems for
the target program).
report

VIEW

is

Instead, choose the Disk destination.

to generate the printer

Volume

name and press F3


control commands.

run, specify the printer

When

the

DEFAULT

5-72

DATABASE REFERENCE MANUAL


Define Print Style
Report Destination: Disk

you select Disk as the report destination you must also tell
DataEase the name of the file and the directory where you want
If

store the reoort

to

lf\ou select the Disk


destination, you must specify
''"" storage location for the
output file.

Enter this information

If

in the field

following the prompt:

disk Output, Filename:

DataEase accepts either a pathname or a disk drive

letter.

For

example, either

C:\WP\ADDRESS.DTA
or

A:PRINTOUT.DOC
is

acceptable.

NOTE: If you

specify a Disk destination

Printer

Name,

and include a

the printer control codes for that

printer are included in the output file

assumes the report

will eventually

DataEase

he printed rather

than processed by another program. If you are

planning

to

process the report rather than print

it,

you should leave the printer fields blank.

5-73

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Define Print Style
Report Destination: Printer

If

you

select Printer as the report destination,

several questions about your printer and the

you must answer

way you want

Ifvou select the Printer


destination. \ou must specify

the

Name and the

output printed. The following pages discuss the various printer

the Printer

questions in detail (after the page on Print Style Modification).

dimensions of the output.

First,

you must specify the name of the

printer that

you want to

use.

All printers attached to the system are defined in the Define

Printers option of System Administration.


printer

name and
4,

display the default

System

DEFAULT VIEW.

See Volume 2.
System Administration, for more information on printer

Configuration form, press F3

Chapter

To

specifications as entered on the

definitions.

When prompted
response

When

is

the report

on

specified

the

Alternatively,

Local

2,

for the

name of

is

most flexible
symbol in this field.

the printer, the

to place an asterisk (*) wild card


run, the output

is

sent to the default printer

System Administration form.

you can specify the

Network

1 or

Network

printer

number (Local

2) as listed

1,

on the System

Configuration form.

When

the report

is

run,

DataBase uses the appropriate printer

control codes for the specified printer in addition to the information


in the Print Style Specification

Volume

when

it

generates the report output.

5-74

DATABASE REFERENCE MANUAL


Define Print Style
Print Style Modification

The prompt on

the Print Style Specification screen that follows

your procedure/report destination choice reads:

You can set up a report so the


Print Style can he modified
each time the report is run.

Allow style modification at run-time?

you answer yes, DataEase displays the Print Style screen each
time you run the procedure, so you can modify the current
If

If you modify the Print Style without saving the


procedure afterward, the changes are not saved on disk. If you
save the procedure after making modifications, the modified Print
Style specification is saved, replacing the previous one.

specifications.

If you answered yes to this question, but you now want to run the
procedure without changing the Print Style, just press F2 SAVE

when

the Print Style Specification screen

will then run the

is

displayed.

DataEase

unmodified procedure.

you answer no to the run-time style modification question,


DataEase does )\ot display the Print Style screen. It immediately
If

runs the report using the

last

saved Print Style choices.

After running a procedure, you can recall the last used Print Style
Specification immediately by pressing F5 DEFAULT FORM. If

you only want to view certain fields, you can recall each field
individually by moving the cursor into the field and pressing
F6 DEFAULT FIELD. However, once you exit the procedure or
load a new procedure, you can only access the Print Style
Specification that was saved with the procedure.

5-75

Volume

DEFINE FORMAT/PRINT STYLE; DESIGNING REPORT OUTPUT


Define Print Style
Completing the Print Style Specification: Page Size

After choosing the report destination, press F3


the report

DEFAULT VIEW

being sent to a printer or being sent to

is

printer codes (to be printed later).

disi<.

if

with

DataEase displays the default

answers to the remaining questions. You can change any of these


default responses as explained below:

The next prompt


Pause

after

asks:

each page?

Answer yes

if you're printing on hand-fed single sheet paper or


DataEase will pause after each page and let you change
the paper. Press any key to continue printing.

envelopes.

Answer no
The next

if

you're printing on continuous feed/form paper.

you change the default

part of the Print Style screen lets

values for Page Length, Page Width, and/or Starting Position.

Enter the Page Length and Page


are different

from the

Width

values in inches

if

they

defaults.

The Starting Position field should be left blank unless your


printer's form feed mechanism won't let you align the left edge of
the paper with the left edge of the platen.
the distance

NOTE: These

values affect printed reports

to disk; tfiey

Volume

If this is the case,

between the paper edge and the platen edge

Imve no

ejfect

and reports

specify

in inches.

sent

on a screen report.

5-76

DATAEASE REFERENCE MANUAL


Define Print Style
Completing the

The

Print Style Specification:

left, right, top,

Margins

bottom, header and fooler margins are specified

on the Print Style screen. All margin values


should be specified in inches. The margins are defined as follows:
in the next six fields

The distance between

Left:

and Xhe first column of

2.

The margin values can he


modified by simply typing in
replacement values. Margin
values are specified in inches.

the left edge of the paper

text.

Right: The distance between the last column of text

and the right edge of the paper.

3.

Top

to

Header: The distance between

the paper

and

header, this margin

.header

line

\\\q first

ignored.

command

is

the top edge of

of the header.

You must

If there is

format to create a margin

in the

no

include a
at

the top of the page.

4.

Header

to Text:

the header

header, this field

5.

The distance between

and \ht first


is

line of text.

the last line of

no

If there is

ignored.

Footer to Bottom: The distance between the

last line

of the footer and the bottom edge of the paper.


is

no

footer, this

a .footer
the

6.

margin

command

is

in the

ignored.

You must

format to create a margin

at

bottom of the page.

Text to Footer: The distance between the


text

If there

include

and

Xhs.

of the footer.

first line

last line

If there is

no

of

footer,

this field is ignored.

NOTE: The Margin fields

are

left

indicating a value of 0.
the Print Style Screen
affects

5-11

is

blank as a default

The chart at the left side of


a guide showing which field

which margin area.

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Define Print Style
Completing the Print Style Specification: Type Style

on the Print Style screen let you specify the type


style used for the report as a whole. You can override these
(At Sign) Printer
settings for portions of the report by inserting

The

last five fields

Control

commands

in the

format.

The

five type style choices are

defined as follows:

1.

If

lets

you specify the


and

rype size, line spacing,

other printer features for the


wiwle report as well as for
emphasis in specific areas of
the report.

Characters per Inch: For normal printing


be 10.

DataBase

this

value should

your printer supports variable CPI, specify a higher

value for condensed printing or a lower value for expanded


printing.

The value

specified must be included on the Printer

Definition form.

2.

Lines per Inch: For normal printing


If

this value

should be

6.

your printer supports variable LPI, specify a higher value

for

condensed printing or a lower value for expanded


The value specified must be included on the Printer

printing.

Definition form.

3.

Highlights:

You can

specify up to 12 special user-defined

highlights supported by your printer.

The

highlights

specified must be stored in the Printer Definition form as

Special Effects.

The

entire report

is

by your choices. The menu choices

1:

2;

highlighted as specified
are:

Bold
Underline

3: Italicize
4:
5:

Special 1
Special 2

12: Special 9

For more information on printer definitions, see Volume


4, System Administration.

Volume

2,

Chapter

5-78

DATABASE REFERENCE MANUAL


Define Print Style
Saving/Modifying

Saving the Print Style Specification


When you
F2
all

finish filling in the Print Style Specification form, press

SAVE to save your specifications. DataEase checks to be sure


required fields are filled and saves the specification form. If one
more required

or

fields are blank,

Print specification

Do you want
If

to

is

DataEase prompts:

incomplete

complete the specification

you answer yes and you also answered yes

Modification

at

When you finish filling in the


Print Style Specification, press
F2 SAVE

to save it in the
computer's memory. To
permanently save the Print
Style on disk, select Option 7.
Save Procedure, on the DQL

at run-time?

to the Print Style

run-time question, the incomplete specification

is

accepted and DataEase returns to the DQL menu. If the


specification is incomplete and you answered no to the run-time
modification question, DataEase prompts:

Data

The

required

Print Style Specification

cursor

F2

in this field is

in the first

SAVE

incomplete

form remains on the screen with the


field. Complete the form and press

again.

Modifying the Print Style Specification


If

you answered yes

to the question:

Allow style modification at run time


the Print Style Specification form appears on the screen

you run the

report.

You can

before running the report.

F2

SAVE

When you

finish

making changes, press

to run the report with these changes.

You can change your answer


selecting

whenever

then change any fields you want

to the style modification question

Modify Print Style from the

DQL menu

by
and overwriting

your previous response.

5-79

Volume

DEFINE FORMAT /PRINT STYLE: DESIGNING REPORT OUTPUT


Define Print Style
Examples

Screen Destination: To send the report output


Printer Name and related fields blank.

P RINT

to the screen, leave

ST YLE SPECIFICftTION
Allou Style Modification at run-tine

^^^^^

Report Destination:
If disk Output.

Filename!

Nou press DEFAULT UIEU to get default


Printer Nane
Pause after each page ?
IF

-.v

alues for the

r enaining

PRINTER NAME IS SPECIFIED ABOUE

fields.

HeaderPAGE SIZE AND POSITION ON C ARRIAGE < in inches)


Length ^^^| Uidth |^^| Starting position |

MARGINS (in inches):


l.Left
3. Top to Header
5. Footer to BottoM

Text

Area

SEE F IGURE ON LEFT


Z. Right
4, Header to Text
6. Text to Footer

^^M
^^H
^^H

TYPE STYLE
Characters Per Inch
Highlights 1

-FooterS

Screen Preview: To preview a printed report on screen, specify the


Printer destination. After

all

change the report destination


formatted as

it

will

related questions are answered,


to Screen.

The screen output

appear when printed on

is

the specified printer

(within the limitations of the screen).

P RINT ST YLE

Report Destination:
If disk Output.

^^^^Q

SPECIFICATION
Allou Style Modification at run-tine

Filenane:

Nou press DEFAULT UIEU to get default u alues for the r enaining fields.
Printer Nane
Pause after each page 7
3

IF PRINTER NAME

IS

SPECIFIED ABOUE

-Header4

Text

Area

-Footer5

Volume

PAGE SIZE AND P OSITION ON C ARRIAGE (in inches)


Length Q|]^H Uidth |^^| Starting position |

MARGINS (in inches): SEE FIGURE ON LEFT


Z. Right
l.Left
4. Header to Text
3. Top to Header
6. Text to Footer
5. Footer to BottOM
TYPE STYLE
Characters Per Inch
Highlights 1

5-80

DATABASE REFERENCE MANUAL


Define Print Style
Examples

To print on continuous roil


Leave Margins fields blank.

Printer Destination:

Page Length

as 0.

labels, specify

P RINT ST YLE SPECIFICATION


Report Destination: j^^Q^D
flUou Style nodification at run-tine
If disk Output. Filenane:

Nou press DEFAULT U EU to get default


Printer Nane
Pause after each page ?

v alues

IF PRINTER NAME

for the

r enaining

IS SPECIFIED ABOUE

fields.

HeaderPAGE SIZE AND P OSITION ON C ARRIAGE


in inches)
Length S^^| Uidth ^^^B Starting position |

<

Text

MARGINS in inches): SEE F IGURE ON LEFT


l.Left
Z. Right
3. Top to Header
4. Header to Text
B. Footer to BottoM
b. Text to Footer
<

Area

^^m
^^H
^^^

TYPE STYLE
Characters Per Inch
Highlights 1

-Footer
5

Fsraam r^^wa F^iiiamnKMinsii

Printer Destination:

To

^ Fhiaiawwa^^

Fsmagf

on individually inserted pages,


Pause question.
each page to let you insert the next sheet or
print

specify the complete print style and answer yes to

DataEase stops

after

envelope.

P RINT

Report Destination;
If disk Output.

ST YLE SPECIFICATION
Allou Style Modification at run-tine

|2QQ
Filenane:

Nou press DEFAULT UIEU to get default u alues for the


Printer Nane
Pause after each page ?
3

IF

r enaining

PRINTER NAME IS SPECIFIED ABOUE

fields.

Headei
4

Text
Area

5 -XI

PAGE SIZE AND P OSITION ON C ARRIAGE (in inches)


Length E|B| Uidth |^^B Starting position |

MARGINS (in inches):


l.Left
3. Top to Header
5. Footer to Botton

SEE F IGURE ON LEFT


Z. Right

HJH
^^H
^^H

4.
6.

Header to Text
Text to Footer

Volume

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Define Print Style
Examples

Disk Destination: To export the repon output to another program,


specify the filename including a pathname if appropriate. Be sure
that Printer Name and related fields are blank.

P RINT

Report Destination;
If disk Outp

ST YLE SPECIFICATION
Allou Style Modification at run-tine

[^Q^^|

CSCUSTOMERS
Nou press DFFrtlH.T UIEU to get default
Pniitfr Nane
Pause after each page 7

^^

alues for the

IF PRINTER NAME

r et-ta

ining fields.

SPECIFIED ABOUE

IS

PAGE SIZE AND POSITION ON CARRIAGE (in inches)


Length ^^^| Uidth ^|^B Starting position |
Text

Area
&

Footer

MARGINS in inches): SEE F IGURE ON LEFT


Z. Right
1. Left
4. Header to Text
3. Top to Header
5. Footer to Botton
^^^| t.Text to Footer
(

^^H
^^H

TYPE STYLE
Characters Per
Highlights 1

nch

ni.u/J*lldi

Disk Destination: To save

the report

on disk for

later printing,

specify the report Printer destination. After answering

all

related

questions, change the report destination to Disk and enter the

filename and target drive

be printed

later

using the

letter.

The

resulting disk file output can

DOS COPY command.

This output

cannot be printed on individually inserted sheets.

PRINT STVLE SPEC F CftTION


rtllou Style Modification at run-tiMe
Report Destination: [^Q^^|
If disk Ou tput. FilenaMB:
I

Nou press DEFAULT I'lEU to get default ualues for the renaining fields.
U:Kml>\UZStmm
Printer Nane
Pause after each page ?
3

IF

PRINTER NAME IS SPECIFIED ABOUE

-Headei
4

Teyt

Area

8
-Footer
5

in inches!
PAGE SIZE AND P OSITION ON C ARRIAGE
Length 3^^| Uidth ^^^| Starting position |
C

MARGINS in inches): SEE


l.Left
3. Top to Header
S. Footer to Botton
I

^^H
^^H
^^|

IGURE ON LEFT
Z. Right
4.
6.

Header to Text
Text to Footer

TVPE STVLE
Characters Per Inch
Highlights 1

u^mssasEiim

Volume

5-82

DATABASE REFERENCE MANUAL

Chapter 6
DQL Lexicon
INTRODUCTION
DQL

In this Lexicon, each entry

complete list of all the DataBase Query


Language concepts, terms, and symbols presented in alphabetical
order. Each query language term is identified and explained in the
he

Lexicon

is

lexicon in the following format:

Keyword: The
Type:

term or symbol as

it

appears

DQL

Identifies the type of the term.


five

in the

DQL.

begins on a separate page.


However, some entries
continue for two or more
pages. If an entry Joes not
require one of the format
sections defined on this page,
that section is omitted from
the explanation.

terms are divided into

main groups: commands, functions, keywords, operators,

and symbols. Each of these groups contains several


subordinate types.

Purpose: An overview
Syntax:

that explains the general

purpose of the term.

generic query statement that demonstrates the proper format

in

which the term

syntax format

is

itself,

used

in a

query. For an explanation of the

see Typographical Conventions on the

next page.

Returns:

Specifies the type of value that

is

returned by a function or

operator.

Usage:

Additional details concerning the use of the term

in

general

and special purpose contexts.

LAN:

Special considerations or restrictions that govern the use of

when running DataBase on

the term

LAN

(Local Area

Network).

Example: One

or

more examples

that

demonstrate the use of the term

a query statement or a complete query.

query

is

in

complete

presented, an explanation of the query and an

example of

See Also: A

When

the report output

is

generally included.

cross reference of related terms, including

same type and other important temis used

all

in the

terms of the
preceding

example.

6-1

Volume

DQL

LEXICON

DQL LEXICON TYPOGRAPHICAL CONVENTIONS


Except as noted below, the typographical conventions used in this lexicon
are the same as those used in the previous chapters. These conventions
are explained in Chapter 1. Introduction to DQL Advanced Processing.

Syntax Diagrams
In the syntax diagrams, items enclosed in brackets

included in the statement.

If

may

or

may

not be

they are included, the quotation marks and

When items are separated by a


be used. For example, in the syntax statement:

parentheses must appear where shown.


vertical bar

I,

either

may

FORMNAME RELATIONSHIP [named "UNIQUE


RELATIONSHIP NAME"] [with (selection criteria)] FIELDNAME

any

you can use either a

FORMNAME or a RELATIONSHIP in

the query
can be included or
not. If selection criteria are included in the statement, the criteria must be
enclosed in parentheses. A FIELDNAME rtntst be included at the end of
the statement followed by a semicolon.

A "UNIQUE RELATIONSHIP NAME"

statement.

shown in lower case (any, named, and


The words shown in upper case (FORMNAME,

In the syntax diagrams, the terms

DQL

with) are

terms.

RELATIONSHIP, UNIQUE RELATIONSHIP NAME, and

FIELDNAME)

are generic terms. In an actual query you replace such


terms with specific data by typing in the actual database names or
selecting the appropriate items from the Interactive menus.

Margin Notes
The notes

printed in the margins contain cross references, syntax

restrictions,

and other important information. Unlike the

DataBase Reference Manual,

may

facts given in the lexicon

rest

of the

margin notes

not appear elsewhere on the same page.

Typesize
The

typesize used in the lexicon

is

slightly smaller than the size used in

the previous chapters.

Database Forms Used


Most of

the

INVOICES

Volume

in

the Examples

examples in the lexicon are based on the CUSTOMERS and


forms shown in Figure 3-1 at the start of Chapter 3.

6-2

DATAEASE REFERENCE MANUAL


Symbols
Symbols

are tools that clarify a query's meaning, perform basic

operations, and help retrieve data

you want

query

to retrieve.

Form

when you

The symbols

listed

Definition derivation formulas as well as


operations.

There are four groups of

DQL

math

can't recall the exact values

below can be used

DQL

in

Advanced Processing

symbols as specified below:

Punctuation Symbols

Punctuation Symbols

(semicolon)

(colon)
(period)

Punctuation symbols are used to clarify, separate, and conclude various


operations specified in a query. The double dash symbol precedes
comments used to annotate a query.

(parentheses)

"

(quotation marks)

"

--

(dash)

Math Symbols
Math Symbols
Math symbols

are used to perform arithmetic operations on numeric

values.

+ (plus)
-

Wildcard Symbols
Wildcard symbols are used to specify unknown characters

(minus)

(multiplication)

(division)

in selection

criteria text values.

Wildcard Symbols

Comparison Symbols
Comparison Symbols are used to compare one value to another. The
Assignment Operator symbol is used to assign a value to a field or

(asterisk)

(question mark)

(tilde)

variable.

For a full explanation of any of the DQL symbols, see the entry in the
Lexicon. The symbols are presented first, beginning on the next page.

Comparison Symbols
< (less than)

<=

(less than

or equal to)

(equals)

> (greater than)

>= (greater than


or equal to)
:=

Assignment
Operator

6-3

Volume

DQL LEXICON

DATAtASE REFERENCE MANUAL


Symbols

(cont.)

See Also: +,

Keyword:

/(division)

Type:

Arithmetic Symbol

Purpose: The
The
Syntax:
Returns:

symbol

Example:

to divide

Value

by Value

2.

result is the quotient of the division.

VALUE

DataBase

tells

VALUE

numeric value.

When

monthly rent

:=

annual rent

typing fractions like


DataBase requires
that you type a space t>efore

10

12

12,

and after

the

division

svmhol.

Q
Keyword:

* (multiplication)

Type:

Arithmetic Symbol

Purpose: The

Value

Syntax:
Returns:

Example:

6-5

symbol
2.

value

The
*

tells

DataEa.se to multiply Value

result

value

is

by

See Also: +,

-, /

the product of the multiplication.

numeric value.

wages

:=

hourly wage

total hours worked

Volume

DQL LEXICON
Symbols

(cont.)

Q
Keyword:

* (wildcard)

Type:

Wildcard (Character Pattern) Symbol

Purpose: The
for

* asterisk wildcard character

can be used to substitute

any number of unspecified characters

string.

It

can be used up to twice

unspecified

number of

characters

The symbol can be used

in

an alphanumeric

in a string to

show

may have been

that an

omitted.

any logical comparison or record

in

selection context.

Example

for

CUSTOMERS

with last

records
LAST NAME in order

name =

"

*son"

list

end
This query tells DataBase: List the records for customers whose last name
ends with the letters son. The report output for this query, arranged in
alphabetical order by LAST name, might look as follows:

LAST NAME
Anderson
Bateson
Davidson
Hanson
Robertson

Example

2: for

CUSTOMERS

with last

records
last name in order

name =

"'s?n"

list

end
DataBase: List the customers whose last name ends with
and /;. with an unknown value between them. The report
output for this query might look as follows:

This query

tells

the letters s

Andersen
Anderson
Bateson
Davidson

Hansen
Hanson
Robertson

Volume

6-6

DATAEASE REFERENCE MANUAL


Symbols

(cont.)

See Also:

Keyword:

? (wildcarci)

Type:

Wildcard (Single Character) Symbol

Purpose: The

? wild card character

unspecified character

in

is

used

to substitute for exactly

an alphanumeric

however, be used repeatedly

string.

It

one

can,

in a field to specify the exact

number of characters that have been omitted. The symbol can


be used

Example

1: for

in

any logical comparison or record selection context.

CUSTOMERS

with last

records
LAST NAME in order
FIRST NAME

name

= "Anders?n"

list

end
DataBase: List the records for customers named Andersen
lists customers named Andersan. Andersin. or
Andersitn, if any exist). The output for this query, arranged in
alphabetical orcler by LAST NAME, might look as follows:
This query
or

tells

Anderson

(it

LAST NAME

also

*,

DQL LEXICON
Symbols

(cont.)

See Also:

Keyword:

- (tilde)

Type:

Wildcard (Sound Pattern) Symbol

Purpose: The ^ wildcard

character

used to find data that "sounds


The ~ symbol can be used before

is

like" a specified text string.

any number of characters or words;


that

have a similar sound

comparisons with the


pattern:

^.

it

locates

all

the records

to the specified string. In

making

DataEase matches the consonant

vowels and spaces between words are ignored.

Consonants with similar sounds (such as f and ph) are treated


as the same character. The ~ symbol can be used in any
logical

used

comparison or record selection context and may be

in a text string after

See Volume

Example:

for

1.

Chapter

CUSTOMERS
list

another wildcard symbol (* or

2.

Record Entry,

with LAST

NAME =

for

?).

more information.

-Foster"

records

LAST NAME
FIRST

NAME

in

order

end
This quer\- tells DataEase: List the records for customers whose
sounds like Foster. The report output for this query, arranged in
alphabetical order by LAST NAME, might look as follows:

LAST NAME

last

name

*.

DATABASE REFERENCE MANUAL


Symbols

(cont.)

Keyword:

Type:

Punctuation Symbol

See Also: item, sum, mean,


max, min, std.dev., std.err.,
variance {Statistical
Operators) and item, count,
percent (Conditional

(colon)

Purpose: A colon

is

statistical

inserted

operators

between a field name and one or more


when you want to include statistics in the

report output.

Syntax:

VALUE

Example:

for

statistical

operators

CUSTOMERS
list

records

LAST NAME in order


ACCOUNT BALANCE

item

sum

end
This query tells DataBase: List the CUSTOMERS records showing each
customer's LAST NAME, ACCOUNT BALANCE, and the total of all the
ACCOUNT BALANCE values at the end of the report. The report output for
this query, artanged in alphabetical order by LAST NAME, might look as
follows:

LAST NAME

Adams

ACCOUNT BALANCE

Statistical Operators).

DQL LEXICON
Symbols

(cont.)

a
Keyword:

Type:

Punctuation Symbol

...

(parentheses)

Purpose: Parentheses

are used as separators in selection criteria

and

function arguments and to clarify the sequence of mathematic


operations.

The use of parentheses

is

especially important

when combining selection criteria using the and and or


operators or when clarifying the order of evaluation of
otherwise ambiguous expressions and operations.

Example:

for

CUSTOMERS

with ACCOUNT BALANCE


or STATE = "NJ")

500 and (state = "NY"

records
LAST NAME in order
list

ACCOUNT BALANCE
STATE
end
With

the parentheses as

customers from either

shown,

this

New York

or

query

New

tells

DataBase

Jersey whose

to

list all

ACCOUNT

BALANCE is greater than 500. The report output from this query,
arranged alphabetically by LAST NAME, might look as follows:

LAST NAME

Adams

ACCOUNT BALANCE

STATE

the

DATABASE REFERENCE MANUAL


Symbols

(cont.)

D
Keyword:
Type:

See Also:

(period)

(semicolon)

Punctuation Symbol

Purpose: A

period marks the end of an action that

may

or

may

not be

followed by other actions.


In a query,

Any

1.

Any

2.

3.

you must

DQL

insert a period after:

Control

command.

In a

assign, break, deflne. or exit Procedural

and

after

The

last

each action
item

in

in a

case,

if,

or while

for

CUSTOMERS

command

command.

records, modify records,

list

delete records, or enter a record Processing

Example:

command.

records
LAST NAME in order
list

ACCOUNT BALANCE
STATE
end
This query

tells

DataBase: List each customer's LAST NAME, ACCOUNT


output, arranged in alphabetical order by

BALANCE, and STATE. The report


LAST NAME, might look like this:

LAST NAME

Low Level query,

a period marks the end of the


procedure. In Hii;h Level,
multiple actions are permitted.

DQL LEXICON
Symbols

(cont.)

0]
See Also:

Keyword:

Type:

Punctuation Symbol

Purpose:

semicolon

is

The semicolon

used to separate items


is

always used

in a

after a for

query action.

command

that

specifies the query's Primary form; after ad-hoc selection

each output item except the

criteria are specified;

and

last in a list records,

modify records, or enter a record

after

command.
Syntax:

FIELDNAME CONSTANT VALUE

Example:

for

CUSTOMERS

with

records
LAST NAME in Order

ACCOUNT BALANCE > 500

list

ACCOUNT BALANCE
STATE
end

This query tells DataEase: For customers whose ACCOUNT BALANCE is


greater than 500. list each customer's LAST name, ACCOUNT BALANCE,
and STATE. The report output, arranged in alphabetical order by LAST

NAME, might look

LAST NAME

Adams

(period)

(semicolon)

as follows;

ACCOUNT BALANCE

STATE

The semicolon is used after a


for command that specifies the
query' s Primary form; it is not
used when the for command
specifies a form other than the
Primary form.

Symbols

.A

.Ji

S E

REFERENCE

Type:

Punctuation Symbol

(quotation marks)

Purpose: Quotation marks

are always used to enclose a text constant.

Quotes are also used

command and

define

when

IS first

It

to
to

enclose the

name of

a variable in a

enclose an optional relationship

specified in a query by the

"TEXT

CONSTANT

define

temp "VARIABLE NAME"

named

of CUSTOMERS named "HIGH VOLUME"


ACCOUNT BALANCE > 500

with

for

CUSTOMERS
list

with state

"NY"

records;

LAST NAME in Order


ACCOUNT BALANCE

STATE

name

operator.

'

sum

end
This query tells DataEase: For customers who live in New York,
list each customer's last n,ame. accolnt b.al.ance, and state.
The report output, arranged in alphabetical order by LAST NA.ME,
miaht look as follows:

LAST NAME

.A

\ t AL

Sec Also: define,

"..."

Example:

(cont.)

Keyword:

Syntax:

.'^

named

DQL LEXICON
Symbols

S
Keyword:

:=

Type:

Operator Symbol

Purpose: The assignment

operator symbol

of a variable or field

fieldname

Syntax:

address

:=

is

is

used whenever the

alue

assigned or modified.

assigned value

VARIABLE NAME

Example

See Also, assign

(Assignment Operator)

:=

ASSIGNED VALUE

data-entry

address

This query statement tells DataBase to modify the address field by


copying the value entered in the ADDRESS field on the Data-entry form.

Example

2:

assign temp discount


0.10

:=

INVOICES order total

This query statement assigns a value to a temporary variable named


DISCOLNT. The value assigned to the variable is 109f of the order
total on the invoice.

Volumes

6-14

DATA
Symbols

ASF.

R E F

R E N C E

F.

MAN

L:

AL

(cont.)

a
AIsd: <=, =, >, >=
between, not
.Sec

Keyword:

< (less than)

Type:

Comparison Operator Symbol

Purpose: The <

(less than)

another.
is les.s

Syntax:

Example:

symbol

is

used

to

compare one value

specifies that the value to the

left

of the

to

s\ inbol

than the value to the right of the symbol.

value
for

It

<

value

CUSTOMERS

with

account balance < 500

This query statement selects CUSTOMERS records that have a value less
than 500 in the ACCOUNT BALANCE field.

Keyword: <=
Type:

(less than or

equal

to)

Comparison Operator Symbol

Purpose: The <=

(less than or equal to)

value to another.

symbol

is

It

symbol

is

used to compare one

Sec Also: <. =,


between, not

>,

>=

specifies that the value to the left of the

less than or equal to the value to the right of the

symbol.

Syntax:

Example:

value
for

<= value 2

CUSTOMERS

witfi

ACCOUNT balance

This query statement selects CUSTOMERS records that have


than or equal tn .SOO in the ACCOUNT BALANCE field.

6-15

500
a

value less

Volume

DQL LEXICON
Symbols

(cont.)

B
Keyword: =

See Also: <, <=, >, >=,


between, not

(equals)

Comparison Operator Symbol

Type:

Purpose: The -

(equals)

another.

It

symbol

is

used to compare one value

specifies that the value to the left of the

to

symbol

is

equal to the value to the right of the symbol.

VALUE

Syntax:

Example:

for

VALUE 2

CUSTOMERS

with

account balance = 500

This query statement selects CUSTOMERS records that have a value


equal to 500 in the ACCOUNT BALANCE field.

B
Keyword: >
Type:

(greater than)

Comparison Operator Symbol

Purpose: The >

(greater than)

another.

It

symbol

is

used

compare one value to


the left of the symbol is

to

specifies that the value to

See Also: <, <=, =, >=,


between, not

greater than the value to the right of the symbol.

VALUE

Syntax:

Example:

for

>

VALUE

CUSTOMERS

with

account balance > 500

This query statement selects CUSTOMERS records that have a value


greater than 500 in the ACCOUNT BALANCE field.

Volume

6-16

DATABASE REFERENCE

DQL LEXICON
abs
Keyword: abs

(absolute value)

See Also:

Type:

Math Function

Purpose: The abs

ceil, floor,

mod,

random

function converts a numeric value to a positive,

unsigned numeric value.

Syntax:

abs(NUMERIC VALUE)

Returns:

Usage:

The abs function can only be used with

numeric value.
a

numeric value.

non-numeric value always returns a value of

0.

Examples: abs(-453)
Returns:

453

abs(4.53)
Returns: 4.53

Volume

6-18

DATABASE REFERENCE MANUAL


acos
Keyword:

acos (arccosine)

Type:

Trigonometric Function

See Also: asin, atan, atanl,


cos, cosh, sin, sink, tan, tank

Purpose: The acos function calculates the


The result is an angle expressed
Syntax:

between

and

7t.

acos(NUMERIC VALUE)

Returns:

Usage:

The

numeric value.
valid range of the input value

value
unless

Example:

arccosine of a numeric value.


in radians

is
it

outside the range,

it

may

is -1

to

1.

If the input

cause the system to freeze

has a math coprocessor.

acos(0.5)
Returns: 1,047195755
acos(-0.8)
Returns: 2.49809154

6-19

Volume

DQL LEXICON
Ad-hoc Relationship
Keyword: Ad-hoc

Relationship
any, count of,
lowest of, mean of,
named. Relationships

See Also:

Type:

Concept

highest

sum
Purpose: Like

a predefined relationship, an

relationship between
relationship

two

ad-hoc relationship

sets of records, but

is

of,

all,

of,

an ad-hoc

created during a queiy instead of being

is

specified on the Relationships form during the

An

Definition process.

ad-hoc relationship

lets

Form
you

easily

access records in another form while processing a procedure.

However, because

the ad-hoc relationship isn't stored as a

part of the database,

An

it

ad-hoc relationship

must be redefined
is

which new selection

When you
is

used

each procedure.

created by combining a relational

(or relational statistical) operator with the

unrelated form, or the

in

name

name of an

of a predefined relationship to

criteria are added.

create an ad-hoc relationship, the

to give the set of related records a

lets DataBase identify each


from a given form.

named

operator

unique name. This

distinct set of records selected

relational operator FORMNAME


RELATIONSHIP [named
"UNIQUE RELATIONSHIP NAME"] [with (selection criteria)]

Syntax

[FIELDNAME]

Usage:

Once an ad-hoc

relationship

criteria, the criteria

is

created with certain selection

cannot be changed during the remainder

If you want to select another set of records, you


must create a new ad-hoc relationship and give it a new name

of the query.

using the

named
-^

Volume

operator.

This entry continues on the next page

6-20

DATABASE REFERENCE MANUAL


Ad-hoc Relationship
Example:

for

(cont.)

CUSTOMERS
list

with

account balance > 500

records

LAST NAME

sum

of

in

order

INVOICES named

"MAY" with

(CUSTOMER # = CUSTOMERS CUSTOMER


and DATE between 05/01/89 to 05/31/89
ORDER TOTAL

#
)

end
As

there

a predefined relationship between

is

INVOICES

based on the

sum

of

customer

CUSTOMERS

and

# field, the statement;

INVOICES named

"MAY" with

(CUSTOMER # = CUSTOMERS CUSTOMER


and DATE between 05/01/89 to 05/31/89
ORDER TOTAL

#
)

creates an ad-hoc relationship by adding the additional

DATE

selection

criteria to the existing predefined relationship.

This query tells DataEase: 1) Select all the CUSTOMERS records that
have a account balance greater than $500. 2) Find all these customers'
invoices in the related INVOICES form that are dated during May 1989.
3) For each record selected from the CUSTOMERS form, list the
customer's last name and the sum of that customer's May invoices.

Note

that if

JUNE

we

invoices,

also

want DataEase

we have

list the sum of these customers'


new ad-hoc relationship and give it

to

to create a

unique name as shown below:


for

CUSTOMERS

with

records
LAST name in order

ACCOUNT balance > 500

list

sum

of

INVOICES named

"MAY" with

(CUSTOMER # = CUSTOMERS CUSTOMER


and DATE between 05/01/89 to 05/31/89

ORDER TOTAL
of INVOICES named

#
)

sum

"JUNE" with

(CUSTOMER # = CUSTOMERS customer


and DATE between 06/01/89 to 06/30/89

ORDER TOTAL

#
)

end

6-21

Volume

DQL LEXICON
all

Keyword:

all

Type:

Relational Operator

See Also: any

Purpose: The

all

operator selects every record

in a related

form

that

matches the current record being processed.

Syntax:

Returns:

FORMNAME RELATIONSHIP [named "UNIQUE


RELATIONSHIP NAME"] [with (selection criteria)) FIELDNAME

all

The

specified value from every matching record in the related

The type of value returned

form.

specified field.

For example,

the returned value

Usage:

The

all

items

if

is

the

same

operator can only be used to specify report output

in a list

records command.

one Tertiary form,

etc.).

CUSTOMERS
list

cannot be used

It

all

level

(i.e.,

See Example

with

to specify

from more than

one Secondary form,

2.

account balance > 500

records

LAST name
all

fields,

is text.

one form on each relationship

for

as that of the

you're selecting text

selection criteria or to select related records

Examplel:

in

groups

INVOICES INVOICE #
INVOICES ORDER total
;

end
This query tells DataEase: 1) Select all the CUSTOMERS records that
have an ACCOUNT balance greater than $500. 2) Find all these
customers' invoices in the related INVOICES form. 3) For each record
selected from the INVOICES form, list the invoice # and the ORDER
total. The output from this query, arranged in groups by LAST NAME
(from the CUSTOMERS form), miaht look as follows:

LAST NAME

DATABASE REFERENCE MANUAL


all

The

(cont.)

all

operator

lets

you

retrieve information

To demonstrate

relationship level.

from one form on each

E.xample 2 introduces a third


form called RETURNS. The RETURNS form keeps track of any returned
merchandise and the amount refunded for each invoice. The RETURNS
form is related to the INVOICES form by the INVOICE # field.

Exampie2:

CUSTOMERS

for

list

this,

with

account balance > 500

records

LAST NAME
all

in

groups

INVOICES INVOICE #
INVOICES ORDER TOTAL
INVOICES all RETURNS refund total
;

all

end
This query tells DataEase: 1) Select all the CUSTOMERS records that
have an ACCOUNT balance greater than $500. 2) Find all these
customers' invoices in the related INVOICES form. 3) For each record
selected from the INVOICES form, list the invoice # and the order
TOTAL. 4) For each invoice, find the related record in the RETURNS form
(i.e., the record with the same INVOICE
#) and list the REFUND TOTAL.

The output from

CUSTOMERS
LAST NAME

Adams
Cooper
Evans

this

query, arranged in groups by LAST

form), might look as follows:

NAME

The e.xample on this page


shows how all can he used to
access information in a
Tertiary form by iisini; a
related Secondary form

The all operator cannot he


used to access information
from more than one form on
the

all

ivers

(from the

same

relationship level.

DQL LEXICON

ampm
Keyword: ampm
Type:

See Also: current, hour,


minutes, seconds, timeampm

Time Function

Purpose: The

ampm

function evaluates a value expressed in the

24-hour time format


abbreviation

Syntax:

AM

(HH:MM:SS) and

(before noon), or

PM

returns the appropriate


(after noon).

ampm(TIME VALUE)

AM or PM).

Returns:

Usage:

Time values from midnight (00:00:00) to


:59:59) return
AM. Time values from noon (12:00:00) to (23:59:59) return
PM.

text value (either

Examples: ampm(08:15:25)
Returns:

AM

ampm(1 5:30:50)
Returns:

Volume

PM

6-24

DATAEASE REFERENCE MANUAL


and
Keyword: and
Type:

See Also:
between,

Logical Operator

Purpose: The and


Syntax:

<=,
not

=,

>,

>=

operator combines two sets of selection criteria.

SELECTION CRITERIA

Returns:

<
or,

The values

and SELECTION CRITERIA 2

records that satisfy both of the selection criteria

in

statements.

Usage:

The and operator

requires that a record meet all the specified

The or operator requires


meet any of the specified criteria to be

selection criteria to be processed.


that a record

When

processed.

Examples:

combined with both the


criteria must be

selection criteria are

and and or

operators

enclosed

parentheses to clarify the meaning.

for

in

in

one statement, the

CUSTOMERS with state = "NY"


and ACCOUNT balance > 500
;

This statement
that contain

tells

NY

DataBase: Process only those CUSTOMERS records


STATE field and a value greater than 500 in the
field. Only records that satisfy both these criteria are

in the

ACCOUNT BALANCE
processed.
for

CUSTOMERS with (STATE = "NY"


and account balance > 500

or

STATE = "NJ")

This statement

tells

500

in

the

Again, only records

6-25

DataBase: Process only those

NY

NJ in the STATE
ACCOUNT BALANCE field.

that contain either

or

field

CUSTOMERS

and

records

a value greater than

that satisfy horli sets of criteria are processed.

Volume

DQL LEXICON
any
Keyword: any
Type:

See Also:

Relational Operator

Purpose: The any

operator selects the first record

in a related

form

all

that

matches the current record being processed.

FORMNAME RELATIONSHIP [named "UNIQUE


RELATIONSHIP NAME"] [with (selection criteria)] FIELDNAME

Syntax:

Returns:

any

The

specified value

related form.

of the specified

Usage:

from

the//;-i7

matching record

The type of value returned

is

in the

same

the

as that

field.

The any operator can be used

to:

Note that the any operator


(unlike the all operator) can
access information in any
number offorms on the same
relationship level.

1.

Specify output items

2.

Specify selection

relationship level
etc.).

for

(i.e..

See Primary

INVOICES

with

records command.

criteria.

Select related records from

3.

Example:

in a list

more than one form on each

Secondary forms. Tertiary forms,

Form

for details

on relationship

order total > 500

records
INVOICE # in order

levels.

list

ORDER TOTAL
any
end

CUSTOMERS

last name

This query tells DataBase: 1) Select all the INVOICES records that have
an ORDER TOTAL greater than 500. 2) For each record selected from the
INVOICES form, list the invoice # and the ORDER TOTAL. 3) For each
record selected from the INVOICES form, find the first (and only the
first) related record in the CUSTOMERS form. 4) For each record
selected from the CUSTOMERS form, list the customer's LAST NAME.
The output from this query, arranged in order by INVOICE #, might look as
follows:

INVOICE*
A1 17095

ORDER TOTAL

LAST NAME

DATABASE REFERENCE MANUAL


asm
Keyword:

asin (arcsine)

Type:

Trigonometric Function

Purpose: The
The

See Also: acos, atan, alan2,


cos, cosh, sin, sink, tan, tank

asin function calculates the arcsine of a numeric value.


result

is

an angle expressed

in

radians between -nil to

nil.

Syntax:

asin(NUMERIC VALUE)

Returns:

Usage:

The

numeric value.
valid range of the input value

value
unless

Example:

Z2

is
it

outside the range,

it

is -1

may cause

to

1.

If the input

the system to freeze

has a math coprocessor.

asin(l)
Returns:

1.570796

asin(-0.50)

Returns

-0.5235988

6-27

Volume

DQL LEXICON
assign
See Also: define, global, temp

Keyword:

assign

Type:

Procedural

Command

Purpose: The assign command

or global variable.

used to give a value to a temporary

is

variable

is

used to store a value, such as

a text string or a calculated result, that can change during the

processing of a procedure.

specifying the variable's name,

By

the stored value can be used like any other value in a query.

The status of a variable can be global (denoted by the


keyword global) or temporary (denoted by the keyword
temp).

temporary variable can only maintain a value during

the current procedure.

from one procedure

global variable can pass

to another.

To

its

value

pass a value from one

procedure to another, the variable must be defined identically


in

Syntax:

each procedure.

assign global

temp VARIABLE

The assign command

Usage:

is

NAME

:=

ASSIGNED VALUE

followed by:

The status of the variable (global or temporary).


The name of the variable (without quotation marks).
The assignment operator.
The value assigned to the variable.

A period.
Example:

define
for

temp "DISCOUNT" Number

INVOICES

with

ORDER TOTAL > 500


:= INVOICES order total
;

assign temp DISCOUNT


0. 15
modify records
.

ORDER TOTAL

:=

ORDER TOTAL

temp DISCOUNT

end
This query

tells

DISCOUNT to

DataEase:
store a

1)

Create (define) a temporary variable called


the current query. 2) Find

number while processing

records that have a value greater than 500 in the order


the DISCOUNT variable a number value
determined by multiplying the ORDER total on each invoice by 157r.
4) Modify these INVOICES records by subtracting the value of the
all

the

TOTAL

INVOICES
field. 3)

Give (assign)

DISCOUNT variable

Volume

from the value

in the

ORDER total

field.

6-28

DATABASE REFERENCE MANUAL


atan

Keyword: atan
Type:

(arctangent)

See Also: acos, asin, atanl,


cos, cosh, sin, sink, tan, tank

Trigonometric Function

Purpose: The atan function calculates the arctangent of a numeric


value. The result is an angle expressed in radians between
-nil to

Syntax:
Returns:

7t/2.

atan(NUMERIC VALUE)

numeric value.

Examples: atan(500.3)
Returns

.56879753

atan(-359.4)

Returns

6-29

-1.5680139

Volume

DQL LEXICON
atan2

Keyword: atan2
Type:

See Also: acos, asin, atan,


cos, cosh, sin, sink, tan, tank

(arctangent 2)

Trigonometric Function

Purpose: The atan2

function calculates the arctangent of Value

divided by Value

2.

The

result

is

an angle expressed in

radians between -n to n.

Syntax:

atan2(NUMERIC VALUE

Returns:

1,

NUMERIC VALUE

2)

numeric value.

Examples: atan2(3,127)
Returns
0.02361766
:

atan2(1,

Returns

Volume

1)
:

0.7854

6-30

DATABASE REFERENCE MANUAL


backup db
Keyword: backup db (backup

See Also: db status,

database)

reorganize, restore db

Type:

Control

Command

Purpose: The backup db command


current database.

When

processing reaches a

command, DataBase automatically


It

The backup db command

backup copy of the

creates a

backup db

locks the current database.

functions like selecting


Backup Database {Option 2)

on the Maintenance menu.

then displays a series of prompts asking you to specify the

drive on which the

you want

to

backup copy should be stored and how

handle any errors that occur during the backup

For more information on


database backups, see
Volume I Chapter 4,
Database Maintenance.
,

procedure.

Syntax:

Usage:

backup db

When you backup

a database using the

backup db command,

DataEase copies the database using a special format;


therefore, the

backup copy can only be restored using

DataEase restore db

command

or Maintenance

When you backup and

restore a database,

been deleted since the

last

all

menu

the

option.

records that have

backup and restore operation are

permanently erased.

LAN:

On

LAN

(Local Area Network),

if

another user

is

currently

backup db command,

using any resource required by the

DataEase displays a Resource Conflict message. While

message
the

is

command

at brief intervals.

procedure during

When

this

displayed, DataEase automatically tries to execute

this time,

the required resource

you want

If

you must reboot

becomes

to abort the

the computer.

available,

DataEase

automatically resumes processing and executes the rest of the

procedure.
for

See Volume

2,

Chapter

more information on resource

4,

System Administration

conflicts

and Multi-User

Locking Options.

Example:

record entry "CUSTOMERS"


run procedure "PRINT INVOICES"
.

backup db

This query tells DataEase: 1) Display the CUSTOMERS form so the


operator can enter new customer records. 2) When the operator finishes
entering records, run the procedure named PRINT INVOICES. 3) After
running the PRINT INVOICES procedure, make a backup copy of the
current database.

6-31

Volume

DQL LEXICON
between
See Also: <=, <, =, >, >=,
not

Keyword: between
Type:

Comparison Operator

Purpose: The between

operator

is

within a specified range.

used to indicate that a value

greater than or equal to Value

Value

Returns:

Example:

All records for

for

which

CUSTOMERS

499

Volume

the

to

is

less than or equal to

VALUE

comparison

with

is

true.

account balance between

CUSTOMERS

and 499 (inclusive)

and

to

This query statement selects

between

2.

TEST VALUE between VALUE

Syntax:

falls

specifies that the test value

It

in the

records that have a value

account balance

field.

6-32

DATABASE REFERENCE MANUAL


blank

Keyword: blank
Type:

Keyword

Purpose: The blank keyword

is

used to assign a

/;////

value to a field or

variable.

Syntax:

blank

Usage:

null value

is

an unspecified value, not a zero.

statistics are calculated

included
in

on a

in the calculation.

generating

field,

Zero

blank values

field values

When
are not

are included

statistics.

Field or variable values can be

compared

to

blank, and blank

can be assigned as a value to any field or variable.

Examples:

for

CUSTOMERS

with

account balance = blank

delete records

end
This query tells DataBase: Delete the CUSTOMERS records that have a
blank value in the account balance field. It might be used to delete
inactive

6-33

CUSTOMERS

records.

Volume

DQL LEXICON
break

Keyword: break
See Also: exit

Type:

Procedural

Command

Purpose: The break command


a for or while

is

used to immediately stop the action of

command and

continue processing the

procedure.

When

processing reaches a break

command, DataBase

immediately abandons the current action.


processing the procedure w

ith

corresponding end command.

Syntax:

It

resumes

the first action listed after the

DATABASE REFERENCE MANUAL


call

menu
menu

Keyword:

call

Type:

Control

See Also: call program

Command
menu command

Purpose: The

call

Syntax:

menu "MENU NAME"

call

displays the specified menu.

menu command,
menu name should he

hi a call

enclosed

Usage:

The

call

menu command

can be used

to display either a

DataBase system menu or a user-defined menu

at

unless

any point

in the

the

menu

is

displayed, you can

make

selections

from

quotation marks
specified as a

variable. User-defined menus


are called hy the name entered

during a Control Procedure.

When

in

it is

the

it

the

Menu Name field when

menu was

created.

and perform the associated DataBase operations normally.

When
the

a chain

menu

is

menu

called,

is

it

automatically executed, but

is

not displayed.

The DataBase system menus

are called by the following

MAIN (Main Menu)


FORMS (Form Definition menu)
RECORDS (Record Entry menu)
QUICK REPORTS (QBE Quick Reports
DQL PROCEDURES (DQL menu)
MAINTENANCE (Maintenance menu)
-

UTILITIES

(Utilities

menu

For more information on the


use of menus, see Volume 2,
Chapter 3.

Menu Definition.

menu)

menu)

ADMINISTRATION
When

titles:

function

(Administration menu)
is

completed and you press ESC, the

Control Procedure resumes with the action following the call

menu command.
Example:

record entry "CUSTOMERS"


run procedure "PRINT INVOICES"
.

call

menu "MAINTENANCE"

This query tells DataBase: 1) Display the CUSTOMERS Record Entry


form so the operator can enter new records. 2) Run the PRINT
INVOICES Procedure. 3) Display the Maintenance menu.

6-35

Volume

DQL LEXICON
call

program

Keyword:

call

Type:

Control

program
See Also: call menu

Command
program command runs

Purpose: The

call

Syntax:

program

call

the specified

DOS

program.

"PROGRAM NAME [OPTIONAL ARGUMENT

".

In a call program

the

Usage:

The

call

program

The

program command
at

used to

is

call

and run another

any point during a Control Procedure.

called program can be any

command must

program. The

on which the called program

is

command,
program name and

arguments should he enclosed


in quotation marks unless a
variahle

is

specified.

.BAT, .COM, or .EXE


specify the drive and directory
stored

if

it

is

not stored in the

current directory.

The command can include

1)

or an expression involving

functions and variables (Example

When

the called

The command

optional arguments.

can be a constant (Example

2).

program has been executed, DataEase

resumes processing the Control Procedure with the action


following the call

program command.

CAUTION: Do

not try to call a memory-resident program from within


DataEase. Doing so may damage your system.

NOTE: DataEase

can he swapped

or disk to free enough

enough

EMS memory

transfers itself into


If there is not
itself to disk.

program and
DataEase

to either

memory for

E.xpanded

Memoiy (EMS)

the called program.

If

DataEase automatically
e.xpanded memory.
is

available,

enough memory, you can make DataEase swap


To do this, you must add the name of the called
its

memory requirement

PROGCALL.DAT

which you can

edit with

file.

(in bytes) to the

This

any ASCII

is

an ASCII text

file

text editor.

The following information must be entered in the


PROGCALL.DAT file for each program you intend

to call

from DataEase:

PROGNAME
-^

Volume

bytes

This entry continues on the next page

6-36

DATAEASE REFERENCE MANUAL


call

program

(cont.)

PROGNAME

name of

the

is

.BAT, .COM, or .EXE file


may be included in the call
the .DAT file.

the

with no parameters.

Parameters

program command,

but not

in

Following the program name,

insert a space

followed by a

number representing the program's memory requirement in


bytes. This number should be entered with no commas or
decimal points

(e.g.,

384K

is

entered as 384000).

If you do not have EMS. you must add this information for
each program you want to call from within DataEase. If you
don't have sufficient EMS. a call will not be executed unless

the

program information

file.

To

ensure that

is

included

all calls

in the

are executed,

PROGCALL.DAT
we recommend

that

you add any programs you intend to call to this file, even if
you think you have enough EMS to make swapping to disk
unnecessary.

When DataEase

is

shipped the

includes three programs

COMMAND)
Example:

each of which

run procedure
call

PROGCALL.DAT

file

(CONVERT, GRAFTALK,
is

The

and

assigned 360K.

"MONTHLY SALES"

program "C:\GT\GRAFTALK BARCHART.1"

This query tells DataEase 1) Run the predefined MONTHLY SALES


Procedure which sends a summary of the monthly sales to a disk file.
2) Call the DataEase GrafTalk program and run the predefined GrafTalk
chart BARCHART.I. which uses the output file created by the

previous

procedure to draw a graph of the monthly

sales.

Example: 2 define temp "CHART" TEXT.


assign temp CHART := "BARCHART.I"
define temp "PROG" TEXT.
assign temp PROG := "C:\GT\GRAFTALK"
.

run procedure
call

program

"MONTHLY SALES"

jointext

PROGCALL.DAT file

includes three programs:

DataEase Convert (included


with DataEase). which is used
to convert data from Lotus
and/or Paradox into a
DataEase database (for more
information on converting a
Lotus or Parado.x Application,
see Volume 2. Chapter 5.

Database Utilities): DataEase


GrafTalk (separate product
available from DataEase
International), which is used
to create charts and graphs
from vour data: and the DOS
C0MMAND.COM program.

(PROG, CHART)

This query does exactly the same thing as the simpler one above, but
shows the proper use of an expression as an argument for the call

program command.

NOTE:

6-37

The aii-umcms of the jointext function (PROG. CHART) are


not enclosed in quotes because they are variables.

Volume

DQL LEXICON
case

See Also: break, end, exit, if,


nested actions, others, value,

Keyword:

case

Type:

Procedural

while

Command

Purpose: The case command


with multiple

functions like an if-then-else statement

It tells

ifs.

to a series of values

DataEase

to

compare an expression

and execute a different action (or group

of actions) based on which comparison

When

processing reaches a case

compares

is

true.

command, DataEase

the expression that follows case to each of the

statements specified by the keyword value.

comparison

If the first

DataEase executes

is true,

all

The keyword value

the

actions between that value statement and the next value


statement.
If the first

comparison

compared

to the next

is

not true, the case expression

is

automatically inserted after


the case expression in High
Level Interactive Mode.

is

value statement. This comparing of

values continues in top-to-bottom sequence from one value


statement to the next until the case expression has been

compared

As soon

each value statement.

to

as the actions following

any single statement are

executed, processing passes to the

end command
If

first

action following the

for the case structure.

none of the specified value comparisons are

true,

DataEase

executes the actions specified after the keyword others.

others keyword

is

specified actions,

Syntax:

If the

not present, DataEase executes none of the

it

continues processing the query.

case (EXPRESSION)
value

COMPARISON

ACTION SERIES
[value

COMPARISON

1.

ACTION SERIES 2]

[value

COMPARISON N

ACTION SERIES N]
[others

OTHERS ACTION

SERIES.]

end

-^

Volume

This entry continues on the next page

6-38

DATABASE REFERENCE MANUAL


case

(cont.)

Usage:

The case command

requires a case expression, at least one


value statement, and an end command. Subsequent value

statements, actions, and the others


If

others

is

used,

it

keyword

must follow the

last

The case expression must be enclosed


be a

field, a variable, or

are optional.

value statement.

in parentheses.

It

can

any other expression except a

boolean expression (true or

Each comparison value

false).

can be a constant, a variable, an expression, or a range of


values.

An

command

action can specify any valid procedure

including another

command must
first

while, or case

if,

command. Each nested

be completed before processing passes to the

action after the

end command

(see the nested actions

entry in this Lexicon).

When

case

commands

matched with
applies to
for,

Example:

if,

all

end corresponds

are nested, the first

to

and each case comand must be

the last preceding case,

a corresponding

end command. This

nested Procedural

commands

rule

(including case,

and while).

case (current user name)

"FRANK"
menu "ADMINISTRATION"
value "TOM"
call menu "UPDATE"
value "CAROL"
value

call

run procedure "DAILY"


others:

record entry

"CUSTOMERS"

end
This query tells DataEase: If the current user is Frank, display the
Administration menu. If the current user is Tom. display the Update

menu.
user

is

If

the current user

is

Carol, run the Daily Procedure.

anyone other than Frank, Tom, or Carol, display the

If the

current

CUSTOMERS

Record Entry form.

6-39

Volume

DQL

LEXICON

ceil

Keyword:

ceil

Type:

Math Function

See Also: abs, floor, mod,

random

Purpose: The

ceil function

rounds up a numeric value

to the next

integer.

Syntax:

ceil(NUMERIC VALUE)

Returns:

Examples:

An

integer value.

ceil(5.000)

Returns:

ceil(5.001)

Returns;

Volume

6-40

DATABASE REFERENCE MANUAL


comments

B
Keyword:

--

Type:

Symbol

See Also: The double dash


(-) comments symbol at the
front of the lexicon.

(comments)

Purpose: The -- (comments) symbol is used to insert annotative


comments in a query. Comments have no effect during

Comments can only he added


the

to

a query

in

Edit Mode.

execution of the procedure.

Syntax:

Usage:

-COMMENT TEXT
Comments can
DataBase

treats

symbol and

To

continue a

dash symbol

Example:

the

for

only be added to a query

Edit

Mode.

each character between the double dash

end of the

line as part

comment on more

at the

with

of the comment.

than one

beginning of each

CUSTOMERS
list

in

line,

use the double

line.

account balance >= 500

records

LAST name
ACCOUNT BALANCE
end -- THIS QUERY LISTS THE VOLUME BUYERS.
-IT SHOULD BE UPDATED ON THE TENTH DAY
-OF EACH MONTH.
;

This query statement selects CUSTOMERS records that have a value


greater than or equal to 500 in the ACCOUNT BALANCE field and lists the
customers' last name and CURRENT balance values. The comment at
the

end of the query has no

that follows the

effect on processing. DataEase ignores text


double dash comment .symbol.

NOTE: Comments

are for your reference purposes only. DataEase


ignores comments when processing the query.

6-41

Volume

DQL LEXICON
Comparison Operators
Keyword: Comparison Operators
Type:

See Also: <=,


between, not

<, =, >,

>=,

Operator

Purpose: Comparison Operators

are used to

another in record selection

criteria,

compare one value to


math formulas, and in

other text and numeric expressions.

The

DQL

uses seven Comparison Operators:

Both sides of the comparsion have the same


value.

The value on

the left side of the

less than the value

The value on

on the right

comparison

is

side.

the left side of the

comparison

is

greater than the value on the right side.

<=

The value on
to the value

>=

The value on
to the value

between

The value

the left side

on the

the left side

on the

lies

is

less than or

equal

right side.

is

greater than or equal

right side.

within the specified range

(inclusive).

Reverses the meaning of the operator that

not

immediately follows

Examples:

for

CUSTOMERS

with

account balance > 500

and STATE not = "NY"

for

INVOICES
to

Volume

01/31/89

it.

with date

between 01/01/89

6-42

DATABASE REFERENCE MANUAL


Conditional Statistical Operators

Keyword: Conditional

Operators

Statistical

See Also: count, item, percent

Type:

Operator

Purpose:

Conditional Statistical Operators generate statistical


information about specific conditions that occur in a set of
records.

The

DQL

uses three Conditional Statistical Operators: item,

count, and percent.

item

returns a

YES

comparison

count

returns the

is

or

NO

answer indicating

if

the

true or false.

number of

true responses within all

the specified records as well as specified groups.

percent

returns the percentage of true responses


(the

number of true responses divided by


number of records processed,

the total

multiplied by 100).
at the

Usage:

percent also works

level.

in a query, the Conditional Statistical


after a

item that

list

operator

is

is

compared

Operator

is

inserted

to a specified value.

The

separated from the comparison by a colon.

->

6-43

group

This entry continues on the next page

Volume

DQL LEXICON
Conditional Statistical Operators (cont.)

Example:

for

CUSTOMERS

records
LAST NAME in order
list

ACCOUNT BALANCE
ACCOUNT BALANCE > 500
;

item count percent

end
This query tells DataEase: 1) Process all the CUSTOMERS records.
2) List each customer's LAST name and ACCOUNT balance. 3) For each
customer, display a YES or NO answer indicating if the customer's
ACCOUNT BALANCE is greater than 500. 4) Display the total number of
customers whose ACCOUNT balance is greater than $500.
5) Display the number of customers that have an ACCOUNT BALANCE
greater than 500 as a percentage of all the customers.

The output from

this query arranged


might look as follows:

LAST

in alphabetical

order by LAST

name

DATABASE REFERENCE MANUAL


Constant Value

Keyword: Constant Value


Type:

See Also: variable

Concept

Purpose:

constant value

procedure

is

is a value that does not change while a


being processed (the opposite of a variable).

Constant values are used

in selection criteria

math formulas, proper names, and other

text

comparisons,

and numeric

expressions.

Usage:

In a query, a constant value

type

is

allowed.

can be used wherever

The value types of constants

the basic field value types: text,

its

are the

number, numeric

value

same

as

string, date,

time, and dollar.

The format

for typing constant values

--Enclose Text constants

-Use slashes in Date


-Use colons in Time

-Do
-Do

Example:

for

as follows:

double quotes ("TEXT").

constants (01/01/89).
constants (09:30:00).

not type formatting characters in numeric strings.


not type

commas

CUSTOMERS
and

ZIP

in

In this

query statement, both the


are constant values.

Number

with last

> 90000

90000

6-45

in

is

last

constants.

name = "SPENCER"

name SPENCER and

the zip

code

Volume

3
I

DQL LEXICON
Control Procedure

See Also: Processing


Procedure

Keyword: Control Procedure


Type:

Concept

Purpose: A Control procedure

is

High Level procedure

that lets

you

link other procedures together with or without conditional

processing actions specified by Procedural commands.

Control procedure can link any number of procedures

system menus such as

many

Procedural commands.

Although a Control procedure can

link Processing procedures

together, you cannot use a Processing

Control procedure

itself.

Note

command

also, that a

in the

Control procedure

itself

cannot enter, delete, or modify records, or create output.

For a

full

individual

Example:

run procedure

etc.

Control procedure can include any combination of Control

commands and

if

explanation of any of the

command

Commands

operations

Database. Install an Application,

Usage:

Control

shown on DataBase
Record Entry, Run Procedure, Backup

together and can invoke

DQL commands,

see the

call

menu

call

program

record entry
import
reorganize

db status
backup db
restore db
lock db
unlock db
install application

entry in this lexicon.

current user = "PAUL" then


call

menu

"UTILITIES".

run procedure
else
call

"MAILING LIST"

menu "MAIN"

end
This Control procedure tells DataBase: If the current user is Paul,
1) Display the Utilities menu. 2) Run the procedure that generates an
up-to-date mailing list. 3) If the current user is not Paul, display the Main

Menu.

Volume

6-46

DATAEASE REFERENCE MANUAL


copy

from

all

Keyword: copy
Type:

ail

from

Processing

See Also: data-entry, enter a


record, modify records

Command

Purpose: The copy all from command copies values


named fields from one form to another.
The copy

all

from command

Command menu

because

it

is

in identically

not listed on the

High Level

can only be used following either

modify records or enter a record command. When you


commands. DataEase asks if you want
use the copy all from command to transfer data from one
form to another.
a

select either of these

Syntax:

Usage:

copy

all

from

FORMNAME

to

data-entry

The copy all from statement must specify a Source form.


The Source form can be any form or relationship previously
specified in the query or the Data-entry form.

The Target form is specified at the end of the mandatory


modify records or enter a record command. The Target
form can be any form you specify; the default is the Primary
form. Data is copied into each Target field from the
identically

named

Example: Assume we've

CUSTOMERS.

field in the

When yoit use the copy all


from command, data is only
transferred between fields with
the same fieldname.

Non-matching fields are


ignored.

Source form.

defined a target form called

CATALOG

This form contains only those customers

who

receive a special Christmas promotional catalog.


for

CUSTOMERS

with

any INVOICES order total > 500


enter a record in CATALOG CUSTOMERS
copy all from CUSTOMERS
end
;

This query tells DataEase: 1) Select all the CUSTOMERS records that
have any related INVOICE record with an ORDER TOTAL greater than
$500. 21 For each CUSTOMERS record selected, enter a record in the

CATALOG CUSTOMERS form and copy all the information frotii the
source CUSTOMERS record into the target CATALOG CUSTOMERS
record, based on matching field names.

b-Al

Volume

DQL LEXICON
COS
Keyword:

cos (cosine)

Type:

Trigonometric Function

Purpose: The cos

function calculates the cosine of an angle expressed

in radians.

Syntax:

See Also: acos, asin, atan,


cosh, sin, sink, tan, tank

The value returned ranges between

-1

and

1.

cos(NUMERIC VALUE)

Returns:

numeric value.

Examples: cos(3.1415928)
Returns:

cos(-22)
Returns:

Volume

-1

.9271838

6-48

DATABASE REFERENCE MANUAL

cosh
Keyword: cosh
Type:

(hyperbolic cosine)

Trigonometric Function

Purpose: The cosh


expressed

Syntax:

Returns:

See Also: acos, asin, atan,


atanZ, cos, sin, sinh, tan, tank

function calculates the hyperbolic cosine of an angle


in radians.

cosh(NUMERIC VALUE)

numeric value.

Examples: cosh(2.34)
Returns: 5.23878166
C0Sh(-5.4)
Returns: 110.70547

6-49

Volume 3

LEXICON

DQL
count

See Also: count


percent

Keyword: count
Type:

of, item,

Conditional Statistical Operator

Purpose: The count

operator counts the

number of records

in the

form

being processed that satisfy a condition specified by a

comparison of two values. The


statistic in the

Syntax:

Usage:

CONDITION

To count
that
is

Example

is

count [other

result usually appears as a

area at the end of a report.

statistical

operators]

the records processed by a query, use a statement

true for every record, such as

shown

1: for

all

summary

in

Example

CUSTOMERS

"A" = "A". This method

2.

records
LAST NAME in order
list

ACCOUNT BALANCE
ACCOUNT BALANCE > 500
;

COunt

end
This query tells DataBase: 1) List the CUSTOMERS records showing
each customer's last name and account balance. 2) Count the
number of customers who have an ACCOUNT BALANCE greater than $500.
The output from this query might look as follows:

LAST NAME

To count all the records


processed hy a query, use a
sraiement that is true for every
record, such as "A" = "A".

DATAEASE REFERENCE MANUAL


count of

Keyword: count
Type:

of

See Also:
highest

Relational Statistical Operator

Purpose: The count of

form match the specified selection


appear as a

list

statistic in the

Syntax:

all,

any, count,

lowest

of,

mean

of sum of named

how many

operator counts

of,

records in a related

criteria.

The

result

can

item in the detail area of a report or as a

summary

area

at the

end of a

report.

of FORMNAME
RELATIONSHIP [named "UNIQUE
RELATIONSHIP NAME"] [with (selection criteria)]

count

Example:

for

CUSTOMERS
list

There's an important

records

LAST NAME # in Order


ACCOUNT BALANCE
ACCOUNT BALANCE > 500 item count
count of INVOICES with (Order total > 100)
;

end
This query tells DataBase: 1) Process all the CUSTOMERS records.
2) List each customer's last name, and account balance. 3) For each
customer, display a YES or NO answer indicating if the customer's
ACCOUNT BALANCE is greater than 500. 4) Count the total number of
customers whose ACCOUNT BALANCE is greater than $500 and display this
total as a statistic at the end of the report output (this is generated by the
count operator). 5) Count the number of related INVOICES records that
have an ORDER TOTAL greater than $100, and display this number as a list
item for each customer (this is generated by the count of operator). The
output from this query might look as follows:

LAST

difference between the


conditional statistical

operator count and the


relational statistical operator

count

of.

count finds the

number of records

that satisfy

a specified condition among


the records being processed.

count of calculates the


number of matching records
related to the records being
processed by the query.

DQL LEXICON
current

See Also: data-entry, global,

Keyword: current

input,

temp

Keyword

Type:

Purpose: The current keyword

lets

you access any of the eight

system-determined variables defined below:

current date returns the date recorded by the system clock


(a date value).

current time returns the time recorded by the system clock


(a time value).

current page

number

returns the current page

number

for

multi-page report output (a numeric value).

number

current item

returns the

number of the

current record by

automatically counting records as they are processed by the query (a

numeric value).

name

current user

returns the

name used

to sign onto the database

(a text value).

current user level returns the current user's security level


value from

numeric

current computername returns the name of the workstation


processing the procedure

Network

(a

to 7).

when

operating DataBase on a Local Area

(a text value).

current status returns a numeric value depending on which key the


user presses

when

entering data using the

DQL input command.

This value can then be used to control subsequent processing (see


input for an example).

The value

stored in the current status variable

Key Pressed

Action

ESC

EXIT

F2
F8
F7

SAVE
MODIFY
DELETE

is

shown below:

Value Returned
1

2
3

This entry continues on the next page

Volume

6-52

DATABASE REFERENCE MANUAL


current (cont.)

Syntax:

Example:

current variable

for

CUSTOMERS
list

name

ACCOUNT BALANCE

with

> 500

records

LAST NAME in order


ACCOUNT BALANCE

current date
current page number
current user name
;

end
This query tells DataBase: 1) Select the CUSTOMERS records that have
an ACCOUNT BALANCE value greater than 500. 2) List the LAST NAME

and ACCOUNT balance values from each record that is processed. 3) List
the current date (today's date), the current page number, and the
current user name (the name of the user who generated the report).

The output from

this

query might looks as follows:

PAGE: 1
USER: GEORGE McGRAfH""DATE:l)l720/89
=====================================================
=================================================___
LAST NAME
ACCOUNT BALANCE

'^f^

Adams

generated by DataBase.

Cooper
Evans
Hill

'vers

6-53

$595.00
$725^00
$865.00
$525.00
$675.00

The double boundary

lines at
the top of this output are part

custom report format;

Volume

DQL LEXICON
data-entry

Keyword:

data-entry

Type:

Keyword

See Also: input, record


entry

Purpose: The data-entry keyword

identifies the Data-entry

form as the

source of the specified value.

Syntax:

data-entry

Usage:

FIELDNAME

Data-entry values are used in a query exactly like any other


value or expression.

form name

The keyword data-entry

is

used as the

to specify a value entered in a Data-entry form.

The keyword can only be used

if

a Data-entry

form has

already been defined for the procedure.


In Interactive

Mode,

DataBase offers

if

a Data-Entry

menu

of

all

form has been defined,

the fields defined

on the form

for use in the query.

Example:

for

CUSTOMERS

CUSTOMER

with

customer

= data-entry

modify records
all from data-entry

copy

address
end

:=

data-entry

new address

This query might be used to post address changes into the CUSTOMERS
form. It tells DataBase: 1) Find the CUSTOMERS record that has the

same customer # as the customer # specified on the Data-Entry form.


Modify the CUSTOMERS record by copying the value from the
NEW address field in the Data-entry form to the address field in the
2)

CUSTOMERS
is

form. After each record is modified, the Data-entry form


redisplayed so the operator can enter the next change of address.

Volume

6-54

DATABASE REFERENCE MANUAL

date

Keyword:

date

Type:

Date Function

Sec Also: current, day, Julian,


month, spelldate, spellmonth,
spellweekday, year, yearday,

yearweek

Purpose: The date

function constructs a date value from three separate

numeric values.

Syntax:

date(MONTH, DAY, YEAR)

where
the

MONTH

is

the

number of

day of month (1-31), and

month

the

YEAR

(1-12),

the last

is

two

DAY

is

digits of

year.

Returns:

date value in the format specified on the System

Configuration form. For example,

American date format on


date value

Usage:

If

is

the

if you specify the North


System Configuration form, the

MMfDDfYY.

returned in the order

any input value

invalid (e.g.,

is

DataBase calculates

month >

a future date, for

becomes 07/15/89. Decimal values

12 or day

>

31),

example, 6,45,89

are automatically

truncated.

Examplel: date(7,1,89)
Returns

Example

2:

07/01/89

FIRSTDAY := date(month(TODAY), 1, year(TODAY))


LASTDAY := date((month(TODAY)+1) 1,
year(TODAY))

This portion of a query uses a variable named


current date) and

TODAY

first

and

The

result, if the current date is July 4th, 1989.

last

07/01/89;

NOTE:

(which holds the

two other date functions, month and year,

to find the

days of the current month.

LASTDAY

= 07/31/89. This

routine

is:

is

FIRSTDAY =
accurate for any date.

If your

system is configured for the International


date format, the date value is returned in the order
DD/MM/YY. If your system is configured for the
Metric date format the date value is returned in the order
YYIMMIDD. Regardless of how your system is configured,
the three numerical values this function requires are always
input in the order MONTH. DAY. YEAR.
.

6-55

Volume

DQL LEXICON
day
Keyword: day
Type:

See Also: current, date,


Julian, month, spelldate,

Date Function

spellmonth, spellweekday,

Purpose: The day

function extracts the day of the

month

(1- 31)

from a

year, yearday,

yearweek

date value.

Syntax:

day(DATE VALUE)

Returns:

An

integer value between

and 31. The date format selected

System Administration changes the date sequence but does


not effect which value is returned by a Date function.
in

Examples: day( 12/31/89)


Returns: 31 (North American format)

day(31/12/89)
Returns: 31 (European format)
day(89/12/31)
Returns: 31 (Metric format)

NOTE:

In

Form

Definition,

you can use the derivation formula

day! lookup current date) to stamp each record with the

date of the month. For more information, sec Volume

Chapter

Volume

2.

Form

2.

Definition.

6-56

DATAEASE REFERENCE MANUAL


db status
Keyword: db

status (database status)

See Also: backup db, restore

db

Type:

Control

Purpose: The db

Command
status

command

generates a report that displays the

status of the current database.

When

processing reaches a

db

status

command, DataBase

automatically locks the current database.

It

then displays a

prompt asking you to specify which of the following items


you want to include in the report: forms, procedures, or
imports.

Depending on your reply,


more of the following:

the status report includes

The number of system and user defined forms

The name of each form.

The

The number of existing records

The number of deleted records

The name of each procedure.

The

The name of each import

The

one or

The db status command


functions like selecting
Database Status (Option

in the database.

J on
Database Maintenance
menu. For more information,
see Vohmie 1 Chapter 4.
Database Maintenance.
I

the

DOS

filename and filesize of each form.

in

each form.
each form.

DOS filename and filesize of each procedure.

DOS

specification in the selected directory.

filename and filesize of each import specification.

->

6-57

in

This entry continues on the next page

Volume

DQL LEXICON
db status
Syntax:

(cont.)

db status

To

Usage:

print the

db

status information, press the

SH-F9 PRINT

key.

On

LAN:

LAN

(Local Area Network),

if

DataBase displays

message
the

is

is

currently

Resource Conflict message. While

this

displayed. DataEase automatically tries to execute

command

at brief intervals.

procedure during

When

another user

db status command.

using any resource required by the

this lime,

the required resource

you want

If

to abort the

you must reboot the computer.

becomes

available.

DataEase

automatically resumes processing and executes the rest of the

Volume 2. Chapter 4. System Administrarion.


more information on resource conflicts and Multi-User

procedure. See
for

Locking Options.

Example:

record entry "CUSTOMERS"


run report "PRINT INVOICES"
db status
.

This query tells DataEase: 1) Display the CUSTOMERS form so the


operator can enter new customer records. 2) When the operator finishes
entering records, run the previously defined report named PRINT
INVOICES. 3) After running the PRINT INVOICES report, display the
requested status information for the current database.

Volume

6-58

DATABASE REFERENCE MANUAL


define

Keyword:

define

Type:

Procedural

See Also: assign, global, temp

Command

Purpose: The define command


variable.

variable

is

is

used to create a global or temporary

used to store a value such as a text

string or a calculated result that can

processing of a procedure.

By

change during the

specifying the variable's name,

the stored value can be used like any other value in a query.

The status of a variable can be global (denoted by the


keyword global) or temporary (denoted by the keyword
temp).

temporary variable can only maintain a value

during the current procedure.

global variable can pass

value from one procedure to another.

one procedure

to another, a variable

To

its

pass a value from

must be defined

identically in each procedure.

Syntax:

Usage:

define global

temp "VARIABLE NAME" TYPE [LENGTH]

The define command

is

followed by:

The status of the variable (global or temporary).


The name of the variable (enclosed in quotation marks).
-The type of the variable (any field type except Choice.
Dollar, or Yes/No).

-The

length of the variable (optional, see below).

A period.
pjeriod

The define command

requires a concluding

not a semicolon.

The length specifies the number of characters for Text and


Numeric String variables. The default length is 25; you can
specify any length up to 255 characters.
are always 14 digits long.

NOTE:

characters long.

The

specify a length

in the

variables

default length

define

is

used

if

are 8

you do not

command.

You can define a variable as any field type except Choice.


Dollar, or YesINo fields.

6-59

Number

Date and Time variables

This entry continues on the next page

Volume

DQL LEXICON
define (cont.)

Example:

define
for

temp "DISCOUNT" Number

INVOICES

witti

order total > 500


:= INVOICES order total
;

assign temp DISCOUNT


0. 15
modify records
.

ORDER total

:=

ORDER TOTAL

temp DISCOUNT

end
This query

tells

DISCOUNT to
all

the

Create (define) a temporary variable called


the current query. 2) Find
records that have a value greater than 500 in the order

DataEase:
store a

INVOICES

1)

number while processing

field. 3) Give (assign) the DISCOUNT variable a value determined


by multiplying the ORDER TOTAL on each invoice by 15'7f
4) Modify these INVOICES records by subtracting the value of the
DISCOUNT variable from the value in the ORDER total field.

TOTAL

Volume

6-60

DATABASE REFERENCE MANUAL


delete records

Keyword:

delete records

See Also:

lisl

records, modify

records

Type:

Processing

Purpose: The

Command

delete records

command

deletes records in the specified

form.

Syntax:

delete records

in

FORMNAME RELATIONSHIP
|

RELATIONSHIP NAME"]

When you

Usage:

is

Example

delete records in the Primary form, the

omitted and no punctuation

command

[named "UNIQUE

[with (selection criteria)]

Example

(see

is

keyword

in

used after the delete records

1).

CUSTOMERS

1: for

INVOICES date

with (highest of
delete records

01/01/80)

end
This query deletes records

most recent invoice


January

1st,

When you

in the

Primary form

(in the related

INVOICES

(CUSTOMERS) whose
form)

is

dated prior to

1980.

form other than the Primary form, the


precedes the form name, and the command ends with a
semicolon (or a period if it is the last in a series of actions

keyword
see

delete records in a

in

Example

Example

2).

2: for

CUSTOMERS

The delete records comnumd


does not permanenetly delete
records until the specified

form
form

reorganized. Until the


reorganized, deleted
records can he retrieved hy
pressing CTRL-FJ to access
is
is

them hy record niimher. and


then re-activating them iisinq
F8 MODIFY. Deleted records
cannot he retrieved once the

form

is reorganized. If
records cne frequently added
and deleted, reorganizing the
form will increase efficiency.

delete records in INVOICES named "OUTDATED"


with (CUSTOMER # = CUSTOMERS CUSTOMER #

and INVOICES date < 01/01/80)


end

This query deletes records in the related (INVOICES) form that are dated
prior to January 1st, 1980. The named operator is used to assign a unique
relationship name to the group of outdated records in the related form.

Note

that

when you

relationship,

you

you must again

named operator to create an ad-hoc


any predefined relationship. Because of this,
DataEase how the CUSTOMERS and INVOICES
use the

forfeit

tell

including the phrase (customer # = CUSTOMERS


ad-hoc criteria, you are telling DataEase that the
INVOICES records you want to delete must have the same customer #
as the CUSTOMERS record that is currently being processed anJ a date
before January 1st, 1980.

forms are

related.

CUSTOMER

6-61

By

#) in the

Volume

DQL LEXICON
do
See Also: while

Keyword: do
Keyword

Type:

Purpose: The do keyword

is

component of

the while

command

syntax.

When

If the specified

condition

is

true.

The keyword do

command, DataEase

processing reaches a while

keyword while.

evaluates the condition that follows the

DataEase executes

all

the

keyword do until it reaches the


corresponding end command. DataEase then reevalutes
actions that follow the

original condition.

If the

condition

executes the do action series again.


processing passes to the

command
Syntax:

while

first

is still true.

If the

is

automatically inserted after


the specified while condition
in High Level Interactive

Mode.
the

DataEase

condition

h false.

end

action following the

for the while statement.

CONDITION do
ACTION
ACTION 2
1

ACTION N
end

Example:

define
assign

temp "serial" Number


temp serial :=
.

temp serial < 1000 do


temp serial := temp serial +

while

list

records

jointextC'SYSTEM DISK", temp serial)


end
This query

SERIAL.

tells

2)

DataEase:

1)

Give (assign) an

Create (define) a temporary variable called


initial

3) Print a series of labels joining the


that

is

labels,

5)

the current value of the

value of

words

SERIAL

to the

SERIAL

SYSTEM DISK

variable. 4)

variable.

to the

While printing

number
the

increment the variable by one each time a new label is printed.


the value of the variable exceeds 999, stop printing labels.

When

The while command

tells DataEase to reevaluate the value of the variable


each time it prints a label. As long as that value is less than 1000,
DataEase prints another label. When the value of the variable exceeds
999, DataEase stops performing the action following the do keyword.

Volume

6-62

DATAEASE REFERENCE MANUAL


else

Keyword:

else

Type:

Procedural

Purpose: The

See Also:

else

The

if

if

Command

Command

keyword

command

is

component of

command

syntax.

executes one of two different actions (or

series of actions) based

When

true or false.

the if

on whether the specified condition

processing reaches an

if

DataBase evaluates the condition

that follows the

If the specified

DataBase executes

condition

actions which follow the

is

true.

keyword then

reaches the corresponding end or else


specified condition

\s

false.

until

is

command,
keyword
all

if

the

processing

command.

DataBase executes

all

If the

the actions

keyword else until processing reaches the


corresponding end command. If there is no else. DataBase
jumps directly to the statement following the end command.
that follow the

Syntax:

if

CONDITION

then

[ACTION

ACTION

ACTION N]
[else

ACTION
ACTION

ACTION

N.

end

Example:

for

CUSTOMERS

highest of INVOICES date < 01/01/80 then


delete records
else
delete records in INVOICES with (date < 01/01/80)
if

end
end
This query

tells

DataBase:

most recently dated record

1)

For each

CUSTOMBRS

in the related

INVOICBS

record, find the

form.

2) If the

most

dated before January 1st. 1980, delete the CUSTOMERS


record. 3) If a customer's most recent invoice is dated on or after January
1st. 1980, delete all of that customer's INVOICBS records dated prior to
1980. Note that the first end marks the end of the if cotnmand that selects
recent invoice

is

which records

to delete.

command
6-63

The second end marks

that selects the records

from

the

end of the for

the Primary form.

Volume

DQL LEXICON
end
See Also: break, case,
if, and while

Keyword: end

exit,

for,

Type:

Procedural

Command

Purpose: The end command marks

end of the span of control of

the

other processing and/or procedural

Syntax:

ACTION
ACTION

ACTION

N.

commands.

end

An end command

Usage:

is

required following the last specified

action invoked by a for, case,

When

multiple procedural

the proper positioning of

processing.

procedural

if,

commands

in the

Example

for

(see

query.

Example

CUSTOMERS
records
LAST NAME

is

critical to correct

refers to the

most recent

Each procedural command

controls processing of the query until

end command

command.

are used in a query,

end commands

Each end command

command

or while

it

reaches

its

matching

2).

list

ACCOUNT BALANCE
end
This query tells DataEase: Process all the CUSTOMERS records and list
each customer's LAST NAME and ACCOUNT BALANCE in the report output.

This entry continues on the next page

Volume

6-64

DATABASE REFERENCE MANUAL


end

(cont.)

Example

2: for

CUSTOMERS

highest of INVOICES date < 01/01/80 then


delete records
else
delete records in INVOICES with (date < 01/01/80)
if

end
if

highest of INVOICES date > = 01/01/89 then


list records
LAST NAME in Order
highest of INVOICES date
.

end
end
This query

tells

DataBase: 1) For each

most recently dated record

INVOICES

record, find the

form. 2)

If the

most

dated before January 1st. 1980, delete the CUSTOMERS


a customer's most recent invoice is dated on or after January

recent invoice
record. 3) If

CUSTOMERS

in the related

is

of that customer's INVOICES records dated prior to


customers with invoices dated on or after January 1st
1989, list the customers in order by LAST NAME and show the date of each
customer's most recent invoice.
1st,

1980. delete

1980. 4) For

all

all

Notice that for each

end command. The


selects
if

which records

command

The

if

third

command

first

to

that selects

end marks

the

in the

query, there

is

a corresponding

end marks the end of the if command that


delete. The second end marks the end of the
which records to include
end of the for command

in the report output.

that .selects the records

from the Primary form.

NOTE:

6-65

Although DataBase does not require an end command


in Low Level queries, most High Level queries do. Since
most users eventually convert Low Level queries into High
Level, we recommend that you make a habit of using an end
command at the end of a query to ensure that the synta.x
requirements for High Level are satisfied.

Volume

DQL LEXICON
enter a record

Keyword:

See Also: copy

enter a record

all from,

data-entry, input, record entry

Type:

Processing

Command

Purpose: The enter a record command adds

a record to the specified

form.

Syntax:

enter a record

in

FORMNAME

The enter a record command must

Usage:

specify a target form and

you

the field values to be input into the form. Alternatively,

can specify another form to copy

copy

from command

all

entered

in the

(see

field data

Example

2,

from using the

below).

form, automatic error checking

is

As data

is

performed,

including checks for uniqueness, required fields, range checks,

Any

etc.

Example

1: for

errors are logged to an exception

CUSTOMERS

with

enter a record

in

file.

account balance > 500

CATALOG CUSTOMERS

:= CUSTOMERS FIRST NAME


NAME
NAME 2 ;= CUSTOMERS last name;
HOME ADDRESS := CUSTOMERS address
HOME CITY ;= CUSTOMERS city
HOME STATE := CUSTOMERS STATE
ZIP code := CUSTOMERS zip
end
1

This query

have an

tells

DataBase:

1) Select all the

ACCOUNT balance

CUSTOMERS
CUSTOMERS
CUSTOMERS
CUSTOMERS

CUSTOMERS

greater than $500.

records that

2) For each

record selected, enter a record in the

CATALOG

form, by copying the information from each field in the

form

to the assigned field in the

CATALOG

form.

simply copies information from the CUSTOMERS form into


If you rename the fields so both forms are identical, the
same result can be accomplished with the simpler query shown in

Example

the target form.

Example

2.

Example

2: for

CUSTOMERS

with

enter a record

in

copy
end

Volume

all

from

account balance > 500

CATALOG CUSTOMERS

CUSTOMERS

6-66

DATABASE REFERENCE MANUAL


exit

See Also: break, end

Keyword:

exit

Type:

Procedural

Purpose: The
Syntax:

Command

exit

command

exit

command can

is

used

to

immediately terminate a query.

exit

Usage:

The
is

be used anywhere

returns control to the calling

Example:

in a

query.

When

it

executed, the query immediately stops processing and

for

menu

or procedure.

CUSTOMERS
records

list

ACCOUNT BALANCE in reverse


LAST NAME
current item number > 5 then
;

if

exit

end
end
This query

DataBase: List the five customers with the highest

tells

ACCOUNT BALANCE
the query.

Note

values.

that

When

the fifth record

two end commands

syntax requirements even though the exit

The output from

BALANCE

field,

LAST NAME

this

processed, terminate

is

are required to fulfill the

command

query, arranged in descending order on the

might look as follows:

DQL

terminates processing.

ACCOUNT

DQL LEXICON

DATAEASE REFERENCE MANUAL


firstc

Keyword:

See Also firstlast,firstw,

firstc

jointext, lastc, lastfirst, lastw,

Type:

Purpose: The
(n)

Syntax:

length, lower, midc, midw,


proper, lextpos, upper

Text Function
firstc function extracts a specified

from the beginning

firstc(TEXT

VALUE,

(left)

Usage:

Leading blanks are included

Examples:

characters

n)

Returns:

text string

number of

of a text value.

n characters in length.
in the

firstcC'DataEase International,
Returns; DataEase

count of characters

(n).

Inc.", 8)

firstcC'New User", 4)
Returns: New
firStC(LAST NAME, 4)
Returns: The first four characters in the last name
field for every record that is processed. If a record
contains the value Holmes in the last name field,
the function returns Holm.

6-69

Volume

DQL LEXICON
firstlast

Keyword:

See Also, firstcflrstw,

firstlast

jointext, lastc, lastfirst, lastw,

Type:

length, lower, midc, midw,


proper, textpos, upper

Text Function

Purpose: The

firstlast function converts a text value

Last Name. First

Name

Last Name. The [M.]

Syntax:

firstlast(TEXT

Returns:

Usage:

This function

from

[M.] to the format: First

is

an optional middle

the format:

Name [MJ

initial (or

name).

VALUE)

text value.

is used when names are stored in a single field.


The contents of the field are rearranged so the first word (i.e.,
the last name) becomes the last word in the returned string. If
the name is followed by a comma, the comma is deleted.

Examples:

firstlast("Anthony,

Returns:

Susan

B.

Susan

B.")

Anthony

firstlastC'Eliot, T.S.")

Returns: T.S. Eliot


firstlast(FULL name)

Returns: The value in the full name field in the format


shown above for every record that is processed.
a
If

record contains the value Holmes, Sherlock in the


last name field, the function returns Sherlock Holmes.

Volume

6-70

DATABASE REFERENCE MANUAL


firstw

Keyword:

Sec Also: firstcfirstlast,

firstw

jointext, lastc, lastfirst, lastw,

Type:

Purpose: The
from

Syntax:

length, lower, midc, midw,


proper, textpos, upper

Text Function
firstw function extracts a specified

number of words

the beginning (left) of a text value.

firstw(TEXT

VALUE,

n)

Returns:

Usage:

firstw( FIELDNAME, n) returns the first

text value

n words

in length.

n words

including intervening punctuation symbols.

in the field,

Leading spaces

are treated as delimiters. Trailing spaces are ignored.


are n or fewer

words

in the field,

If there

firstw returns the original

text value.

Examples: firstw("DataEase International, Inc.",


Returns: DataBase International,
firstw("New User",
Returns:

2)

1)

New

firstW(BOOK TITLE, 2)
Returns the first two words in the book title field for
every record that is processed. If a record contains
the value The Hound of the Baskervilles in the book
title

6-71

field,

the function returns

The Hound.

Volume

DATABASE REFERENCE MANUAL


for

Keyword:

for

Type:

Processing

Purpose: The

See Also: end, with

for

Command

command

specifies the

form from which records are

selected for processing and the criteria used to select them.

Usage:

The for command

is

always the

first

word

in a

Low

Level
//;

query.

A Low

Level query can have only one for

specifies the query's Primary

command which

form (see Example

1).

High Level query can have multiple for commands


from different forms (see Example 2).
High Level query, for commands can be nested
program actions (see Example 3).

automatically inserted at the


start of the queiy. To start a
High Level query with any
other command, press Home
(to

to

move

position).

select records

In a

Low Level Interactive


the for command is

Mode,

to alte

and Fl
Mode.

the cursor to the start

F9 (High

Level),

to return to Interactive

the sequence of

When used to specify a query's Primary form, the for


command requires a concluding semicolon. Otherwise,
for command does nor require a semicolon.
The

for

command

is

always terminated by an end command.

All the actions specified between a for

corresponding end

the

command

command and

its

are executed once for each

record selected hy the for command.

Syntax:

Note:

FORMNAME RELATIONSHIP [named "UNIQUE


RELATIONSHIP NAME"] [with (selection criteria)] [;]

for

The for command is the most frequently used word in the


DataBase Quety Language. Most Processing procedures
begin with this command.
-^

6-73

This entry continues on the next page

Volume

DQL LEXICON
for (cont.)

Example

Low

Level Query

Using for
for

Command

CUSTOMERS

to

with

records
LAST NAME in order

Access the Primary Form

account balance > 500

list

ACCOUNT BALANCE

end
This query tells DataBase: 1) Select the CUSTOMERS records that have a
value greater than $500 in the ACCOUNT BALANCE field. 2) For each
selected record, list the customer's LAST name and ACCOUNT balance.

The output from


might look

LAST NAME

Adams

this

query, arranged

in

alphabetical order by

like this:

ACCOUNT BALANCE

LAST NAME.

DATABASE REFERENCE MANUAL


for (cont.)

Example 2 tells DataBase: 1) Select the CUSTOMERS


records that have a value greater than S500 in the account balance
Th,e.quer>' for

field.

2) For each selected record,

3) Select
list

the

all

the

invoice

INVOICES
#

list

records.

the customer's

4) For each

last name.

INVOICES

record,

and the order total.

Since its impossible to properly align information that is processed and


printed in sequence from two different forms, this query produces output
that is very difficult to read as shown below.

LAST NAME

INVOICE #

DQL LEXICON
for (cont.)

Example

3:

High Level Query


With Nested for Commands
for

CUSTOMERS
for

account balance > 500

with

INVOICES
list

records

CUSTOMERS
invoice #

in

LAST NAME

order

ORDER TOTAL

in

groups

end
end
In this query, the second for

command, which

is

nested within the

selects all the related records in the

INVOICES form

actions between the second for and

its

end

for

first,

and performs

all

the

each related record.

This query tells DataBase: 1) Select the CUSTOMERS records that have
a value greater than S500 in the ACCOUNT balance field. 2) Find all the
related INVOICES records for each CUSTOMERS record selected in
Step 1. 3) For each selected CUSTOMERS record, list the customer's
LAST NAME 4) For each selected INVOICES record, list the INVOICE #
.

and the ORDER TOTAL.

The output from

this query,

might look as follows:

LAST NAME

arranged

in

alphabetical order by

LAST NAME,

DATABASE REFERENCE MANUAL


Functions

List of

Keyword: Functions
Type:

Concept

Purpose: The 58 DataBase

functions execute calculations, manipulate

and perform other time-saving data-entry operations.


There are nine groups of functions listed to the right side of
text,

this

The

if

page and briefly summarized below.

function returns one of two values based on

its

evaluation of a

specified condition as true or false.

Date functions convert a date

number representing

into a

the day,

month, year, day of the week, or day of the year on which the
specified date falls.

Spell functions convert a date or numerical value into

its

equivalent

text value.

Time

functions extract the hour, minutes, or seconds from a 24-hour


format time value or assign the appropriate
or PM suffix.

AM

Text functions are used

to concatenate, truncate, or manipulate a text

value.

Financial functions calculate either the beginning value, end value,


interest rate, installment amount, or number of payment periods for a
financial transaction, given the values of the other four variables.

ScientiHc functions raise a base value to a power, derive natural and


base 10 logs, or derive the square root of a value.

Trigonometric functions convert


expressed

Math

numeric value into a value

in radians.

functions perform

common

mathematical rounding operations

or return the absolute value of a specified numeric value.

random

function generates a pseudo

The

random number.

For a full explanation of any of the DQL functions, see the entry
under the function's name in this Lexicon.

6-77

listed

DQL

Functions

DQL LEXICON
futurevalue
See Also: installment, rate,

Keyword:

futurevalue

Type:

Financial Function

periods, presentvalue

Purpose: The futurevalue

function calculates the final value of a

financial transaction given the presentvalue, installment

payment,

Syntax:

interest rate,

and number of payment periods.

futurevalue(presentvalue. installment, rate, periods)

Returns:

Usage:

If the

numeric value

(the final value after all

installment

investment

(e.g.,

payment increases

payments are made).

the value of the

an annuity), the installment must be

expressed as a positive amount.

If the

payment decreases

the value of the investment (e.g., loan amortization), the

installment must be expressed as a negative amount.

The

interest rate, installment

payments, and time periods must

be based on the same terms. For example,

if

payments are

made monthly on a five-year loan, the number of periods is


(12 * 5) or 60. The interest rate must be expressed in the
same terms

(the

monthly

interest rate

is

the annual rate

divided by 12). The interest rate must also be expressed as a

whole number

(10<7f is 10,

not 0.10).

Examplel: futurevalue(lOOOO, 100, 10

When

12. 120)

10

Returns: $47,554.91

that

This example calculates the futurevalue (accumulated balance) of a


monthly savings plan, if you start with S 10,000 and add $100 every month

typing fractions like


DataBase requires

12,

you type a space before

and after

the

division

symbol.

for 12 years at an annual interest rate of \09c.

Example

2:

futurevalue(lOOOO, 1200, 10, 12)


Returns: $57,045.42

This example calculates the futurevalue (accumulated balance) of an


annual savings plan, if you start with SI 0.000 and add S12(X) every year
for 12 years at an annual interest rate of lO'^. Both examples assume that
installments are always paid at the start of each period.

NOTE: DataBase financial functions


shown below. (The double
power") cannot be used

in

futurevalue = principal

* ((]

(meaning "raise

to the

a query).

(installmentl(ratellOO)) * (({I

Volume

are derived from the formula

asterisks

+ (rate/JOO)) ** periods) +
+ (rate/JOO)) ** periods) -

I)

6-78

DATABASE REFERENCE MANUAL

global

Keyword:

global

Type:

Keyword

See Also: assign, define, temp,


variable

Purpose: The keyword global

variable

is

specifies a global variable.

used to store a value such as a text string or a

calculated result that can change during the processing of a

procedure.

By

specifying the variable's name, the stored

value can be used like any other value

in a

query.

The status of a variable can be global (denoted by the


keyword global) or temporary (denoted by the keyword
temp).

temporary

variable can only hold a value during the

current procedure.

Syntax:

Usage:

global variable can pass

another.

To

variable

must be defined

global

When

its

value from one procedure to

pass a value from one procedure to another, a


identically in each procedure.

variable name
processing a Control procedure that links two or more

Processing procedures, each global variable with the same

name and

type

is

considered the same variable and can pass

value from one procedure to another.

If a Control
procedure requires data retrieved from a relationship, the data
can be obtained in a Processing procedure and stored in a
its

global variable.

Example:

define global

income" Number
Number
"profit" Number

define global "expenses"


define global

"MONTHLY TOTALS"

run procedure

if

global

INCOME >

run procedure

global expenses then

"PAYROLL BONUS"

else

run procedure

"REGULAR PAYROLL"

end

>
6-79

This entry continues on the next page

Volume

DQL LEXICON
global (cont.)

This query

is

a Control procedure that tells DataBase: 1) Create (define)

three global variables called


three different

INCOME. EXPENSES,

numbers while processing

and

the query.

2)

PROFIT to
Run

store

the

MONTHLY TOTALS

procedure. This procedure (shown below)


income and expenses for the month and subtracts the
former to determine the amount of profit. As each of these

calculates the total


latter

totals

from
is

the

calculated,

it

is

assigned to the appropriately

named

global

INCOME variable is greater than the EXPENSES


PAYROLL BONUS procedure using the value stored

variable. 3) If the

variable, run the

in

PROFIT variable to calculate each employee's bonus (a percentage of


the profit based on the employee's salary level). 4) If the INCOME
the

variable

is

not greater than the

EXPENSES

variable, run the

REGULAR

PAYROLL procedure.
The

MONTHLY TOTALS

Example:

Processing procedure looks like

this:

define global "income" Number


define global "expenses" Number
define global "profit" Number

assign global income := sum of INVOICES order


TOTAL with (DATE between 09/01/89 to 09/30/89)
assign global expenses := sum of PURCHASE order
TOTAL with (DATE between 09/01/89 to 09/30/89)
assign global profit := global income
.

global

expenses

end
The key

feature of this

example

is

the fact that the global variables are

identically defined in the Processing procedure

which calculates the value

Control procedure which passes these values


from one Processing procedure to another.

of each variable and

Volume

in the

6-80

DATAEASE REFERENCE MANUAL


Grouping

Keyword: Grouping
Type:

See Also: in groups, in groups


with group totals, Sorting

Concept

Purpose: Grouping

lets

you process records with the same

field value

together.

Usage:

There are two


in

groups and

DQL
in

operators that control grouping:

groups with group-totals.

The

in groups operator causes records with identical field values to be


processed as a single group and the groups are automatically sorted in
ascending order. For example. Democratic Presidents are listed together
as a group followed by the Republican Presidents.

Example

1: for

PRESIDENTS

records
POLITICAL PARTY in groups
LAST NAME in order
FIRST NAME
list

end
The output

is

grouped on the political party

POLITICAL PARTY

DEMOCRATIC

LAST NAME

field

FIRST

(shown

NAME

in bold):

LEXICON

DQL
Grouping

The

in

(cont.)

groups with group-totals operator groups records and generates

statistical totals for

query.

each group

For example,

if

we add

if

any other

new

statistic is

line to the

requested by the

query

in

Example

1;

Grouping operators (in


groups and in groups with
group-totals) always precede
Sortint; operators (in

Example

2: for

PRESIDENTS

and

records
POLITICAL PARTY in groups with group-totals
LAST NAME in order
FIRST NAME
"A" = "A" count
list

end
In this

example, the

line:

"A" = "A"

count

DataBase to count every record that is processed. The count statistic


allows DataBase to also calculate the group total for each political party.
tells

The output includes

the

POLITICAL PARTY

DEMOCRATIC

group

level statistics

LAST NAME

(shown

FIRST

in bold):

NAME

order

in reverse) in the query.

DATAEASE REFERENCE MANUAL


highest of

Keyword:
Type:

highest of

appear as a

list

statistic in the

end of the

Syntax:

highest of

in a related

form.

The

result

can

summary

area at the end of each group or the

FORMNAME RELATIONSHIP
|

[named "UNIQUE

FIELDNAME

[with (selection criteria)]

field.

If a

DataBase returns the highest ASCII


a Choice field is specified, DataBase returns the

field is specified,

value.

If

value in the highest numbered choice (not necessarily the


highest ASCII value).

There's an important
difference between the
statistical

operator

for

CUSTOMERS

max finds

records
LAST NAME in Order

the specified field

record selected, find

highest

this

in the set

of matching

query, arranged

in

highest offinds the highest


value among the records
related to the records being
processed.

the related records in the

(those that have a matching

ORDER TOTAL

The output from

all

all

INVOICES order total

This query tells DataBase: 1) Process all the CUSTOMBRS records and
list each customer's last name in alphabetical order.
2) For each

INVOICES form

among

the records being processed.

end

CUSTOMBRS

of.

the highest value in

list

highest of

max and

the relational statistical

operator highest

Example:

of,

sum of

of,

report.

value of the same type as the specified

Text

any, count

item in the detail area of a report or as a

RELATIONSHIP NAME"]

Returns:

mean

of,

operator finds the highest value in a specified

matching records

field in all

all,

lowest

named

Relational Statistical Operator

Purpose: The highest of

See Also:

customer

INVOICES

3) List the

#).

records.

alphabetical order by

LAST name.

might look as follows:

LAST NAME

HIGHEST OF INVOICES ORDER TOTAL

Adams

$195.00
$225.00
$105.00
$125.00
$ 75.00

Cooper
Evans
Hill

Ivers

you also want to include the highest order total


invoices, change the fourth line of the query to read:
If

highest of

6-83

INVOICES order total

among

this

item

max

group of

Volume

DQL LEXICON
hours

Keyword: hours
See Also: ampm, current,
minutes, seconds, timeampm

Time Function

Type:

Purpose: The hours


expressed

Syntax:

function extracts the hour from a time value

in a

24-hour format.

hours(TIME VALUE)

Returns:

An

integer value from

00

to 23.

Examples: hours(1 2:00:00) (midday)


Returns: 12

hours(23:59:00) (one minute before midnight)


Returns: 23

NOTE: The

parenthesized text above

the time of day only:

it is

(e.g..

midday)

is

to clarifiy

not one of the function'

parameters.

Volume

6-84

DATAEASE REFERENCE MANUAL


if

Command
Command

Keyword:

if

Type:

Procedural

Command

See Also:

command

executes one of two different actions (or

series of actions)

based on whether the specified condition

Purpose: The

if

if Function

is

true or false.

When

processing reaches an

if

the condition that follows the

command. DataEase

keyword

evaluates

if.

The keyword then


If the

specified condition

is

true.

DataEase executes

all

the

keyword then until processing


corresponding end or else command.

actions which follow the

reaches the

condition

If the specified

the corresponding

Syntax:

if

CONDITION
(ACTION

\%

false.

keyword

actions that follow the

DataEase executes

all

is

automatically inserted after


the specified if condition in
High Level Interactive Mode.

the

else until processing reaches

end command.

then
1

ACTION

ACTION

N.l

[else

ACTION
ACTION

ACTION

N.

end

Example

for

CUSTOMERS

highest of INVOICES date < 01/01/80 then


delete records
else
delete records in INVOICES with (date < 01/01/80)
if

end
end

6-85

>

This entry continues on the next page

Volume

DQL LEXICON
if

Command

This query

tells

(cont.)

DataBase:

recent invoice

1980, delete

all

INVOICES

in the related

dated before January

3) If a customer's

record.
1st,

is

CUSTOMERS

For each

1)

most recently dated record

1st,

1980, delete the

most recent invoice

of that customer's

record, find the

form. 2)

is

If the

most

CUSTOMERS

dated on or after January

INVOICES

records dated prior to

1980.

The

end marks the end of the if command that selects


The second end marks the end of the for command

first

delete.

the records to
that selects the

records from the Primary form.

Usage:

query

may

contain multiple

within one another (see

if

Example

commands
2).

nested (indented)

These additional

commands can appear after either then


nested if command is only processed if

if

or else; however, a
the previous condition

is true.

When

if

commands

the last preceding

are nested, the first

if

and each

if

end corresponds to
be matched

command must

command. This rule applies to all


commands (including case, for. if, and
while). See nested actions and the for command entry for
more information on nesting one command inside another.
with a corresponding end

nested Procedural

Example

2: for

INVOICES
if

INVOICES ORDER TOTAL > 500


STATUS
if

:=

in

DATE between 01/01/89


enter a record

copy
end
end

all

then

CUSTOMERS
PREFERRED

modify records

from

in

to current

date then

CATALOG CUSTOMERS

CUSTOMERS

end
This query tells DataEase to divide the INVOICES records into two
groups and process them as follows: 1) The records with an ORDER

TOTAL greater than $500 are modified by changing the value in the
STATUS field to PREFERRED. 2) The records with an ORDER total
greater than 500 and a date between the start of 1989 and today's date
are modified and also copied into the
In this example, the second if

records selected by the

first if

CATALOG CUSTOMERS

form.

command, which selects a subgroup of


command, is nested within the first if

the

command.

Volume

6-86

DATABASE REFERENCE MANUAL


if

Function

Keyword:

if

Type:

Conditional Function

Function
See Also: break, case, for,
else, end, exit, if

Purpose: The

whether the specified condition


have multiple

Syntax:
Returns:

if(CONDITION,

The

is

true or false.

query

may

TRUE VALUE, FALSE VALUE)

the specified condition

if

functions nested within one another.

true value if the specified condition

value

Usage:

if

Command,

nested actions, while, then

function returns one of two specified values based on

if

is

true. JYit false

is false.

Generally, you can specify any type of value you want for the
true value

and

false value parameters.

however. DataBase requires

same type

In certain cases.

that these values

must be

the

as the value returned by the specified condition.

For example:

if(ampm(current time) = "AM"

"in

the morning", "in the

afternoon")
is

acceptable because both the value used

("AM"

or

"PM") and

morning" or

in the

condition

the final value returned ("in the

"in the afternoon

')

are text expressions.

Conversely,
if(12 < hours(current time), "in the morning", "in the
afternoon")

might be prohibited because the value used


a numeric value and the final value
return

If

is

in the

condition

we want DataBase

is

to

a text value.

you have trouble saving

a query that contains an if

function, try changing the type of the true and false values.

6-87

>

This entry continues on the next page

Volume

DQL LEXICON
if

Function (cont.)

Example:

for

CUSTOMERS
list

records

LAST NAME in order


ACCOUNT BALANCE

if(ACCOUNT BALANCE > 500, "YES", "NO")

end
This query
the

tells

DataBase: For each record

LAST NAME and

BALANCE

the

in the

account balance.

field is greater than

value in the

$500, display the value

ACCOUNT BALANCE
NO. The output from

output. If the value in the

CUSTOMERS

If the

field

is

YES

form,

in the report

not greater than

this query, arranged


$500, display the value
alphabetical order by LAST NAME, might look as follows:

LAST

list

ACCOUNT

in

DATABASE REFERENCE MANUAL


import
i

Keyword: import
See Also: install application

Type:

Control

Command

Purpose: The import command imports


database.

It

can be used

a data file into the current

import data

to

at

any point during a

Conffol procedure. After executing the import, the data can be

used

Syntax:

in the

import

same Control procedure.

"IMPORT SPECIFICATION FILENAME"

The import command can only be used

Usage:

to

execute a

The import command

previously defined Import Specification. The filename that

follows the import

command

is

the filename of the Import

name must be eight or fewer characters


Volume 2. Chapter 5,
for information on how an Import

This

Specification.

with no intervening spaces. See

Database

Utilities

Specification

LAN:

On

LAN

is

defined.

(Local Area Network),

if

another user

the

is

currently

this

displayed. DataEase automatically tries to execute

command

you want
time, you must reboot

at brief intervals.

procedure during

When

command.

DataEase displays a Resource Conflict message. While


is

Run

Defined Import (Option 2) on


the Data Import menu. For a
complete e.xplanation of the
Import procedure see Volume
2. Chapter 5. Database
Utilities.

using any resource required by the import

message

fiinctions like selecting

this

the required resource

If

becomes

to abort the

the computer.

available,

DataEase

automatically resumes processing and executes the rest of the


procedure. See

Volume

2,

Chapter

more information on resource


Locking Options.
for

Example:

This query
2)

When

6-89

import "MAILLIST"
run procedure "PRINT

4,

System Administration.

conflicts

and Multi-User

tells

the

LETTERS"

1) Execute the MAILLIST Import Specification.


completed, run the PRINT LETTERS procedure.

DataEase:

impon

is

Volume

DQL LEXICON
in

Keyword:

in

Type:

Keyword

Purpose: The

DataBase

in operator tells

query's Primary form

to use a

when executing

form other than the

list

See Also: delete records,


enter a record, list records,
modify records

records, delete

records, modify records, or enter a record

command.

FORMNAME RELATIONSHIP [named "UNIQUE


RELATIONSHIP NAME"] [with (selection critena)]

Syntax:

in

When

Usage:

the in operator

used without selection

is

DataBase performs the action on


specified form.

all related

you do not specify a

If

criteria,

records

in the

FORMNAME,

DataBase automatically performs the action on the Primary


form. The in operator should not be used
the query's Primary

Example

1: for

form (see Example

CUSTOMERS

conjunction with

modify records

ORDER TOTAL

in

3).

;=

INVOICES
ORDER TOTAL

in

DISCOUNT

end
This query discounts every related INVOICES record each time a
CUSTOMERS record is processed. Since every invoice is related to
only one customer, each record is discounted only once.

Example

2: for

INVOICES

modify records

ORDER TOTAL

:=

INVOICES
ORDER TOTAL

in

DISCOUNT

end
This example demonstrates an INCORRECT use of the in operator.
This query discounts every INVOICES record each time a record is
processed (each invoice is discounted as many times as there are
records to process).

Example

3: for

INVOICES

modify records

ORDER TOTAL

:=

ORDER TOTAL

DISCOUNT

end
This query

The

in

CORRECTLY

keyword

delete records

is

modifies records in the Primary form.


omitted from a list records, modify records, or

command when

the action

is

performed on the Primary

form.

Volume

6-90

DATABASE REFERENCE MANUAL


in

groups

Keyword:

in

Type:

Grouping Operator

groups

Purpose: The

See Also: in groups with


group-totals, in order, in
reverse

groups operator tells DataBase to process all the


same value in the specified field together
and display the report output in a grouped format (e.g.. all the
customers from Connecticut, then all those from New Jersey,
in

records with the

then

those from

all

displayed once

New

at the

York.

etc.).

The group

beginning of the group.

identifier is

If statistics are

specified for any output fields, group subtotals are calculated

but the subtotals are not included in default report output

unless you use the operator in

Syntax:

Usage:

FIELDNAME

HI

groups

in

In a query, an item to

hefore

all

order.

groups with group-totals.

be processed in groups should be

listed

other output items including items to be sorted in

When

a field

sorted in groups, the groups are

is

automatically sorted in order


listed before

(all

Alabama customers

are

any Alaska customers).

Grouping operators cannot be used


relational operator

you cannot use

(i.e.. if

in

INVOICES

conjunction with the


is

the query statement: all

all

the Primary form,

CUSTOMERS

state

in groups).

Example:

CUSTOMERS

for

list

records

STATE in groups
LAST name in order
end
;

This query
the

DataEase:

tells

same value

in the

1)

state

Process

all

the

CUSTOMERS

field together as a group.

records with

2) Display the

group identifier (STATE) once at the beginning of each group. 3) Within


each group, arrange the customers in alphabetical order by last name.

The output from

this

STATE

query might look as follows:

LAST NAME

NJ

Adams

NY

Cooper
Evans

Hill

6-91

The in groups operator can


only he used on list items
/()//( ni//(t,' the list records
command. It cannot he used
\\iih the enter a record,
modify records, or delete
records commands.

vers

Volume

DQL LEXICON
in

groups with group-totals

Keyword:

in

Type:

Grouping Operator

groups with group-totals

Purpose: The

in

groups with group-totals operator groups records and

generates statistical totals for each group


is

Syntax:

Usage:

if

any other

statistic

requested by the query.

FIELDNAME
The group

groups with group-totals

in

identifier

of the group.

only displayed once

is

If statistics

at the

beginning

are specified for any output fields,

group subtotals are calculated and the subtotals are


automatically included

in the default report output.

Grouping operators cannot be used


relational operator

you cannot use


in

Example:

(i.e., if

in

INVOICES

conjunction with the


is

the

CUSTOMERS

the query statement: all

all

Primary form,

STATE

groups with group-totals).


for

CUSTOMERS

list

records

STATE in groups with group-totals


LAST NAME in order
ACCOUNT BALANCE item sum

end
This query tells DataBase: 1) Process all the CUSTOMERS records with
the same value in the STATE field together as a group. 2) Display the
group identifier (STATE) once at the beginning of each group. 3) Within
each group, arrange the customers in alphabetical order by LAST NAME.
4) List each customer's ACCOUNT balance, the subtotal for each STATE
group, and the sum of all the account balance amounts combined.
The output from this query might look as follows:

STATE
NJ

LAST NAME

ACCOUNT BALANCE

DATABASE REFERENCE MANUAL


in

order

Keyword:

in

Type:

Sorting Operator

order

Purpose: The

in

order operator

DataEase

tells

to process records

and

display the report output in sequence from lowest to highest

value in the specified field, (e.g. 0101

01013.

Syntax:

FIELDNAME

Usage:

The

in

1.

before 01012, before

etc.).

order

in

order operator can be used on any type of

Number

Time. Date, or

field is

ordered from lowest to

highest value.

sorted in alphabetical order.

Text

tleld

is

Choice

field

is

field.

sorted by

Choice number.

Sorting operators cannot be used in conjunction with the


relational operator (e.g..

you cannot use


all

Example:

INVOICES

is

all

the Primary form,

the statement:

CUSTOMERS

for

if

INVOICES

LAST NAME

in order

records

list

STATE
ZIP

in

in

groups

order

LAST NAME

in

order

end
This query

tells

DataEase:

1)

Process

all

the

CUSTOMERS

records with

same value in the ST.ATE field together as a group. 2) Display the


group identifier state once at the beginning of each group. 3) Within
the

each group, arrange the customers in lowest to highest zip code order.
4) Within each zip code, arrange the customers in alphabetical order by

last name.

The output from

STATE
NJ

this

query might look as follows

ZIP

CODE

LAST NAME

DQL LEXICON
in

reverse

Keyword:

in

Type:

Sorting Operator

reverse

Purpose: The

in

reverse operator

tells

DataBase

to process records

and

display the report output in reverse sequence from highest to

lowest value

in the specified field, (e.g.,

before 01011,

Syntax:

Usage:

FIELDNAME

The

01013 before 01012,

etc.).

in

reverse

can be used on any type of

in reverse operator

field.

Time, Date, or Number field is ordered from highest


A Choice field is ordered from highest to

to

lowest value.

lowest Choice number.

Text

field

is

sorted in reverse

alphabetical order.

Sorting operators cannot be used in conjunction with the


relational operator (e.g.,

you cannot use


all

Example:

LAST NAME

CUSTOMERS
list

INVOICES

is

the

all

Primary form,

the statement:

CUSTOMERS

for

if

in reverse

records

STATE

in

groups

ZIP in reverse

LAST NAME

in

order

end
This query tells DataEase: 1) Process all the CUSTOMERS records with
the same value in the STATE field together as a group. 2) Display the
group identifier state once at the beginning of each group. 3) Within
each group, arrange the customers in highest to lowest ZIP code order.
4) Within each zip code, arrange the customers in alphabetical order by
LAST NAME.. The output from this query might look as follows:

STATE

DATAEASE REFERENCE MANUAL


input

Keyword:

input

Type:

Processing

See Also: data-entry, record


entry, current status

Command

Purpose: The input command provides


but allows

DQL

into the database.

Syntax:

input using

In the

all

the facilities of record entry

to process records before they are entered


It

can be used

FORMNAME

into

any point

at

in a

procedure.

"TEMPFORM"

In Interactive

syntax, FORMNAME is the name of


TEMPFORM is the name DataEase uses

command

input

the database form.

Mode. DataEase

automatically inserts the word


using after input and the word
into after the name of the
record entry form.

an input record. You can assign any name you


want for this purpose except the name of another form in the
same database. Thefirsr time that the TEMPFORM name is
specified in the query, it must be enclosed in quotation marks.

to reference

number of input commands you can


however, each database form must be
assigned a unique TEMPFORM in the input statement.

There

is

no

limit to the

use in a query;

Usage:

The input command


record entry form.

tells

When

DataEase

to display a specified

the specified

form

displayed, you

is

can either enter or modify a record (in Form View), or scroll


through the form (in Form or Table View) and select any
existing record. You can also use the FIO MULTI key to

view records

in related

forms.

When you press a processing key (ESC, F2 SAVE,


F7 DELETE, or F8 MODIFY), the input record is copied
memory and
is

number

that

Current Status Values


into

corresponds to the processing key


DataEase then

stored in the current status variable.

resumes processing the procedure, using the input record data


The current

just like values entered in a data-entry form.

status value can be used to control subsequent processing.

The input command can only hold one record


under a given

TEMPFORM

name

at

a time.

in

If

memory

you want

to

command, set
variable. To enter an

process more than one record using the input

up a loop using the the current status


input record into the database, you must use the enter a
record command in the query (see Example 2).

in memory, the form


must be displayed in Form View when a processing key is
pressed. Table View is used for selection purposes only.

Since input can only hold one record

>

This entry continues on the next page

Key Pressed

LEXICON

DQL
input (cont.)

Example

1: input
for

using

CUSTOMERS

into

"TEMPCUST"

INVOICES
(CUSTOMER* =

with

TEMPCUST customer

#)

records
INVOICE #

list

ORDER TOTAL
DATE
end
This quer>'

tells

all

the

in the

CUSTOMERS form. 2) When


CUSTOMERS record and presses F2. store that
the name TEMPCUST to reference
3) Find

DataEase: 1) Display the

the user selects a specific

record in

memory

(using

INVOICES

TEMPCUST

it).

records with the same

# as the

record. 4) For each related invoice,

and the ORDER TOTAL. The output from

INVOICE* ORDER TOTAL


A1 17095

CUSTOMER
this

DATE

list

CUSTOMER

the

invoice #

query might look as follows:

DATAEASE REFERENCE MANUAL


input (cont.)

When van press a process ini;


key (ESC. F2. F7. or FS). the
input record is copied into
memory and tlie appropriate
value is stored in the current
status variable. The current
status value can then he used
to control subsequent
processing.

current status = 3. (the user pressed F8 MODIFY when the input


record was on the screen), modify the record in the CUSTOMERS form
If

CUSTOMER*

Unique field) that is the same as the CUSTOMER* on


current status = 4. (the user pressed F7 DELETE
when the input record was on the screen), delete the record in the
CUSTOMERS form with a CUSTOMERS (a Unique field) that is the same
as the CUSTOMER* on the input record. 3) Display the CUSTOMERS
form again so the operator can enter, modify, or delete another record.
with a

the input record.

Example

(a

If

3: while current status not =

CUSTOMERS

input using
case (current status)

value 1
value 2

break

do

into

"TEMPCUST"

TEMPCUST customer code


enter a record in CUSTOMERS
copy all from TEMPCUST
:

if

<= 20 then

else

message

"Invalid

Code, Re-enter the record."

end
others

message "You are

not authorized to modify

or delete records."

window

end
end
This query tells DataEase: 1) Display the CUSTOMERS form. 2) Each
time the user enters a record and presses a processing key, check the value
of the current status variable. If current status = 1 (ESC), stop query
processing without entering a record in the CUSTOMERS form. If
current status = 2 (F2 SAVE), verify that a valid customer code

(<= 20) was entered in the input record.


record into the CUSTOMERS form. If it

valid,

copy

the input

If

it

is

not valid, display an error

is

message. If current status = 3 or 4 (F8 MODIFY or F7 DELETE),


display a message telling the user that he/she is only authorized to enter
records. 3) Display the
form again so the u.ser can enter

CUSTOMERS

another record.

Using the input

When

Command

using the input

with Multiforms

command on

a Multifomi. DataEase treats Main


forms and Subforms differently. If you enter, modify, or delete a Main
form record, the information is copied into the specified temporary fomi
where it can be validated and processed by the query.

you enter or modify a Subform record, however, the new or modified


is entered directly into the Subform in the database. This is
because DataEase is unable to hold all of the entered or modified Subform
records in memory (up to 5000 Subfomi records can be entered or
modified at once) and still continue processing the query.
If

record

-^

6-97

This entry continues on the next page

When you use the input


command to enter, modify,

or

delete records in a Multiform,

DataEase treats Main form


and Subform records
differently. If you enter,
modify, or delete a Main form
record,

it

is

copied into the

specified temporary form. If


you enter or modify Subform

records, however, the new or


modified records are entered
directly into the Subform.

Volume

LEXICON

DQL
input (cont.)

If the user presses F2 SAVE to enter a Multiform record, you can use
enter a record to enter the record into the Main form (the Subform
records were automatically entered when the user pressed F2). If the
query tests the Main form for validity (e.g., CUSTOMER CODE <= 20 in

Example 3) and it fails, you must use delete records to remove the
Subform records that were entered when you pressed F2 SAVE.
If the

user presses

F8

MODIFY

to

modify

Multiform record, you can

use modify records to modify the

Main form record, (the Subform


records are automatically modified when the user pressed F8). If the
query tests the Main form for validity (e.g., CUSTOMER CODE <= 20 in
Example 3) and it fails, it is up to the user to remember which Subform
records were modified and then go back to the Subform and undo the
modifications. DataBase cannot automatically undo modified Subform
records.

you delete a Multiform record using the input command, the records
from the form. You must use the query to verify
that a valid record was entered and then use delete records to explicitly
delete the appropriate Main and Subform records.
If

are not directly deleted

Example

4: while current status not = 1


input using INVOICES into

case (current
value 1
value 2

status)

break
if

do

"TEMPINVOICE"

TEMPINVOICE customer code <= 20

enter a record

copy

all

from

message

in

then

INVOICES

TEMPINVOICES

Code, Re-enter the record."


delete records in INVOICE LINE ITEMS with
(INVOICE NUMBER = TEMPINVOICE INVOICE NUMBER)
end
others message "You are not authorized to modify or
or delete records. If you have modified records,
you must manually delete the modifications." window
end
end
else

"Invalid

DataBase: 1) Display the INVOICES form. 2) Each time


and presses a processing key, check the value of
the current status variable. If current status = 1 (ESC), stop query
processing without entering a record in the INVOICES form. If current
status = 2 (F2 SAVE), verify that a valid customer code was entered in
the input record. If it is valid, copy the input record into the INVOICES
form. If it is not valid, display an error message and delete the records

This query

tells

the user enters a record

were automatically entered in the Subform (INVOICE LINE ITEMS).


current status = 3 or 4 (F8 MODIFY or F7 DELETE), display a
message telling the user that he/she is only authorized to enter records.
3) Display the INVOICES form again so the user can enter another record.
that
If

Volume

6-98

DATAEASE REFERENCE MANUAL


install

appi

Keyword:

install

Type:

Control

Purpose: The

appI

(install application)

See Also: import, reorganize

Command

install

procedures

command

appI
in the

you

lets

When

application in the current database.

Syntax:

to specify the

of the Installation File.

install

appI

"INSTALLATION FILENAME"

The filename

that follows the install

filename of the Installation

LAN:

new DataEase

processing reaches

command. DataEase asks you

an install appI

name

replace forms or

install or

current database or install a

appI

Command

command

is

the

This name must

file.

command

be eight or fewer characters with no intervening spaces. See

The

Volume 2. Chapter 3. Database Utilities


on how applications are installed.

functions like selecting;


Install DataEase Application
on the Install/Convert
Application menu. For a
complete explanation of the
Installation procedure, see

On

LAN

(Local Area Network),

if

more information

for

another user

using any resource required by the install appI

is

currently

command,

DataEase displays a Resource Conflict message. While

message
the

is

Volutne

displayed. DataEase automatically tries to execute

command

at brief intervals.

procedure during

When

this

If

you want

install

2.

Database

appl

Chapter

5.

Utilities.

to abort the

you must reboot the computer.

this time,

becomes

the required resource

available.

DataEase

automatically resumes processing and executes the rest of the

procedure. See
for

Volume

2,

Chapter

more information on resource

4.

System Administration,

conflicts and Multi-User

Locking options.

Example:

This query
disk

in

appI "A: CATALOG"


run procedure "MAILLIST"
install

tells

DataEase:

CATALOG

drive A: into the current database.

installed, run the

6-99

1) Install the

MAILLIST

2)

When

application from the


the

new

application

is

procedure.

Volume

LEXICON

DQL
installment

Keyword:

installment

Type:

Financial Function

See Also: futurevalue,


periods, presentvalue, rate

Purpose: The installment

function calculates the periodic installment

payment required

for a financial transaction given the

presentvalue, futurevalue, interest rate, and number of

payment periods.

Syntax:

installmenl(presentvalue, futurevalue, rate, periods)

Returns:

numeric value (the installment payment amount).

Usage:

If

the installment

investment

(e.g.,

the function

is

payment increases the value of

the

an annuity), the numeric value returned by

expressed as a positive amount.

decreases the value of the investment

(e.g.,

the numeric value returned by the function

negative amount. The interest

If the

payment

loan amortization),
is

expressed as a

rate, installment

payments, and

time periods must be based on the same terms. For example,


if payments are made monthly on a five-year loan, the
number of periods is 12 * 5) or 60. The interest rate must be
expressed in the same terms (the monthly interest rate is the
(

annual rate

Examples:

/1 2).

installment(15000,
Returns: -318.71

0,

10

12,

60

When

10

typing fractions like


DataBase requires

12.

you type a space before


and after the division symbol
that

This example calculates the monthly installment payment required to pay


off a $15,000 loan in 5 years at an annual interest rate of 10%.

installment(0, 15000, 10
Returns: 193.71

12, 60)

This example calculates the monthly installment amount required to


accumulate $15,000 in 5 years at an annual interest rate of 10%.

NOTE: DataBase financial functions


shown below. (The double
power") cannot be used

in

are derived from the formula

asterisks

(meaning "raise

to the

a query).

futurevalue = principal * ((I + (rate/100))) ** periods) +


(installmentl(ratellOO)) * (((I + (rate/100)) ** periods) - 1)

Volume

6-100

DATAEASE REFERENCE MANUAL

item (Statistical Operator)

Keyword: item
Type:

Statistical

See Also: max, min, mean,


std.dev., std.err., sum,
variance, ami also the item

Operator

Purpose: The item

statistical operator tells DataBase to display the


specified field value from each processed record in addition to
any specified statistics. The result appears as a list item in the

coihlitional slatistical

opeialor.

detail area of a report.

Syntax:

fieldname

Usage:

item [other statistical operators]

Quick Report, each specified

In a

included

in the report output.

field value is automatically

In a

DQL

Procedure,

if

other statistics are specified for a field, the field value

automatically included

in the report output.

name

Example:

for

is

is only included
followed by the item operator.

CUSTOMERS

is

If statistics

specified on a field, the field value


field

no

if

the

list

ACCOUNT BALANCE

item min

max sum

end
This query

tells

DataBase:

alphabetical order by

BALANCE

(item).

the largest

balance

1)

Process

last name.

the

CUSTOMERS

3) List the smallest

account balance

account balance

(max). 5) List the


amounts combined (sum).

The output from

LAST NAME

this

total

of

records

in

ACCOUNT
(min). 4) List

all

the

an important

operator and the


item conditional statistical
operator. The item
statistical operator tells
DataBase to include the list
item in the report output
when other statistics are
specified. The item
conditional statistical
operator tells DataBase to
evaluate a cotnparison and
return a YBS or NO answer
indicating if the comparison
is true or not.

.account

query might look as follows:

ACCOUNT BALANCE

Adams
Cooper
Evans
Hill

Ivers

MINIMUM ACCOUNT BAlANci


MAXIMUM ACCOUNT BALANCE
SUM ACCOUNT BALANCE

6-101

all

2) List each customer's

is

statistical

are

records
LAST NAME in order

There

difference between the item

$595.00
$725.00
$865.00
$525.00
$675.00
^$52~5"oO

$865 00
$3 385 00

Volume

LEXICON

DQL

item (Conditional Statistical Operator)

Keyword: item
Type:

Conditional Statistical Operator

Purpose: The item

conditional statistical operator returns a yes or

answer indicating

if

the specified

COMPARISON STATEMENT

Syntax:

Usage:

In a query, the

item operator

comparison

is

item

is

placed after a

list

item that

compared to a specified value. The item operator


from the comparison by a colon.

Example:

for

CUSTOMERS

no

true or false.

is

is

separated

records
LAST NAME in order
list

ACCOUNT BALANCE item min max sum


ACCOUNT BALANCE > 500 item
:

end
This query

tells

DataBase: 1) Process

alphabetical order by

BALANCE

(item).

LAST NAME.

all

the

CUSTOMERS

3) List the smallest

ACCOUNT balance

records in

ACCOUNT

2) List each customer's

(min). 4) List

ACCOUNT BALANCE

(max). 5) List the total of all the ACCOUNT


BALANCE amounts combined (sum). 6) For each customer specify a yes
or no answer indicating if the customer's ACCOUNT BALANCE is
greater than $500 (item conditional statistical operator).
the largest

The output from

this

query might look as follows:

LAST

ACCOUNT

NAME

BALANCE

Adams

ACCOUNT BALANCE
OVER 500

DATABASE REFERENCE MANUAL


jointext

Keyword:

jointext

Type:

Text Function

Purpose: The

See Also: firslcfirstlast,


firstw, lastc, lastfirst, lastw,
length, lower, midc, midw,
proper, textpos, upper

jointext function combines two separate text values into

one.

Syntax:

jointext(TEXT

Returns:

Usage:

When two

text value

VALUE1, TEXT VALUE2)

up

to

255 characters

in length.

text values are joined, leading spaces are

maintained but trailing spaces are deleted.

more

fields,

To

join three or

you can use additional jointext functions

as

either or both parameters.

Examples:

jointext("Data", "Ease")

Returns: DataBase
jointext(jointext("Data", "Ease"),
Returns; DataBase International
In the above example, there
the string International.

is

"

International")

a space at the

start of

jointext{PRODUCT, " 16M")


Returns: DataBase 16M
In the

above example, there

PRODUCT

6-103

is

field holds the value

a space at the start of the string

I6M. The

DatuEase.

Volume

LEXICON

DQL
Julian

Keyword:

julian

Type:

Date Function

See Also: current, day, date,


month, spelldate, spellmonth,
spellweekday, year, yearday,

yearweek

Purpose: The
Syntax:

julian function converts a date value to a Julian date.

julian(DATE

Returns:

five-digit integer in the format

YY

Usage:

VALUE)

the

are the last

day

in the

= 365, except

two

YYDDD.

digits of the year.

year (with January


in leap

year

when

1st
it

is

DDD

is

the position of

= 001; and December

31

366).

Examples: julian(07/04/89)
Returns: 89185
julian( 12/31/89)

Returns:

Volume

89365

6-104

DATAEASE REFERENCE MANUAL

Keywords
Keyword: Keywords
See Also: blank, current,

Type:

data-entry, do, else, global, in,


into, others, temp, then,

Concept

Purpose: Keywords

are used to signal special operations such as

using, value

creating variables, performing conditional actions, or


retrieving values

Usage:

In interactive

from

Mode,

inserted in the query

There are thirteen

DQL

a Data-entry form.

certain

keywords are automatically

where required.

keywords

as specified below:

blank returns a

current tells DataBase that you want to access one of the eight
current system variables (date, time, page number, item number, user
name, user level, computer name, or status).

data-entry tells DataBase


on the Data-entry form.

do

tells

null (unspecified value).

to use the value

found

in

the specified field

DataBase what actions

to

perform when the condition

command

is

true.

specified by a while
else tells

DataBase what actions

specified by an

if

command

to

perform when the condition

\s false.

global identifies a global variable.

in tells

DataBase

to enter, delete,

list,

or modify records in a form

other than the Primary form.


is used with the input command
temporary destination form.

into

others

temp

then

name

tells DataBase what actions to perform when


value statements in a case command dre false.

identifies a

all

of a

the preceding

temporary variable.

tells DataBase what actions to perform


specified by an if command is Hue.

using

is used with the input


database source form.

command

when

the condition

to specify the

name of the

value is used with the case command to specify each of the


comparison values to which the ca.se expression is compared.

For a

to specify the

explanation of any of the


Lexicon.

full

in this

6-105

DQL

keywords, see the separate entry

Volume

DQL

LEXICON

lastc

Keyword:

lastc

Type:

Text Function

See Also: firstcfirstlast,

Purpose: The

lastc function extracts a specified

from the end

Syntax:

firstw,jointext, lastfirst,
lastM\ length, lower, midc,

lastc(TEXT VALUE,

Returns:

Usage:

lastci

text value

characters

midM.',

proper, textpos,

upper

n)

n characters

FIELDNAME.

in length.

returns the last non-hlank character in

the field. Trailing spaces are ignored.

characters

number of

(riahtl of a text value.

in the field, lastc

Examples: lastcC'DataEase",
Returns: Ease

4)

lastcC'New User",
Returns: User

4)

If there are

n or fewer

returns the original text value.

laStC(FIRST NAME. 4)
Returns: The last four characters in the first name
field for every record that is processed. If the first
NAME field contains the value Sherlock, the function
returns lock.

Volume

6-106

DATABASE REFERENCE MANLAL


lastfjrst
I

Keyword:

lastfirst

Type:

Text Function

Purpose: The

lastfirst function converts a text value

from the format:

Name [MJ Last Name to the format: Last Name,


Name [M.J. The [M.J is an optional middle initial.
First

Syntax:
Returns:

lastfirst(TEXT

See Also: firslcfirsllasl,


firstwjoinlext, lastc, laslw,
length, lower, midc, midw,
proper, textpos, upper

First

VALUE)

text value.

The contents of the field are rearranged so that the last word
(i.e.. the last name) becomes the first word in the returned
value.

Usage:

A comma

automatically inserted after the

is

The name of

this function

the format in

which

Examples: lastfirst(Susan

the

B.

and the

names

last

name.

firstlast function refer to

are stored in a sinale field.

Anthony)

Returns: Anthony, Susan B.


lastfirst(T.S. Eliot)

Returns:

Eliot,

T.S.

lastfirst(FULL name)

Returns: The value in the full name field in the format


shown above for every record that is processed.
a
record contains the value Sherlock Holmes in the full
If

NAiviE field,

6-107

the function returns Holmes, Sherlock.

Volume

DQL

LEXICON

lastw

Keyword:

lastw

Type:

Text Function

Purpose: The lastw


the

Syntax:

end

function extracts a specified

(right)

of a text value.

lastw(TEXT VALUE,

n)

Returns:

Usage:

lastw(FIELDNAME,

text value

number of words from

See Also: firstcfirstlast,


firstwjointext, lastc, lastfirst,
length, lower, midc, midw,
proper, textpos, upper

n words

in length.

n) returns the last

n words

in the field

including intervening spaces and punctuation symbols.


Trailing spaces are ignored.

If there

are n or fewer

words

in

the field, lastw returns the original text value.

Examples:

lastw("DataEase International,
Returns: International,

lastw("New User",
Returns: User

1)

laStW(BOOK
Returns the

2)

TITLE,

Inc.", 2)

Inc.

two words in the book title field for


every record that is processed. If a record contains
last

the value The Hound of the Baskervilles in the book


TITLE field, the function returns the Baskervilles.

Volume

6-108

DATABASE REFERENCE MANUAL


length

Keyword:

length

^
^
Text Function

Type:

Purpose: The length

function counts the

number of character

positions

See Also: firstcfirstlast.


firstwjointext, lastc, lastfirst,
lastw, lower, midc, midw,
proper, textpos, upper

in a text value.

Syntax:

length(TEXT VALUE)

Returns:

An

Usage:

The length function counts leading and intervening

integer value.

spaces.

Trailing spaces are ignored.

Examples:

length("DataEase International,
Returns: 28

Inc.")

length("New User")
Returns: 8

length(coMPANY name)
Returns: The number of characters

in the company
NAME field for every record that is processed.
the
COMPANY NAME field Contains the value DataBase
If

International, Inc., the function returns 28.

^-'^^

Volume

LEXICON

DQL
list

records

Keyword:

list

Type:

Processing

records

Purpose: The

Command

records

list

See Also: delete records, enter


a record, modify records,
output

command

tells

DataBase which items

to

display in the report output for each record processed by the

query. These items are called

Syntax:

records

list

in

Each
last,

list

list

is

followed by a period. Values specified

command

with report
the

[named "UNIQUE

[with(selection criteria)]

item must be followed by a semicolon except the

which

records

items.

FORMNAME RELATIONSHIP

RELATIONSHIP NAME"]

Usage:

lisr

The

in a list

by inserting the appropriate operator

after

for

CUSTOMERS
records

indicate you have no

sum

selection criteria.

This query tells DataEase: 1) Process all the CUSTOMERS records with
the same value in the st.ate field together as a group. 2) Display the
group identifier (STATE) once at the beginning of each group. 3) Within
each group, arrange the customers in alphabetical order by LAST NAME.

account balance

(item).

5) List subtotals of

each STATE group (in groups with

6) List the smallest ACCOUNT balance (min). 7) List


ACCOUNT BALANCE (max). 8) List the sum of all the ACCOUNT
balance amounts combined (sum). The output might look like this:
largest

STATE

records
automatically

list

inserted in the queiy

end

statistic for

the

command is
;

4) List each customer's

Low Level Interactive

Mode,

STATE in groups with group totals


LAST NAME in order
ACCOUNT BALANCE item min max

group-totals).

Low Level

item.

list

each specified

command is

query.

In

Example:

records

available in a

can be sorted, grouped, or summarized

statistics

list

the only output option

the

when you
more

DATAEASE REFERENCE MANUAL


lock

Keyword:

lock

Type:

Processing

See Also: lock db, query


selection, unlock, unlock db

Command

Purpose: The lock command


on a

LAN

is

when using DataBase


The lock command prevents

only functional

(local area network).

users from viewing, modifying, adding, or deleting data in

forms and records being used by a report/procedure.

The lock command

overrides the default Multi-User Locking

Rules assigned by the database administrator.


override the default locking rules, the

query must be either lock


neither of these

appears

the default locking rules govern

command

or unlock

Usage:

lock

order to

at the start

LAN

in the

If

of the query,

functioning until a lock

query.

unlock commands are automatically terminated

All lock and

end of a query.

at the

Syntax:

appears

In

statement of the

or unlock all files.

all files

commands

first

all files

The lock
query.

filename

all files

selected record [shared|exclusive]

command

locks

Users can view records

forms referenced by the

all

in the

locked forms but cannot

add. delete or modify data in these forms.

The lock

file

command

locks the specified form for the

duration of the procedure or until the


in

an unlock

command. When an

same form

is

specified

individual form or record

is

locked, you must also specify the type of lock (shared or


exclusive).

Shared

lets

other users view records

in

the locked

form but prohibits them from entering, modifying, or deleting


records

in that

form.

Exclusive prevents

all

access to the

locked form, including viewing records.

The lock

selected record

except

only locks the record that

it

processed.

When DataBase

command

file

currently being

this

command

it

is

only within a for

loop (see
2). If you use it outside a for
no records are selected: therefore nothing is locked.

->

6-111

functions like lock

is

finishes processing a record,

Use
Example

automatically unlocked.

loop,

command

This entry continues on the next page

Volume

LEXICON

DQL
lock (cont.)

Example:

lock
for

file

INVOICES shared

CUSTOMERS

(sum

with

of

INVOICES order

TOTAL > 500)


records
LAST NAME;
list

ACCOUNT BALANCE

end
This query

tells

DataBase:

1)

Lock

the

INVOICES form so other users can


INVOICES records during

view records but cannot add, delete or modify


the processing of this report.

whose

related

than $500.

INVOICES

CUSTOMERS

2) Select all the

records have a combined

3) For each record selected,

list

records

ORDER TOTAL

the customer's

greater

LAST NAME

and ACCOUNT balance.


Notice

that locking the

INVOICES form

report prevents other users from entering

sum

of calculation

Example

2: for

during the processing of this

new

records that might alter the

field.

CUSTOMERS

lock selected record shared

records
LAST NAME

list

ACCOUNT BALANCE
mean of INVOICES order total
;

end
This query tells DataBase: 1) Select all the CUSTOMERS records.
2) Lock each record as it is selected so other users can view it but cannot
add, delete or modify the record while it is being processed. 3) For each
record selected, list the customer's last name, account balance, and
the mean ORDER total of all the related INVOICES records.
In this example,

record that

is

all

the

CUSTOMERS

records can be modified except the

currently being processed.

For more information on DataBase LAN configuration and the Multi-User


Locking Rules, see Volume 2, Chapter 4, System Administrarion.

Volume

6-112

DATABASE REFERENCE MANUAL


lock

db

Keyword:

lock

Type:

Control

Purpose: The

db

(lock database)

See Also: lock, query


selection, unlock, unlock db

Command

lock

db command

DataBase on a

LAN

is

only functional when using

(local area network).

This

command

completely prohibits other users from accessing the current


database.

Syntax:

lock

db

The lock db command can be used

Usage:

to preserve the integrity of

data during an extended Control procedure or to prevent a

when

conflict

installing a

new

or revised application into the

database.

There

The lock db Control command

command

in several

differs

is

an important

difference between the lock


Processinii command and the

from the lock Processing

ways:

lock db Control

command.

The lock Processing


1

2.

It

locks the whole database rather than specified forms or

command can

lock individual

individual records.

forms or records during a


Processing procedure and

no shared option for the lock db command: no


other user can view records or access any form in the

other users view these


resources. The lock db
command locks the whole
database and prohibits other

There

database for any purpose.

users any accesss to


3.

The lock db command


at the

is

db command,

command
command

is

it

remains locked

executed, or the user

exits

it.

nor automatically terminated

end of the procedure. Once a database

the lock

still

let

is

who

until

is

locked by

an unlock db

initiated the lock

db

from DataBase.
This entry continues on the next page

6-113

Volume

DQL LEXICON
lock

db

LAN:

(cont.)

On

LAN

(local area network), if another user is currently

using any resource required by the lock

db command,

DataBase displays a Resource Conflict message. While

message
the

command

at brief intervals.

procedure during

When

this

displayed, DataEase automatically tries to execute

is

this time,

the required resource

If

you want

to abort the

you must reboot the computer.

becomes

available, DataEase

automatically resumes processing and executes the rest of the

Volume 2, Chapter 4, System Administration,


more information on resource conflicts and Multi-User

procedure. See
for

Locking Options.

Example:

lock db
run procedure
run procedure
.

unlock db
This query

tells

"CALCULATE DISCOUNT"
"PRINT INVOICES"

DataEase:

1)

CALCULATE DISCOUNT

Lock

the current database.

procedure. 3)

Run

the

2)

Run

the

PRINT INVOICES

procedure. 4) Unlock the database.

Volumes

6-114

DATABASE REFERENCE MANUAL


log

Keyword:

log

Type:

Scientific Function

See Also: exp, log 10, power,

Purpose: The

sqrt

log function computes the natural base e logarithm of a

numeric value.

Syntax:
Returns:

Examples:

log(NUMERIC VALUE)

numeric value.

I
log(3)

Returns:

1.098612

log(0.5)

Returns:

6-115

-0.693147

Volume

DQL LEXICON
Iog10

Keyword:

loglO

Type:

Scientific Function

See Also: exp, log, power, sqrt

Purpose: The loglO

function computes the

common

base 10 logarithm

of a numeric value.

Syntax:

ioqioinumeric value)

Returns:

numeric value.

Examples: Iog10(3)
Returns:

0.477121

Iogl0(0.5)
Returns; -0.301031

Volume

6-116

DATABASE REFERENCE MANUAL

lower

Keyword: lower
Type:

See Also: firstc,firstlast,


flrstwjointext, lastc, lastfirst,

Text Function

Purpose: The lower

function converts each letter in a specified text

lastw, length, midc, midw,


proper, textpos, upper

value into lowercase type.

Syntax:
Returns:

lower(TEXT VALUE)

The

specified text value with

ail

the letters in lower case.

Examples: lower("DataEase")
Returns: dataease

lower("Washington D.C.")
Returns: Washington d.c.
IOWer(LAST NAME)
Returns the value in the last name field in lowercase
type for every record that is processed. If a record
contains the value HOLMES in the last name field,
the function returns holmes.

6-117

Volume 3

DQL

LEXICON

lowest of

Keyword:

lowest of

Type:

Relational Statistical Operator

See Also:
highest
of,

Purpose: The lowest of operator


specified field in

The

result

all

all,

of,

any, count

min,

mean

of,

of,

sum

named

finds the smallest value in the

matching records

can appear as a

list

item

in a related

in the detail

form.

area of a

report or as a statistic at the end of each group or at the

end of the

report.

FORMNAME RELATIONSHIP [named "UNIQUE


RELATIONSHIP NAME'T [with (selection criteria)] FIELDNAME

Syntax:

lowest of

Returns:

value of the same type as the specified field.

field

is

specified,

Text

If a

DataEase returns the lowest ASCII value.

There's an important
difference het^'een the

Choice field is specified. DataEase returns the value in


the lowest numbered choice (not necessarily the lowest ASCII

statistical

value).

min

If a

Example:

for

CUSTOMERS

operator min and

the relational statistical

operator lowest

of.

returns the lowest value

in the specified field

among

the records being processed.

records
LAST NAME in order
lowest of INVOICES order total
list

lowest of returns the lowest


value in the specified field
among the records related to
the records being processed.

end
This query tells DataEase: 1) Process all the CUSTOMERS records and
list each customer's LAST name in alphabetical order. 2) For each
CUSTOMERS record selected, find the related records in the INVOICES
form (those that have the same CUSTOMER #). 3) List the lowest ORDER

total

for

each customer

The output from

in the set

of matching

this query arranged


might look as follows:

LAST NAME

in alphabetical order

records.

by last name,

LOWEST OF INVOICES ORDER TOTAL

Adams

$15.65
$22.40
$18.10
$12.50
$17.25

Cooper
Evans
Hill

Ivors

If

INVOICES

you also want

to include the smallest

ORDER TOTAL among

this

group of

invoices, change the fourth line of the query to read:

lowest of

Volume

INVOICES order total

item min

6-118

DATABASE REFERENCE MANUAL

max
Keyword: max
Type:

Statistical

See Also: item, highest of,


min, mean, std.dev., std.err.,
sum, variance

Operator

Purpose: The max operator finds the highest value in a


among all the records that are processed. The
in the statistical summary areas of the report.
Syntax:
Returns:

VALUE max
:

result appears

[other statistical operators]

value of the same type as the specified value. If the

specified value

ASCII

Usage:

specified field

max

is

Text

field,

max

returns the highest

value.

finds the highest value in the specified field

among

the

records being processed, highest of finds the highest value in


the specified field

among

the records related to the records

being processed.

Example:

for

CUSTOMERS
list

There's an important
difference between the
statistical

operator

operator highest

max finds
with

account balance > 500

records

LAST NAME in Order


account balance

item

max sum

end
This query tells DataBase: 1) Process all the CUSTOMERS records that
have a value greater than 500 in the account balance field. 2) List the
customers by LAST name in alphabetical order. 3) List each customer's

max and

the relational statistical


of.

the highest value in

the specified field

among

the

records being processed.


highest offinds the highest
value in the specified field
among the records related to
the records being processed.

account balance and include the largest account balance amount


all the account balance amounts in the report output.

and the sum of

The output from

LAST NAME

this

query might look as follows:

ACCOUNT BALANCE

Adams
Cooper
Evans
Hill

Ivers

MAX ACCOUNT BALANCE


SUM ACCOUNT BALANCE

6-119

$595.00
$725.00
$865.00
$525.00
$675.00
^$865.00'

$3385.00

Volume

DQL

LEXICON

mean
Keyword: mean
See Also: item, max, min,

Type:

Statistical

mean

Operator

of, std.dev., std.err.,

sum, variance

Purpose: The mean operator finds the average value in a specified


field among all the records that are processed. The result
appears in the statistical summary areas of the report.
VALUE mean

Syntax:

[other statistical operators]

Returns:

Usage:

The mean operator

numeric value.
calculates the average of

the specified field (the

number of values
calculation.

sum of

processed).

all

the values in

the values divided by the

Blank

fields are ignored in the

Fields that have a value of zero are included in

the calculation.

Example:

for

CUSTOMERS

with

records
LAST NAME in order

ACCOUNT BALANCE > 500

statistical

and

tile

operator

Item

mean sum

end

mean

relational statistical

mean of.
mean finds the average value
in the specified fie Id among
operator

the records being processed.

mean offinds

list

ACCOUNT BALANCE

There's an important
difference between the

the average

value in the specified field


among the records related to
the records being processed.

This query tells DataBase: 1) Process all the CUSTOMERS records that
have a value greater than 500 in the ACCOUNT balance field. 2) List the
customers by last name in alphabetical order. 3) List each customer's

ACCOUNT BALANCE and include the mean ACCOUNT balance amount


and the sum of all the ACCOUNT balance amounts in the report output.
The output from

LAST NAME

this

query might look as follows:

ACCOUNT BALANCE

Adams

$595.00
$725.00
$865.00
$525.00
$675.00

Cooper
Evans
Hill

Ivers

MEAN ACCOUNT BALANCE


SUM ACCOUNT BALANCE

Volume

$677.00
$3385.00

6-120

DATABASE REFERENCE MANUAL


mean

of

Keyword: mean
Type:

of

Relational Statistical Operator

Purpose: The mean of


The

result

sum

operator calculates the average value

specified field in

all

matching records

can appear as a

each group or

at the

item

list

report or as a statistic in the

Syntax:

See Also: all, any, count of,


highest of, lowest of, mean,

in a related

in the detail

summary

end of the

of,

named

in a

form.

area of a

area at the end of

report.

mean of FORMNAME RELATIONSHIP [named "UNIQUE


RELATIONSHIP NAME"] [with (selection criteria)] FIELDNAME
|

Returns:

Usage:

The mean of operator

numeric value.
calculates the average of

in the specified field (the

sum

number of values processed). Blank


that

Example:

CUSTOMERS
list

the values

fields are ignored. Fields

have a value of zero are included

for

all

of the values divided by the

in the calculation.

mean

of

in

Order

operator

mean

relational statistical

operator mean of.


mean finds the average value
specified field among
the records being processed.

mean offinds

INVOICES order total

end
This query tells DataBase: 1) Process all the CUSTOMERS records and
list each customer's last name in alphabetical order.
2) For each

CUSTOMERS

statistical

and the

in the

records

LAST NAME

There's an important
difference between the

the average

value in the specified field


among the records related to
the records being processed.

record processed, find all the related records in the


(those that have the same customer #). 3) List the

INVOICES form

mean order total

for each

customer from the

of related

set

INVOICES

records.

The output from

LAST NAME

this

query might look as follows:

MEAN OF INVOICES ORDER TOTAL

Adams

$35.25
$72.40
$48.10
$25.00
$67.45

Cooper
Evans
Hill

Ivers

you also want to include the mean order total among this group of
invoices, change the fourth line of the query to read:
If

mean
6-121

of

INVOICES order total

item

mean

Volume

LEXICON

DQL
message
Keyword: message
Type:

Procedural

See Also: Define Screen


Styles in Volume 2. Chapter 4.
System Administration, and
Field Help in Volume 2.
Chapter I Form Definition.

Command

Purpose: The message command

DataEase

tells

to display a specified

message. The message content can be approximately 1000

Each
message can be assigned individual color and highlighting
effects and be positioned anywhere on the screen.
characters in length (17 lines x 68 characters per line).

message "MESSAGE TEXT' [window]

Syntax:

When you

Usage

message from

select

the

[pause]

list

DQL commands

of

DataEase prompts:

Type the message

You

be displayed.

to

can choose to use a current system variable, a relational

operator, a function, and/or a text constant enclosed in

quotation marks

When you

when

entering the message.

finish entering the

the choice of displaying the


select this option, the

message, DataEase offers you

message

window.

in a

message can be up

to

appropriate size for the message text.

1000 characters

To

If

line (see

you want

window
the start

Example

You can

to indicate

).

and location of the message


you can sf)ecify the following parameters
of the message text (see Example 2):
to control the size

yourself,

# of Columns, Stan Row, Start Column, #

of

Rows.

key names>, braces {regular

in

at

MESSAGE

also control the color and highlighting of

of a message by enclosing the text


like

in

functions in the same way that


Help messages are defined.

divide the message

into multiple lines, insert a vertical bar character

new

The message command

you

DataEase automatically creates a window of the

length.

If

all

or part

angle brackets <treated

field color), or regular

brackets [regular text] as defined on the Screen Styles form

(See Example

3).

For more information on message highlighting, see the


explanation of the Screen Styles form in

Volume

2,

Chapter 4, System Administration.


->

Volume

This entry continues on the next page

6-122

DATABASE REFERENCE MANUAL


message
Usage:

(cont.)

the window option, the message length


40 characters and is displayed on one line in the
upper right comer of the screen (see Example 4).
If

you don't choose

is

limited to

When

message

the user

is

is

displayed

in a

window, DataEase pauses:

required to press any key to acknowledge the

message and resume processing. If you don't display the


message in a window, DataEase asks if you want to use this
pause feature.

Example

1:

message
this

"Sorry. |A high security level

procedure" window

This message is displayed


words Sony and required.

Example

2:

in a

is

requirecl|to run

window. There

are line breaks after the

message

"40, 15, 20, 3, Sorry. |A high security level


requiredjto run this procedure" window

IS

This message is displayed in a window. There are line breaks after the
words Sony and required. The message window is 40 columns wide,
begins in row 15, column 20, and is 3 rows in length.

Example

3:

message
level

is

"40, 15, 20, 3, <Sorry>.|A {high} security


required|to [run] this procedure" window
.

This message is displayed in a window. There are line breaks after the
words Sony and required. The message window is 40 columns wide,
begins in row 15. column 20. and is 3 rows in length. The word Sorjy
is

highlighted like a

word

keyname

as defined on the Screen Styles form.

/?/( is highlighted in the regular field color.

The word run

is

The
treated

like regular text.

Example

4:

"Sorry. A high security level


run this procedure" pause

message

is

required to

This message
the screen.

character

pauses

6-123

is

displayed on a message line in the upper right comer of


is truncated after the word required (40

The message

maximum

length).

until the user presses

When the message is displayed, DataEase


a key to acknowledge the message.

Volume

DQL LEXICON
midc
Keyword: midc
See Also: Jirstcfirstlast,

Type:

Text Function

Purpose: The midc

function extracts a specified

from the middle of a

Syntax:

where

is

characters

text value.

midc(TEXT VALUE, m,

number of

number of

firstwjointext, lastc, lastflrst,


lastw, length, lower, midw,
proper, textpos, upper

n)

the starting position in the text value

and n

is

the

characters to extract.

Returns:

Usage:

midc( FIELDNAME, m, n) returns n characters beginning

text value

n characters

character position

in length.

(inclusive).

at

Intervening spaces and

punctuation symbols are included. Trailing spaces are ignored.

Examples: midc("DataEase",
Returns;

4, 3)

aEa

midcC'New User",
Returns: Use

5, 3)

midC(LAST NAME, 4, 2)
Returns two characters beginning at the fourth
character position in the last name field for every
record that is processed. If a record contains the
value Holmes

in

the last

name

field,

the function

returns me.

Volume

6-124

DATABASE REFERENCE MANUAL

midw
Keyword: midw
See Also: firstc,firstlast,

Type:

Text Function

Purpose: The midw

firstw,jointext, lastc, lastfirsl,


lastw, length, lower, midc,

function extracts a specified

number of words from

proper, textpos, upper

the middle of a text value.

Syntax:

midw(TEXT VALUE, m.

where

is

n)

the starting position in the text value and n

number of words
Returns:

Usage:

midw(FIELDNAME, m,

text value

is

the

to extract.

n words

in length.

n) returns n

words beginning

at

word number position m (inclusive). Intervening spaces and


punctuation symbols are included. Trailing spaces are ignored.

Examples: midw("DataEase

International Inc.", 2, 1)

Returns: International

midw("New Users Group",

2, 2)

Returns; Users Group

midw(BOOK

TITLE, 2, 3)

Returns three words beginning at the second word


position in the book title field for every record that is
processed. If a record contains the value The Hound
of the Baskervilles in the
returns Hound of the.

6-125

book

title field, the function

Volume

DQL

LEXICON

min
Keyword: min
See Also: item, lowest

Type:

Statistical

Operator

max, mean, std.dev.,


sum, variance

Purpose: The min operator finds the smallest value in a


among all the records that are processed. The
in the statistical summary areas of the report.
VALUE

Syntax:
Returns:

min [other

specified field
result appears

statistical operators]

value of the same type as the specified value. If the

specified value

ASCII

is

of,

std.err.,

a Text field,

min

returns the lowest

There's an important
dijference between the
statistical

value.

operator min and

the relational statistical

Example:

CUSTOMERS

for

ACCOUNT BALANCE

LAST NAME

this

among

the records being processed.


.

lowest of returns the lowest


value in the specified field
among the records related to
the records being processed.

query might look as follows:

ACCOUNT BALANCE
$595.00
$725.00
$865.00
$525.00
$675.00

Cooper
Evans
Hill

Ivers

ACCOUNT BALANCE

Volume

tite

in the report output.

Adams

MIN

lowest value

returns

in the specified field

item min

This query tells DataBase: 1) Process all the CUSTOMERS records and
list each customer's LAST NAME in alphabetical order. 2) List each
customer's ACCOUNT balance and include the smallest ACCOUNT

The output from

of.

min
;

end

BALANCE amount

operator lowest
;

records
LAST NAME in order
list

$525.00

6-126

DATABASE REFERENCE MANUAL


minutes

Keyword: minutes
Type:

Purpose: The minutes


expressed

Syntax:
Returns:

See Also: ampm, current.


hour, seconds, timeampm

Time Function
function extracts the minutes from a time value

in a

24-hour format.

minutes(TIME VALUE)

An

integer value from

00

to 59.

Examples: minutes(1 2:00:00)


Returns: 00

minutes(23:59:00)
Returns: 59

6-127

Volume

DQL LEXICON
mod
Keyword: mod (modulus)
See Also: abs,

Type:

Purpose: The mod (modulus)


numeric value

function returns the remainder

values are integers, an integer value

decimal value

is

Returns:

is

returned.

If

both

Otherwise, a

returned.

mod(NUMERIC VALUE

Syntax:

floor,

when one

divided by a second numeric value.

is

ceil,

random

Scientific Function

1,

NUMERIC VALUE

2)

numeric value.

Examples: mod(8,

3)

Returns; 2

mod(12.6,
Returns:

Volume

1.6)

1.4

6-128

DATAEASE REFERENCE MANUAL


modify records

Keyword: modify records


See also: copy

Type:

Processing

Command

all from,

data-entry, delete records,

enter a record,

Purpose: The modify records command modifies

list

records

records in a specified

form.

Syntax:

Usage:

nodify records in FORMNAME RELATIONSHIP [named "UNIQUE


RELATIONSHIP NAME"] [with (selection criteria)]
FIELDNAME := MODIFIED VALUE
|

The modify records command must specify


and the

field values to be

Alternatively,

changed

in the

to

copy

from command. As

field

data

Target form, automatic error checking

is

is

performed and errors are logged

to

When you modify

Primary form, the keyword

in

is

records

in the

omitted and no punctuation

records

command

(see

Example

an error

is
1

).

1: for

CUSTOMERS

with (any

file.

used after the modify


If

no selection

are specified, all the records in the Primary

Example

form

a Target

Target form.

you can specify a Source form

data from using the copy ail

entered

in the

criteria

form are modified.

INVOICES order total

> 500)
modify records
;

ACCOUNT BALANCE
DISCOUNT)

:=

(ACCOUNT BALANCE

data-entry

end
This query tells DataBase: 1) Process all the CUSTOMERS records that
have any related INVOICES record with an ORDER total greater than
$500. 2) Modify each CUSTOMERS record by subtracting the DISCOUNT
amount entered in the Data-entry form from the value in the ACCOUNT

BALANCE

field.

This entry continues on the next page

6-129

Volume

DQL
modify records

(cont.)

When you modify

Usage:

LEXICON

records in a form other than the Primary

form, the keyword in precedes the form name, and the

command

ends with the appropriate punctuation mark (a


semicolon or a period - see Example 2). If no selection

criteria are specified, all the records in the specified

form

are modified.

Example

CUSTOMERS

2: for

with state = "NY"

modify records

ORDER TOTAL

INVOICES
ORDER TOTAL

in

:=

+ NY SALES TAX

end
This query

have

NY

tells

in the

processed, find

each related

all

the related records in the

INVOICES

the value in the

Volume

DataBase: 1) Process all the CUSTOMERS records that


field. 2) For each CUSTOMERS record that is

STATE

INVOICES

record by adding the

ORDER TOTAL

form. Modify

NY SALES TAX amount

to

field.

6-130

DATABASE REFERENCE MANUAL


month
Keyword: month
Type:

See Also: current, day, date,


Julian, spelldate, spellmonth,

Date Function

spellweekday, year, yearday,

Purpose: The month

function extracts the

month

(1- 12)

from a date

yearweek

value.

Syntax:
Returns:

month(DATE VALUE)

An

integer value between

and

12.

The

date format selected

System Administration changes the date sequence but does


not affect which value is returned by a Date function.
in

Examples: month(1 2/31/89)


Returns:

12 (North American format)

month(31/12/89)
Returns: 12 (European format)

month(89/12/31)
Returns:

6-131

12 (Metric format)

Volume

LEXICON

DQL
named
Keyword: named

See Also: Ad-hoc Relationship

Type:

Relational Operator

Purpose: The named

operator

is

used to give a unique

name

each

to

relationship based on different selection criteria so DataEase

can distinguish multiple relationships between the same forms.

RELATIONSHIP named "UNIQUE RELATIONSHIP NAME"

Syntax:

[with

(selection criteria)]

Usage:

During a query, whenever you add or change the selection


criteria

of a relationship (predefined or ad-hoc), you create a

new ad-hoc

relationship. If

two forms

are related

by more

than one relationship, each of these relationships must be

assigned a unique name, either on the Relationships form or

named

by using the

operator

in the

query, so DataEase can

distinguish between them.

unique relationship name

you assign

is

name used on

relationship

any name you

like as

analogous

it's first

name appears

When you

to the optional

the Relationships form.

long as no other relationship

query has the same name. The name


time

is

placed

in

It

can be

in the

quotes

defined; no quotation marks are used


in

name

an arbitrary name. The

to the relationship is

if

at the

the

subsequent statements.

use the

named

operator to distinguish a

relationship, the relationship automatically forfeits any

previously defined criteria, including the criteria on which a

predefined relationship was based. Thus,


criteria to a relationship

distinguish

it.

and use the

you must also

defines the relationship.

if

named

you add new


operator to

restate all of the criteria that

Once

a relationship

is

assigned a

unique name, you can use the relationship name alone to


reference

it

without restating the

-^

Volume

criteria.

This entry continues on the next page

6-132

DATAEASE REFERENCE MANUAL


named
Example:

(cont.)

for

CUSTOMERS

modify records
with

in

(CUSTOMER

INVOICES named "CURRENT"


CUSTOMERS CUSTOMER #

# =

and DATE > 01/01/89)


ORDER TOTAL := ORDER TOTAL
delete records in INVOICES
with (CUSTOMER # =

data-entry DISCOUNT

named "OUTDATED"

CUSTOMERS customer

and DATE < 01/01/80)


end
This query tells DataBase: 1) Process all the CUSTOMERS records.
2) For each record processed, find all the related INVOICES records.
3) Divide the related INVOICES records into two groups: one group

CURRENT (dated after January 1st, 1989). and a second group


OUTDATED (dated before January 1st, 1980). 4) Modify the
records in the CURRENT relationship by subtracting the discount value
named
named

entered

in

the Data-entry

There

is

INVOICES ORDER total.

form from the

5) Delete the records in the

OUTDATED

relationship.

a predefined relationship between

INVOICES. During

this

query,

we

CUSTOMERS

are creating

two

and

different ad-hoc

CUSTOMERS and INVOICES by adding selection


based on the value in the date field. The named operator is used
to assign a unique relationship name to each group of records so DataBase
can distinguish between these two relationships.
relationships between
criteria

Because the previous

criteria is forfeited

whenever

new

relationship

is

created, the full relationship criteria, including the criteria used in the

predefined relationship
specified

when each

(customer # =

relationship

CUSTOMERS customer

#), is

named.

is

Subsequently, as long as the criteria remains unchanged, you can use the
name alone without restating the relationship criteria. For

relationship

example, if after modifying the records in the CURRENT relationship you


want to list the invoice # and ORDER TOTAL of each record, the query

would look

Example:

like this:

for

CUSTOMERS
modify records
with

in

(customer

INVOICES named "CURRENT"


CUSTOMERS customer #

# =

and DATE > 01/01/89)


ORDER TOTAL := ORDER TOTAL

data-entry DISCOUNT

records in CURRENT
INVOICE # in order

list

ORDER TOTAL
end

6-133

Volume

DQL

LEXICON

Nested Actions

Keyword: Nested Actions


Type:

See Also: for, case, end,


while

Concept

Purpose: A Nested Action

is

an action that

is

if,

invoked by another

action.

There are two types of nested actions:

1)

nested loop

same series of actions on each record that


Example 1). 2) A nested conditional action

action performs the


is

processed (see

is

most often used

different actions

Example

1: for

CUSTOMERS
for

subgroups of records and perform

to select

on each group (see Example

2).

INVOICES
list

records

CUSTOMERS
INVOICE #

LAST NAME

in

groups

ORDER TOTAL

end
end
This query tells DataEase to perform the same series of actions on each
record selected by the for command. In this example, the second for

command, which
record that

is

retrieves the invoices related to the

currently being processed,

is

CUSTOMERS

nested within the

first

for

command.

Example

2: for

Although DataEase does not


require it. it is easier to follow
the logic if you indent nested

INVOICES
ORDER TOTAL > 500 then
;

if

modify records

in

CUSTOMERS

STATUS := PREFERRED
DATE between 01/01/89 to current date tfien
enter a record in CATALOG CUSTOMERS
copy all from CUSTOMERS
end
.

if

actions as

shown

in these

examples.

end
end
two groups of INVOICES records:
greater than $500 (the related
CUSTOMERS records get modified). 2) The records with an order
TOTAL greater than 500 and a date between the start of 1989 and today's
date (the related CUSTOMERS records get modified and copied into the
This query

tells

DataEase

1) All the records

with an

to select

ORDER TOTAL

CATALOG CUSTOMERS

form).

In this example, the second if

records selected by the

first if

command, which selects a subgroup of


command, is nested within the first if

the

command.

Volume

6-134

DATAEASE REFERENCE MANUAL


not

Keyword:

not

Type:

Comparison Operator

See Also: and, between,

Purpose: The not

operator reverses the meaning of any comparison

operator

except

it

VALUE

Usage:

The not
(/fii

(e.g.,

STATE not = "NY" means any

state

York).

not comparison operator

VALUE

operator's effect can often be accomplished by

stating the

<

precedes

New

Syntax:

or,

comparison

r/ic/;;)

greater than).

in a different

way. For example.

can be substituted for not >= (not equal or

Whenever

possible, comparisons should be

stated as a positive expression.

Examples: ORDER TOTAL not > 500 means the value


TOTAL

field is less

in

the

order

than or equal to 500.

STATE not = "NY" and state not = "NJ"


means any state except New York or New Jersey.
;

6-135

Volume

DQL LEXICON
Operators
List of

DQL

Keyword: Operators
Type:

Concept

COMP.ARISON

Purpose: Operators

refine

commands; they

tell

DataBase how

to

execute the various operations specified by Processing and


Control

There are
briefly

six

Commands.

groups of

DQL

Comparison Operators
left

DataBase

if

the

comparison

Grouping and Sorting Operators


in

tell

to

compare

the value to the

of the operator with the value to the right of the operator and

process the record

Operators which are listed to the right and

summarized below:

which records

are processed

Relational Operators

let

you

and

is

tell

true.

DataBase

to

change the order

listed in the output.

retrieve specified field information

from a related form.


Statistical
all

Operators summarize

the values of a specified field for

the records that are processed.

Conditional Statistical Operators indicate for which records a


specified condition

is

true

and the

total

number

processed records for which the condition

Relational Statistical Operators are used

is

or the percentage of

true.

to

summarize

field

information from a set of records in a related form.

There

is

a separate entry for each individual operator in this lexicon.

Operators

DATABASE REFERENCE MANUAL


or

Keyword:

or

Type:

Logical Operator

Purpose: The or
Syntax:

See Also: between, not, and,


=, <, <=, >, >=

operator combines two sets of selection

SELECTION CRITERIA

Returns:

The values

in

or

SELECTION CRITERIA

criteria.

records that satisfy either of the selection

criteria statements.

Usage:

The or operator

requires that a record meet either of the

specified criteria to be processed (as opposed to the

and

operator which requires that a record meet all the specified


selection criteria to be processed).

When

selection criteria are

or operators

in

combined with both the and and


criteria must be enclosed in

one statement, the

parentheses to clarify the meaning.

Examples:

CUSTOMERS

for

or

This statement
that contain

the

tells

NY

with state = "NY"

ACCOUNT BALANCE > 500

DataBase: Process only those CUSTOMERS records


state field or have a value greater than $500 in

the

in

ACCOUNT BALANCE

field.

record

is

processed

if

it

satisfies either

of

these criteria.
for

CUSTOMERS with (state = "NY"


and ACCOUNT balance > 500

or

state = "NJ")

This statement

tells

that contain either

$500

in the

DataBase: Process only those

NY

or

NJ

in the

account balance

STATE

field

CUSTOMERS

and

records

a value greater than

field.

In this case, only records that satisfy both sets of criteria are processed.

6-137

Volume

DQL LEXICON
Others

Keyword:

others

Type:

Keyword

See Also: case, value

Purpose: The others keyword

command

is

an optional component of the case

When

syntax.

processing a case

DataBase compares the expression

command,

that follows case to

of the statements specified by the keyword value.

If

each

none of

the specified value comparisons are true. DataBase executes


the actions specified after the

keyword others. As soon as

the actions following any value or others statement are

executed, processing passes to the

end command

Syntax:

first

action following the

for the case statement.

case (EXPRESSION)

COMPARISON

value

ACTION SERIES
[value

COMPARISON

ACTION SERIES

[value

COMPARISON N

1.

2.1

ACTION SERIES N]
[others

OTHERS ACTION SERIES

end

The case command

Usage:

requires a case expression, one

comparison value, and an end command. Subsequent value


statements, actions, and the others
If

others

is

used,

must follow

it

keyword

all

are optional.

the specified

comparison

values.

Example:

case (current user name)

"FRANK"
menu "ADMINISTRATION"
value "CAROL"

value

call

run procedure "DAILY"


others
record entry "CUSTOMERS"
.

end
This query

tells

DataBase:

ADMINISTRATION
Procedure.
display the

Volume

If

If the

menu.

If

is

Frank, display the


is

Carol, run the

DAILY

anyone other than Frank or Carol,


Record Entry form.

the current user

CUSTOMERS

current user

the current user

is

6-138

DATAEASE REFERENCE MANUAL


output

Keyword: output
Type:

Procedural

See Also: all, Nested Actions,


Primary Form, Relationships,
Secondary Form

Command

Purpose: The output command

used to write text or fields directly to

is

the output device during processing without regard to the

report format.

The

and

text

when

fields are sent to the screen or

command is encountered
without regard to grouping, formatting, or other command
printer immediately

The command

structures.

command found
Syntax:

output

FIELD

Usage:

the

in

is

very similar to the

many programming

PRINT

languages.

TEXT

The output command

lets

text directly in the qiieiy.

you specify output


In Interactive

fields and/or

Mode, when you

choose the output command. DataEase automatically


switches into Edit Mode and asks you to define what you
want to output. You can enter text (including titles, boundary
lines, etc.)

press

move

or

FIO FIELD

When you

the cursor to the desired location

For more information, see


"Editing Formats: Adding
and Modifying Fields" in
Chapter 5 of this volume.

and

to enter a field.

press FIO, DataEase displays the Report Field

Definition screen just as

You can

report format.

it

does when you are defining a

select a field

from the menu DataEase

displays or enter a field derivation in the Report Field

Formula Window. See "Adding and Modifying Fields" in


this volume for a detailed explanation of how

Chapter 5 of

to

generate output from fields.

The output command must be entered on

a separate line in

and be followed by a colon. You can use any


number of output commands in a single query. Following
each output command, you can enter any number of lines
the query

containing fields or
insert a period

text. Following the last


on a separate line in Column

After inserting an output

column
Mode.

insert a period in

to Interactive

-^

6-139

command
1

in

Edit

line to
I

be output,

of the query.

Mode, you must

of the query before you can return

This entry continues on the next page

Volume

DQL LEXICON
output (cont.)

To demonstrate

the use of the

query that appears

in the

output command. Example

entry for the for

shows a

command.

its impossible to completely align information processed and printed


sequence from two different forms, this query produces output that is
very difficult to read as shown below:

Since
in

Examplel

for

CUSTOMERS
records
LAST NAME

with

account balance > 500

list

in

order

end
for

INVOICES

records
INVOICE # in order

list

ORDER TOTAL

end

LAST NAME

INVOICE #

Adams
Cooper
Evans
Hill

Ivers

A00005

ORDER TOTAL

DATABASE REFERENCE MANUAL


output (cont.)

Example

2: output

LAST NAME

for

CUSTOMERS
list

LAST NAME
output

[LAST NAME]

end

with

records
in

order

account balance > 500

DQL

LEXICON

output (cont.)

A common

usage of the output

command

multiple secondary or tertiary forms.

has 3 secondary forms:

is to process records from


For example, assume your database

OFFICERS. DIRECTORS, and EMPLOYEES,

Primary form: CORPORATION. The forms are


If you want to produce a report listing fields
from all these forms, you cannot use the all operator. However, you can
use the output command, as shown in Example 3.
that are all related to the

related by the field

Example

3:

CO

#.

DATAEASE REFERENCE MANUAL


output (cont.)

sample printout from the query

D. Vader, Inc.

in

Example

is

illustrated

below.

LEXICON

DQL
percent

Keyword: percent
See Also: item, count

Type:

Conditional Statistical Operator

Purpose: The percent

operator calculates the percentage of records that

satisfy a condition specified

Syntax:
Returns:

Example:

CONDITION

percent [other

by a comparison of two values.

statistical

operators]

numeric value.
for

CUSTOMERS
list

records

LAST NAME

in

order

ACCOUNT BALANCE
ACCOUNT BALANCE > 500
:

item percent

end
This query tells DataBase: 1) Process all the CUSTOMERS records and
list each customer's LAST NAME in alphabetical order. 2) List each
customer's ACCOUNT balance. 3) For each customer, display a YES or
answer indicating if the ACCOUNT balance is over $500. 4) Display
the percentage of records that have a ACCOUNT BALANCE value greater
than $500 in the report output.

NO

The output from

LAST

this

query might look as follows:

DATABASE REFERENCE MANUAL

periods

Keyword:

periods

Type:

Financial Function

See Also: futurevalue,

Purpose: The periods

installment, presentvalue, rate

function calculates

how

long a financial

transaction requires to reach a future target value given the

presentvalue, futurevalue, installment payment, and interest


rate.

Syntax:

periods(presentvalue, futurevalue, installment, rate)

Returns:

numeric value (the number of periods needed

to reach the

target futurevalue of the investment).

Usage:

if the installment

investment

(e.g.,

positive amount.

investment

(e.g.,

payment increases

the value of the

an annuity), the installment


If the

payment decreases

is

expressed as a

the value of the

loan amortization), the installment

is

expressed as a negative amount.

The

interest rate, installment

be based on the same terms.

number of months,
12.

To determine

the rate

payments, and time periods must

To determine

is

periods as a

expressed as 7 * annual rate

Examples: ceil(periods(10000,
Returns: 89

0,

periods as a

expressed as the annual rate

number of weeks,

the rate

is

365.

When

-150,8/12))

This example calculates how many months it takes to repay a loan of


$10,000 at 8% annual interest with monthly installment payments of $150.
The ceil function rounds up the result to the next integer.

typing fractions like

8 1 12. DataBase requires that


you type a space before and
after the division symbol (I).

cell(periods(0, 10000, 250, 10/12))


Returns: 35
This example calculates how many months it takes to accumulate $10,000
in savings, if you begin with no money in the account, make monthly
deposits of $250, and earn 10% annual interest.

NOTE:

DataBase financial functions are derived from


shown below. (The double asterisks (meaning
power") cannot he used in a query).

the formula
"raise to the

* ((1 + (rate/IOO)) ** periods) +


(installmentl(ratellOO)) * (((1 + (rate/IOO)) ** periods) - I)

futurevalue = principal

6-145

Volume

DQL

LEXICON

power
Keyword: power
Type:

See Also: exp, log, loglO, sqrt

Scientific Function

Purpose: The power

function raises a numeric value to a specified

power.
power(BASE, EXPONENT)

Syntax:
Returns:

Usage:

DataBase does not support ** as a symbol for exponentiation.

numeric value equal

Use

the

power

Examples: power(12,

to the base raised to the exponent.

function instead.

2)

Returns:

144

power(6,

3)

Returns:

216

power(8, 1/3)
Returns: 2

Volume

6-146

DATAEASE REFERENCE MANUAL

presentvalue

Keyword: presentvalue
Type:

See Also: futurevalue

Financial Function

Purpose: The presentvalue


amount

installment, periods, rate

function calculates the required starting

for a financial transaction given the futurevalue,

installment payment, interest rate, and number of payment


periods.

Syntax:

presentvalue(futurevalue, installment, rate, periods)

Returns:

numeric value

(the initial value before

any installment

payments are made).

Usage:

If

payment increases

the installment

investment

(e.g.,

positive amount.

investment

(e.g.,

the value of the

an annuity), the installment


If the

payment decreases

expressed as a

is

the value of the

loan amortization), the installment

is

expressed as a negative amount.

The

interest rate, installment

payments, and time periods must

be based on the same terms. For example,


expressed

in

the annual rate

the periods are


is

expressed as

2.

Examples: presentvalue(0,
Returns:

if

months, the monthly interest rate

-150, 7.9

When

12, 48)

typing fractions like

DataBase requires
you type a space before and
after the division symbol (/).
7.9

6156.12

12.

that

This example calculates the auto loan amount you can afford to borrow
an interest rate of 7.9% if you want to repay the loan in 48 monthly
payments of $150.

presentvalue(1 25000, 150, 10


Returns: 1514.00

at

12, 240)

This example calculates the required starting balance for a savings plan
designed to accrue a $125,000 balance in 20 years based on monthly
payments of $150 and an annual interest rate of 10%.

NOTE:

DataEa.se financial fiiiHiions are derived from the formula


shown below. (The double asterisks (meaning "raise to the

power") cannot he used

in

futurevalue = principal *
(installment/date/

6-147

won

a query).

((I

* (((1

+ (rate/ 100)) ** periods) +


+ (rate/ 100)) ** periods)
-

I)

Volume

LEXICON

DQL
Primary Form

Keyword: Primary Form


Type:

See Also: Ad-hoc


Relationship, all, output.
Relationships, Secondary

Concept

Form

Purpose: The first form specified in a query is called the Primary


form for the query. The Primary form should be the form
you want

that holds the key data

Usage:

One form can

to

view or manipulate.

be related to another form by either a

A form related to the


Secondary form. A form related

predefined or an ad-hoc relationship.

Primary Form

is

called a

a Secondary form

is

to

called a Tertiary form, etc. There can be

any number of such relationship levels (see Figure 6-1 below).

When

processing the records in a form, the data

form can be accessed


forms.

lowest of,

in

a relationship exists

relational operator (all, any,

mean

of, or

the related form.

records

if

The

sum

all

of)

is

in

another

between these

count

of,

highest of,

used to access the data

more than one form on any

relationship level

no more than one Secondary form, one Tertiary form,


However, you can use the output command to access
related records in

relationship level.

operator cannot be used to access

more than one form on

a particular

(i.e.,

etc.).
all

DATAEASE REFERENCE MANUAL


Procedural

Commands
See also: Control Procedure,
Processing Procedure

Keyword: Procedural Commands


Type:

Concept

Purpose: The

DQL

Procedural

commands

are used to organize and

control the flow of actions in a procedure.

Usage:

commands can

Procedural

be used

in

both Processing

Procedural

Commands

procedures and Control procedures.


output

Example:

message

case (spellweekday(weekday(current date))


value

"MONDAY"

if
:

run procedure

value "FRIDAY"
run procedure
others

"NEW WEEK"

else
.

end

"CLOSE WEEK"

while
break

menu "MAIN"

call

exit
.

case
value

end
This query

WEEK

tells

procedure.

If

Main Menu.

6-149

DataBase:

procedure.

If the

If the

current date

current date

the current date

is

is

is

NEW

others

CLOSE WEEK

define
assign

Monday, run

a Friday, run the

the

any other day of the week, display the

(period)

Volume

DQL

LEXICON

Processing Procedure

Keyword: Processing Procedure


Type:

Purpose:

See Also: Control Procedure

Concept

A DQL

Processing procedure can enter, delete, and modify

records, as well as create screen, disk, or printed output based

on the query

instructions, the data stored in database forms,

and additional data input during the execution of the


procedure.

Usage:

Processing

The Processing commands (shown at right) are used to create


a Processing procedure. These commands cannot be used in a
Control procedure, but they can be used within a Processing

procedure that

Example:

for

is

part of a Control procedure.

CUSTOMERS

list

Commands

records

modify records
delete records

enter a record
for

lock

unlock

records
LAST NAME in order
list

ACCOUNT BALANCE

quer>' selection

input

end
This query tells DataBase: 1) Process all the CUSTOMERS records.
2) For each record processed, list the LAST name and the ACCOUNT
BALANCE values and arrange the output in alphabetical order by LAST

NAME.

Voluine 3

6-150

DATAEASE REFERENCE MANUAL

proper

Keyword: proper
Type:

See Also: firstcfirstlast,


firstwjointext, lastc, lastfirst,
lastw, length, lower, midc,

Text Function

midw, textpos, upper

Purpose: The proper

function converts the

text value to uppercase,

Syntax:
Returns:

first letter in

and subsequent

each word

letters to

in a

lowercase.

proper(TEXT VALUE)

The

specified text value with the

first letter in

each word

capitalized.

Usage:

Any

letter that is

a period

is

preceded by a space, hyphen, ampersand, or

capitalized by the proper function as

letter in the

the first

is

parenthesized value. Other punctuation, including

the apostrophe, does nor act as a delimiter for the

proper

function.

letter that is neither the first letter in a

value

letter in the specified

is

word nor

the first

converted to lowercase by the

proper function.
This function

is

commonly used in the derivation formula


Form Definition. For example, if the

for text fields during

derivation for the field

last name

is:

proper(LAST .name)

you can enter the text


to the proper format.

in either

case and DataBase converts

it

Examples:proper{"dr. watson")
Returns: Dr. Watson
properC'washington d.c")
Returns: Washington D.C.

proper(FULL NAME)
Returns the value

the value sherlock homes, or

SHeiLOck hOLniES.

6-151

NAME

in the FLiLL

format for every record that

is

field in the

processed.

If

proper

a record contains

SHERLOCK HOLMES,

the function returns Sherlock

or even

Holmes.

Volume

DQL

LEXICON

query selection

Keyword: query
Type:

selection

Processing

Purpose: The query

See Also: lock, lock db,


unlock, unlock db

Command
selection

(local area network).

command is functional only on a LAN


This command is used to override the

default locking rules specified on the

form.

It

System Configuration

should only be used by a technical expert

very familiar both with DataBase and the


in use.

If

you do not have expertise

in

LAN

who

is

environment

LANs, you can

rely

on

the default locking rules to lock your data appropriately.

Before DataBase begins processing records for a query,

must

select the records to

command

tells

processing

if

indexed field.
an indexed

it

be processed. The query selection

DataBase how

to set locks prior to the start of

records are being selected or sorted on an


If

records are not being selected or sorted on

field, the

locking rule defined on the System

Configuration form for Record Processing applies.

Syntax:

query selection lock

files

records

nothing.

The three syntax options that are used in conjunction with


query selection command are explained below.
The query

selection lock files

command

the

overrides the current default

Record Selection locking rule and locks the fonn(s) from which records
are being selected. Other users cannot add, modify, or delete records in
the form. They can view records in the form if the selected records will
only he listed hy the procedure (not modified or deleted). The form
remains locked until the end of the procedure.
selection lock records command overrides the current default
Record Selection locking rule and locks any records that have been
selected for processing. Other users cannot modify or delete these
records. They can view the records if the selected records will only he
listed hy the procedure (not modified or deleted). Other users can view,
modify, or delete records in the same form(s) that have not been selected.
Once processing begins, the locking rule defined on the System
Configuration form for Record Processing applies.

The query

CAUTION .The

The default record selection


locking rules resolve any
conflict that

might arise when

other users attempt to view,


modify, or delete records that
have been selected to be
processed hy a report query.
For more information on the
LAN default locking rules, see

LAN Multi-User Locking


in Volume 2, Chapter
System Administration.

Options
4,

query selection lock records command should he used


It should only he used for procedures that

with great care.

from very few forms. If this command


used for many records, most LANs cannot support the
number of locks required. If this command is used
incorrectly, the integrity of your data can he compromised.

select very few records


is

Volume

6-152

DATABASE REFERENCE MANUAL


query selection

The query

(cont.)

selection lock nothing

Record Selection

command

overrides the current default

and unlocks the form(s) from which records


are being selected. Other users can view, modify, or delete records that
have been selected for processing. Once processing begins, the locking
rule defined on the System Configuration form for Record Processing
loci<ing rule

applies.

The lock nothing command can be useful in situations where you need
keep data available to many users even while running a procedure that

to

uses that data. However, with this command in effect, it is possible for a
user to change a record that has already been selected for processing.

NOTE:

If a lock all files

query,

command occurs

as the first

command in a

commands specified on the


System Configuration form and any locking commands
specified later in the query. A lock all files command locks
all files used by the procedure until an unlock command is
overrides all locking

it

encountered or the procedure ends, regardless of subsequent


commands. See the lock command earlier in this chapter for

more

Usage:

information.

The query

selection

command

overrides the

Record Selection locking rules assigned by


administrator. A query selection command
terminated

Example:

at the

default

is

automatically

end of a query.

query selection lock nothing


for

LAN

the database

CUSTOMERS

with

bonus points > 500

modify records

ACCOUNT BALANCE
DISCOUNT)

:=

(ACCOUNT BALANCE

data-entry

end
This query

tells DataBase: 1) Override the default Record Selection


locking rule so other users can view, add, delete, or modify the data in the
CUSTOMERS form while records are selected to be processed by this
procedure. 2) Select all the CUSTOMERS records whose BONUS points
are greater than 500. 3) Modify each selected record by multiplying the

ACCOUNT BALANCE amount by

the value in the

discount

field

on the

Data-entry form.
In this

example many records may be selected to be processed. However,


still access the CUSTOMERS form while the procedure
is

users can

processing.

It is

below 500 while

6-153

unlikely that any customer's


the query

is

bonus points

will fall

being processed.

Volume

DQL LEXICON
random
Keyword: random
See Also: abs,

Type:

ceil, floor,

mod

Math Function

Purpose: The random


between

function returns a

and

(inclusive).

random decimal value

No

value

is

required in the

function's argument.

Syntax:

random(

Returns:

A number

Usage:

The following
using the

between

and

(inclusive).

steps are used to generate a

random

Determine the range (number of

1.

random number must


is

In the

Use

3.

fall.

possibilities) in

is

if

the desired range

90.

the starting value

the following formula to generate a

which the

The

result of the random


is really a

pseudo-random number
calculated by a formula, not a
true random number.

starting value (smallest integer) of the range.

example 10-100,

(random(

integer

function

For example,

between 10 and 100, the range

Determine

2.

random

function:

RANGE)

is

10.

random

integer.

STARTING VALUE

Examples: floor(random( * 9)
Returns: A random integer between
)

floor(random(
Returns:

*
)

9.

90) + 10))
integer between 10 and 100.

A random

In these examples, floor rounds

Volume

and

down

the result to the nearest integer.

6-154

DATABASE REFERENCE MANUAL


rate

Keyword:

rate

Type:

Financial Function

Purpose: The

See Also: futurevalue,


installment, periods,

presentvalue
rate function calculates the interest rate of a financial

transaction given the presentvalue. futurevalue. installment

payment, and the number of payment periods.

Syntax:

rate{presentvalue, futurevalue, installment, periods)

Returns:

Usage:

If the

numeric value
installment

investment

(e.g.,

positive amount.

investment

(e.g..

(the interest rate).

payment increases

the value of the

an annuity), the installment


If

the

payment decreases

is

expressed as a

the value of the

loan amortization), the installment

is

expressed as a negative amount.

The

interest rate, installment

be based on the same terms.

periods

payments, and time periods must


If

payments are made monthly,

computed as the number of years * (multiplied by)


12 and rate is computed as 1/12 of the annual rate.

Examples:

is

12 * rate(12000,
Returns: 7.3

0,

When
10

typing fractions like

DataBase requires
you type a space before and
after the division symbol (/).
1

12,

that

-289, 48)

This example calculates the annual interest rate on a $12,000 car loan
be repaid in 48 monthly payments of $289.

to

12 * rate(0, 20000, 250, 60)


Returns: 10.2
This example calculates the annual interest rate required to accumulate
$20,000 in savings, if you begin with no money in the account and make
monthly payments of $250 over a period of 5 years.

NOTE:

DataBase financial functions are derived from


shown below. (The double asterisks (meaning
power") cannot be used in a query).
futurevalue = principal *

((I

(installmentl(ralellOO)) * (((/

6-155

the formula
"raise to the

+ (rate/ 100)) ** periods) +


+ (rate/100)) ** periods)
-

I)

Volume

DQL LEXICON
record entry

Keyword: record entry


Type:

Control

See Also: data entry, input

Command

Purpose: The record entry command


Record Entry form

Syntax:

record entry

tells

DataBase

"FORMNAME"

The record entry command allows records

Usage:

modified

in the specified

procedure.
either

to display the

for the specified database form.

You

form

can enter as

Form View

at

many

records as you like, using

or Table View.

Unlike the input command, the record entry


provides

all

be entered or

to

any point during a Control

command

the functions available through the

option on the

Main Menu, including

The record entry command


functions like selecting Record
Entry (Option 2) on the Main
Menu and then selecting the
form you want to use from the
Records menu. For further
explanation, see Volume 1
Chapter 2, Record Entry.

Record Entry

the ability to add,

modify

and delete records.

When you

finish entering records

and press ESC, the Control

procedure resumes with the action following the record entry

command.

Example:

record entry "CUSTOMERS"


run procedure "PRINT INVOICES"
db status
.

DataEase: 1) Display the CUSTOMERS form so the


new customer records. 2) When the operator finishes
entering records, run the PRINT INVOICES procedure. 3) After running
the procedure, display the status of the current database.

This query

tells

operator can enter

Volume

6-156

DATABASE REFERENCE MANUAL


Relational Statistical Operators

Keyword:

See Also: Conditional

Relational Statistical Operators

Statistical Operators,
Statistical

Type:

Operator

Purpose:

Relational Statistical Operators are used to generate statistical

information on the values in the specified field


records

in a

related form

to the record that

(i.e.,

in

a set of

a set of records that are related

currently being processed, such as

is

Operators

all

the

invoices for an individual customer).

Syntax:

relational statistical operator

FORMNAME RELATIONSHIP
|

"UNIQUE RELATIONSHIP NAME")


FIELDNAME

[named

[with (selection criteria)]

Usage:

To

generate statistics on a field in a related form:

Relational Statistical

Operators
1.

Insert the Relational Statistical Operator followed

of the related form or the

name of

by the name
count of

the relationship.

highest of

lowest of
2.

Assign a unique name


the

named

to the relationship if

necessary using

operator.

any desired selection

criteria in parentheses.

3.

Insert

4.

Insert the field name followed by a semicolon or a period,


depending on the location of the statement in the query.

The

Relational Statistical Operators are:

lowest of,

mean

of,

and

mean of
sum of

sum

count

of,

highest of,

of.

The count of operator counts the number of related records,


not field values. The field name is omitted at the end of the
count of statement.

The highest of and lowest of operators can be used on both


Text and

ASCII

Number

highest of returns the highest

fields,

field value in the set of related records,

returns the lowest

ASCII

The sum of and mean of operators

sum

are used

of returns the total of the field values

records,

mean

lowest of

field value.

on number

in the set

fields.

of related

of returns the averaj-e of the field values

in

the set of related records.

Each Relational

Statistical

Operator

is

treated as a separate

entry in this lexicon.

6-157

Volume

DQL LEXICON
Relationships

Keyword:

Relationships

Type:

Concept

See Also: Ad-hoc


Relationship, all, any, count
of, highest of, lowest of,

Purpose: A Relationship
whether

in the

is

two groups of records


in

two groups of records

a link between

same form or

in

two

are related,

different forms.

mean

of,

sum of

When

you can access information

one group while processing records

other group.

in the

DataEase employs two types of relationships.


In a predefined relationship, the

related
is

by a

link entered

two groups of records are

on a Relationships form. The link

created by specifying one or

more

fields that hold the

information in both groups. Because this relationship


stored in the database,

it

can be used

in different

same

is

For more information on

this

topic, see "Define

Relationships" in Volume 2,
Chapter 2. Form Definition
and Relationships.

procedures

whenever necessary.

An ad-hoc

relationship

creating a query.

is

a relationship that

is

defined while

Although an ad-hoc relationship can be

like a predefined relationship to access information in

used

another group of records, the relationship isn't stored as a


Therefore,

part of the database.

procedure

Usage:

in

which

it

is

In a query, a value in a related

called a relationship value.


in a

it

can only be used in the

defined.

form or group of records

is

relationship value can be used

query wherever you can use a

field, a

constant value, or

a variable (such as in selection criteria, as a

list

item, or as a

value assigned to a temporary or global variable).

Once

a relationship

Operators

let

is

DQL Relational

established, the

you access and manipulate values

form. For example,

if

the query

is

processing

in the related

CUSTOMERS

records, the statement:

sum
sums

of

the

INVOICES ORDER total

order total field for each related invoice (every


CUSTOMER # as the CUSTOMERS

invoice with the same

record that

is

currently being processed).

The use of each of

the Relational Operators

is

covered

in a

separate entry in this lexicon.

Volume

6-158

DATAEASE REFERENCE MANUAL


reorganize

Keyword: reorganize
Type:

See Also: backup db. db

Command

Control

status, restore

Purpose: The reorganize command


Syntax:

reorganize

Usage:

"FORMNAME

reorganizes the specified form.

"

The formname, which can be


enclosed

When

in

is

reorganized,

deleted since the

and

all

a constant or a variable,

must be

quotes.

a form

last

db

all

The reorganize command


functions like selecting
Reorganize a Form (Option
5) on the

records that have been

reorganization are permanently erased

indices used to organize the data in the form are

Form

Definition

menu. For further explanation,


see Volume 2. Chapter 2,

Form Definition.

recreated.

form has become inconsistent (signalled by an

If the

message), the reorganize

form and returns

in the

On

LAN:

LAN

command

the

form

to a consistent status.

(Local Area Network),

if

another user

using any resource required by the reorganize

DataBase displays

message
the

is

is

currently

command,

Resource Conflict message. While

this

displayed, DataBase automatically tries to execute

command

at brief intervals.

procedure during

When

error

reorganizes the records

this time,

the required resource

If

you want

you must reboot

becomes

to abort the

the computer.

available,

DataBase

automatically resumes processing and executes the rest of the


procedure. See
for

Volume

2,

Chapter

more information on resource

4,

System Administration.

conflicts

and Multi-User

Locking Options.

Example:

reorganize
run report

This query
2)

When

tells

"CUSTOMERS"

"PRINT INVOICES"

DataBase: 1) Reorganize the CUSTOMBRS form.


is completed, run the PRINT INVOICES

the reorganization

procedure.

6-159

Voluine 3

DQL LEXICON
Report Format

Keyword: Report Format


See Also: Chapter 5 Report
Formatting, in this manual.
.

Type:

Concept

Purpose: A Report Format

tells

DataBase how

the field values, statistics,

DQL

Procedure.

titles,

to lay out the information

eight Report Formatting

text generated

by a

report format consists of three elements:

Report Formatting Commands: Commands

how

to physically lay out

and other

that tell

DataBase

generated by the procedure. The

Commands

are:

.header, .footer, .group header,

.items, .group trailer, .end, .page, and .call.

Form

Text: Descriptive text such as the Report Title, Column Headers,


Page Numbers, Boundary Lines, etc. You enter Form Text in the format
directly where you want it to appear in the report output.
Fields:

Locations where the field values from the records processed by

the procedure actually appear in the report output.

move

To

insert a field in a

where you want the field


values to appear, press FIO FIELD, and then select the field from the
menu DataBase displays.

report format,

the cursor to the position

A sample report that indicates which elements in the output are controlled
by various Formatting commands is shown below. For complete
information on Report Formatting refer to Chapter 5 in this manual.

DOUN EAST COMPANY


Monthly Report
October 1989

header

.footer

Marketing Departnent

*-

.group header

Departnent Total

Grand Total

Figure 6-2

Volume

Sample

itens

.group trailer

.end

Page Z

Report Showing Formatting

Commands

6-160

DATABASE REFERENCE MANUAL


restore

db

Keyword:

restore

db

Type:

Control

Command

Purpose: The

(restore database)

restore

See Also: backup db, db


status, reorganize

db command

recreates a database.

processing reaches a restore


a series of prompts asking

you

to specify the drive

the database should be restored

any errors

Syntax:

Usage:

restore

db

When

db command, DataBase
and how you want

displays

on which
to

handle

occur during the restore procedure.

that

When you backup

a database using the

backup db command,

DataBase copies the database using a special format. The

backup copy can only be used


DataBase restore db

after

command

it

is

restored using the

or Maintenance

When you backup and

restore a database,

been deleted since the

last

all

menu

option.

records that have

backup and restore operation are

On

LAN

(Local Area Network),

if

another user

using any resource required by the restore

is

currently

db command,

DataBase displays a Resource Conflict message. While

message
the

is

this

displayed, DataBase automatically tries to execute

command

If you want
you must reboot

at brief intervals.

procedure during

When

on the Maintenance menu.

For more information on the


database backup and restore
procedures, see Volume 1,
Chapter 4. Database
Maintenance.

permanently erased.

LAN:

The restore db command


functions like selecting
Restore Database (Option 3)

this time,

becomes

the required resource

to abort the

the computer.

available,

DataBase

automatically resumes processing and executes the rest of the

procedure. See
for

Volume

2,

Chapter

more information on resource

4,

System Administration.

conflicts

and Multi-User

Locking Options.

Example:

record entry "CUSTOMERS"


run procedure "PRINT INVOICES"
.

backup db
restore db

This query tells DataBase: 1) Display the CUSTOMBRS form so the


operator can enter new customer records. 2) When the operator finishes
entering records, run the

PRINT INVOICES procedure. 3) Make a


When the backup procedure

backup copy of the current database. 4)

is

complete, begin the procedure to restore the database from the backup
copy.

6-161

Volume 3

DQL LEXICON
run procedure

Keyword: run procedure


Type:

Control

See Also: call menu, call

Command

program

Purpose: The run procedure command runs


Syntax:

run procedure

the specified procedure.

"PROCEDURE NAME"

The run procedure command automatically loads and runs

Usage:

previously defined procedure.

When

the procedure

finished, the Control Procedure automatically

the action following the

is

resumes with

run procedure command.

The procedure name can be

a constant or any expression

(including functions) that returns a text string.

Example:

record entry "CUSTOMERS"


run procedure "PRINT INVOICES"
db status

The run procedure command


functions like selectini; Run
Procedure (Option 1 ) on the
DQL or QBE - Quick Reports
menu. For details see Chapter
2, Defining, Modifying, and

Running Procedures

in this

manual.

DataBase: 1) Display the CUSTOMERS form so the


new customer records. 2) When the operator finishes
entering records, run the PRINT INVOICES procedure. 3) Display the
status of the current database.

This query

tells

operator can enter

Volume

6-162

DATABASE REFERENCE MANUAL


seconds
I

Keyword: seconds
Type:

Purpose: The seconds


expressed

Syntax:
Returns:

See Also: ampm. current.


hour, minutes, timeampm

Time Function

in

function extracts the seconds from a time value

24-hour format.

seconds(TIME VALUE)

An

integer value from

00

to 59.

Examples: seconds(09:15:34)
Returns:

34

seconds(02:53:20)
Returns: 20

seconds(CHECK-ouT time)
Returns the seconds value

in the checkout time field


every record that is processed. If a record
contains the value 07:30:25, the function returns 25.

for

6-163

Volumes

DQL LEXICON
Secondary Form
Keyword: Secondary Form
Type:

See Also: Ad-hoc


Relationship, all. output.
Primary Form, Relationships

Concept

Purpose: A form

Form

related to the Priman.'

is

called a

Secondary

form.

One form can be

Usage:

related to another

form by

predefined or an ad-hoc relationship.

Primary Form
a Secondary

is

called a

form

is

either a

form related

Secondary form.

to the

form related

to

called a Tertiary form. etc. There can be

any number of such relationship levels (see Figure 6-3 below).

When

processing the records

form can be accessed


forms.

in a

form, the data

mean

of. or

the related form.


in

The

in

another

a relationship exists between these

relational operator (all, any.

lowest of.

records

if

sum
all

of)

is

count

of.

highest of.

used to access the data

in

operator cannot be used to access

more than one form on any

relationship level

(i.e..

no more than one Secondan,- form, one Tertiary form.

etc.).

However, you can use the output command to access


more than one form on a particular

all

related records in

relationship level.

Prinary Forn

Secondary Forn

Tertiary Fern

Tertiary Forn

Figure 6-3

Volume

Secondary Forn

- Forms and

Tertiary Forn

Tertiary Forn

Relationship Levels

6-164

DATABASE REFERENCE MANUAL


Selection Criteria

Keyword:

Selection Criteria

Type:

Concept

Purpose:

In a quer>',

Sec Also: and, or, with.


Comparison Operators

you can

tell

specified form, or only

DataBase

some of

to select all the records in a

the records.

The

which records are selected

factors that determine

limiting
for

processing are called selection criteria.

The

tell DataBase to compare the value in the specified


each record to a comparison value that you specify in the query.
When the procedure is run, the records that meet the defined selection
criteria are processed. Records that do not meet the criteria are not

selection criteria

field in

processed.

For example, the statement:

CUSTOMERS

for

tells

DataBase

greater than

to process only the

500

in the

with

account balance > 500

CUSTOMBRS

ACCOUNT balance

There are two situations

in

which selection

records that have a value

field.

criteria

must be enclosed

in

parentheses:

Criteria

must be enclosed

in

parentheses

when used with

on the values stored

relational operator to select records based

in a

form other than the Primary form.

Example:

for

CUSTOMERS

with

(sum

of

INVOICES order

TOTAL > 500)


This statement

whose

related

tells

DataBase to process only the CUSTOMBRS records


have a combined ORDER TOTAL that is greater

INVOICBS

than 500.

2.

When two

sets

of selection criteria are combined with the and and

or operators, the

criteria

must be enclosed

in

parentheses to clarify

the meaning.

Example:

for

CUSTOMERS

with (state = "NY" or state = "NJ")

and account balance > 500


This statement
in either

that

is

6-165

tells

New York

DataBase
or

New

to

process only the

Jersey

CUSTOMBRS who

live

and who have an ACCOUNT balance

greater than 500.

Volume

DQL LEXICON
Sin

Keyword:

sin

Type:

Trigonometric Function

Purpose: The

See Also: acos.asin.atan,


COS. cosh. sinh. tan. tanh

sin function calculates the sine of an angle expressed in

radians.

Syntax:

sin(NUMERIC VALUE)

Returns:

numeric value.

Examples: sin(2.53)
Returns:

0.574172

sin(-3)

Returns:

Volume

-0.14112

6-166

DATABASE REFERENCE MANUAL


sinh

Keyword:

sinh (hyperbolic sine)

Type:

Trigonometric Function

See Also: acos, asin. atan,

Purpose: The sinh

cos, cosh, sin, tan, tanfi

function calculates the hyperbolic sine of an angle

expressed in radians.

Syntax:
Returns:

sinh(NUMERIC VALUE)

numeric value.

Examples: sinh(2.53)
Returns: 6.2369235
sinh(-4.4)
Returns: -40.71929

6-167

Volume

DQL LEXICON
Sorting

Sorting lets you process records and generate the resulting output in either
ascending or descending order based on the values in the specified field.

^^^ A/50; Grouping, in order,


in reverse

order operator sorts records in sequence from


value based on the type of field as follows:

The

in

Text: alphabetical order A-Z)

Number:

Date: earliest

Time:

Choice: lowest

least to greatest

numerical value

least to greatest

to latest date

earliest to latest time

Example:

for

to highest

STATES
list

records

STATE NAME
end

The output from

this

numbered choice

in

Order

query might look as follows:

STATE NAME
Alabama
Alaska
Arizona

Wyoming
The

in reverse operator sorts records in greatest to least sequence.


For example, if we change the third line of the query to:

STATE NAME
The output

is

in

reverse

reversed:

STATE NAME
Wyoming
Wisconsin

West

Virginia

Alabama

Volume

6-168

DATABASE REFERENCE MANUAL


spellcurrency

Keyword:

spellcurrency

Type:

Spell Function

Purpose: The spellcurrency

See Also: spelldate.


spellmonth. spellnumber,
spellweekday
function spells the monetary equivalent of

a numeric value.

Syntax:
Returns:

Examples

spellcurrency(NUMERIC VALUE)

text value

spellcurrency(36.25)
Returns: Thirty Six Dollars and 25 Cents

spellcurrency(210.00)
Returns: Two Hundred Ten Dollars and 00 Cents

spellcurrency(SALARY)
Returns the spelled-out currency amount in the salary
field for every record that is processed. If a record
contains the value 605.75, the function returns Six
Hundred and Five Dollars and Seventy-Five Cents.

6-169

Volume

DQL LEXICON
spelldate

Keyword:

spelldate

Type:

Spell Function

Purpose: The
Syntax:
Returns:

spelldate function spells a date value in

See Also: spellcurrency


spellmonth. spellnumber.
spellweekday

common

form.

spelldate(DATE VALUE)

text value.

Examples: spelldate(07/01/89)
Returns: July 1, 1989
spelldate( 12/31/89)
Returns: December 31, 1989

spelldate(highest of INVOICES date)


Returns: The spelled-out value in the most recent
invoice's date field. If the most recent INVOICES
record contains the value 10/31/89 in the date field,
the function returns October 31, 1989.

Volumes

6-170

DATABASE REFERENCE MANUAL


spellmonth

Keyword: spellmonth
Type:

See Also: spellcurrency.


spelldate. spellnumber,
spellweekday

Spell Function

Purpose: The spellmonth

function spells the

name

corresponds to a numeric value from

of the month that

(January) to 12

(December).

Syntax:

spellmonth(NUMERIC VALUE)

Returns:

Usage:

The

text value.

input value must be an integer between

and 12

(inclusive).

Examples: spellmonth(7)
Returns:

July

spellmonth(month(1 2/31/89)
Returns:

December

of INVOICES date))
Returns: The name of the month that corresponds to
the value in the most recent invoice's date field.
If the most recent INVOICES record contains the
value 10/31/89 in the date field, the function
returns October.

spellmonth(month(highest

6-171

Volume

DQL LEXICON
spellnumber

Keyword: spellnumber
Type:

See Also: spellcurrency.


spelldate. spellmonth.
spellweekday

Spell Function

Purpose: The spellnumber

function spells the integer portion of a

numeric value.

Syntax:

spellnumber(NUMERIC VALUE)

Returns:

Usage:

spellnumber accepts any number value up

text value.

to

2,147.483.647.

spellnumber(999999999) returns Nine Hundred Ninety Nine


Million, Nine

Hundred Ninety Nine Thousand, Nine Hundred

Ninety Nine.

Examples: spellnumber(3.45)
Returns: Three

spellnumber(323.45)
Returns: Three Hundred Twenty Three

spellnumber(cusTOMER

#)

Returns the spelled-out number in the customer #


field for every record that is processed. If a record
contains the value 309512, in the customer # field,
the function returns Three Hundred Nine Thousand
Five

Volume

Hundred Twelve.

6-172

DATABASE REFERENCE MANUAL


spellweekday

Keyword: spellweekday
Type:

See Also: spellcurrency.


spelldate. spellmonth,
spellnumber

Spell Function

Purpose: The spellweekday

name

function spells the

corresponds to a numeric value from

of the day that

(Monday)

to 7

(Sunday).

Syntax:
Returns:

spellweekday(NUMERIC VALUE)

text value.

Examples: spellweekday(5)
Returns: Friday

spellweekday(weekday(1 2/31/89)
Returns:

Sunday

spellweekday(weekday(highest of INVOICES date))


Returns: The name of the day that corresponds to the
value in the most recent invoice's date field.
If the most recent INVOICES record contains the
value 10/31/89 in the date field, the function
returns Tuesday.

6-173

Volume

DQL LEXICON
sqrt

Keyword:

sqrt (square root)

Type:

Scientific Function

See Also

exp. log. loglO.

power

Purpose: The

sqrt function calculates the square root of a numeric

value.

Syntax:

sqrt(NUMERIC VALUE)

Returns:

Usage:

The sqrt function should only be used on a

numeric value.

the input value

Examples:

is

negative, the result

is

positive value.

If

unpredictable.

sqrt(9)

Returns:

sqrt(16)
Returns:

Sqrt(FLOOR SPACE)
Returns the square root of the value in the floor
SPACE field for every record that is processed. If a
record contains the value 16000 in the floor space
field,

Volumes

the function returns 40.

6-174

DATAEASE REFERENCE MANUAL


Operators

Statistical

Keyword:

Statistical

Type:

Operator

Purpose:

Statistical
statistical

See Also: Conditional


Statistical Operators,
Relational Statistical
Operators

Operators

Operators (shown

at right) are

used to generate

information on number fields that appear as

list

items in a query.

Syntax:

FIELDNAME

statistical

operator

Statistical

Usage:

To

Operators

generate statistics on a field:

Item

by a colon.

1.

Insert the fieldname followed

2.

After the colon, insert the appropriate statistical operators.

3.

After the

last

max

operator, insert a semicolon or a period,

mean
min
std.dev.
std.err.

depending on the location of the operator


Statistical

field (Dollar, Integer,

You may

If

many

use as

you use any

fields.

each by a space.

operator and you want the field value

listed in addition to the statistical information,

Statistical

variance

operators as you want on a given field.

statistical

include the item

sum

Fixed Point, and Floating Point).

after another, separating

Each

query.

Operators can be used on any type of number

They cannot be used on Numeric String

one

in the

operator after the field

Operator

is

you must

name.

treated as a separate entry in this

Lexicon.

6-175

Volume

DQL LEXICON
std.dev.

Keyword:

std.dev. (standard deviation)

Type:

Statistical

Purpose: The

See Also: item, max, mean,


min, std.err.. sum. variance

Operator

std.dev. operator calculates the standard deviation (the

square root of the variance) in a set of data. The result


usually appears as a statistic in the

end of a

value

Syntax:

summary

area at the

report.

std.dev. [other statistical operators]

Returns:

Usage:

Standard deviation

numeric value.

set

of data

is

(68% of

used as an indicator of variability

the data set

is

contained

in a

in the first

standard deviation).

The

std.dev. operator can also be used in Quick Reports.

To

generate the standard deviation in a Quick Report, type


std.dev. in the selected

Example:

for

CUSTOMERS

field area.

list

with

records
last name in order

account balance > 500

list

ACCOUNT BALANCE

item

sum

std.dev.

end
This query tells DataBase: 1) Process
have a value greater than $500 in the
the customers by

LAST NAME

all

the

CUSTOMERS

ACCOUNT BALANCE

in alphabetical order.

records that

field.

2) List

3) List each

customer's ACCOUNT balance amount, the sum of these amounts, and the
standard deviation in the report output.

The output from

LAST NAME

this

query might look as follows:

ACCOUNT BALANCE

Adams

$595.00
$725.00
$865.00
$525.00
$675.00

Cooper
Evans
Hill

Ivers

SUM ACCOUNT BALANCE


STD.DEV.

Volume

IN

DATA SET

$3,385.00
$129.88

6-176

DATAEASE REFERENCE MANUAL


std.err.

Keyword:

std.err.

Type:

Statistical

Purpose: The

See Also: item, max, mean,


min, std.dev., sum, variance

Operator

std.err. operator calculates the standard error (the

standard deviation divided by the square root of the

of items)

in a set

statistic in the

Syntax:

value

number

of data. The result usually appears as a

summary

area at the end of a report.

std.err. [other statistical operators]

Returns:

Usage:

Standard error

numeric value.

of data;

if

is

used as an indicator of variability in a subset

the standard error of the

overlap, the subsets

same data

The

may

mean

of two data sets

be considered to be

members of

the

set.

std.err. operator can also be used in

Quick Reports. To

generate the standard error in a Quick Report, type std.err.


the selected

Example:

for

list

CUSTOMERS
list

in

field area.

with

account balance > 500

records

LAST name

in

order

ACCOUNT balance
end

item

sum

std.dev. std.err.

This query tells DataBase: 1) Process all the CUSTOMERS records that
have a value greater than $500 in the ACCOUNT balance field. 2) List
the customers by last name in alphabetical order. 3) List each
customer's ACCOUNT balance and include the standard deviation,
standard error, and the sum of all the account balance amounts in the
report output. The output from this query might look as follows:

LAST NAME

ACCOUNT BALANCE

Adams

~$595T00
$725.00
$865.00
$525.00

Cooper
Evans
Hill

$675.00

Ivers

SUM ACCOUNT BALANCE


STD.DEV.
STD.ERR.

6-177

IN
IN

DATA SET
DATA SET

$3,385.00
$129.88
$58.09

Volume 3

DQL LEXICON
sum
Keyword: sum
Type:

Statistical

Purpose: The sum


all

operator adds the values in a specified field

among

the records that are processed.

value sum

Syntax:

See Also: item, max, mean,


min, std.dev., std.err., variance

Operator

[other statistical operators]

Returns:

Usage:

The value returned by

numeric value

where

it

appears

defined by

the

sum

in the report

operator differs depending on

The sum value

format.

statistical
its

position as follows:

operator

Running

the last item

on

through the

total

Items:

Running

Group Header:
Group Trailer:

Not applicable
Sub-total for group

item on

End:

Report grand

CUSTOMERS
list

with

through the current item

total

sum

of.

returns the total of the


values in the specified field

among
last

the current page

for

sum and

sum

the previous page

Footer;

operator

the relational statistical

Not applicable
Running total through

Report Header:
Header:

Example:

There's an important
difference hetv,een the

is

the records being

processed,

sum of returns

the total of the values in


the specified field among the

records related to the records


being processed.

total

ACCOUNT balance > 500

records

last name in order


ACCOUNT balance

item

sum

end
This query tells DataBase: 1) Process all the CUSTOMERS records that
have a value greater than $500 in the ACCOUNT BALANCE field. 2) List
the customers by last name in alphabetical order. 3) List each

ACCOUNT balance and include the sum of all the account


BALANCE amounts in the report output. The output from this query might

customer's

look as follows:

LAST NAME

ACCOUNT BALANCE

Adams

$595.00
$725.00
$865.00
$525.00
$675.00

Cooper
Evans
Hill

Ivers

SUM ACCOUNT BALANCE


Volume

$3,385.00

6-178

DATAEASE REFERENCE MANUAL


sum

of

Keyword: sum
Type:

of

See Also: all. any. count of.


highest of. lowest of, mean of,

Relational Statistical Operator

named.

Purpose: The sum of operator adds


matching records
a

list

item

summary

the values in a specified field in

in a related

form.

The

result

can appear as

area of the report or as a statistic

in the detail

all

in

the

area at the end of each group or the end of the

report.

Syntax:

Returns:

sum of FORMNAME RELATIONSHIP [named "UNIQUE


RELATIONSHIP NAME"] [with (selection criteria)] FIELDNAME
|

Example:

numeric value.
for

CUSTOMERS

There's an important
difference between the
;

statistical

records
LAST NAME in order
list

sum

of

operator

INVOICES order total

of.

among

the records being

sum of returns
of the values in the

processed,
the total

specified field

among

the

records related to the records


being processed.

records.

The output from

LAST NAME

this

query might look as follows:

SUM OF INVOICES ORDER TOTAL

Adams

$595.00
$725.00
$865.00
$525.00
$675.00

Cooper
Evans
Hill

Ivers

you want

sum

returns the total of the


values in the specified field

This query tells DataBase: 1) FVocess all the CUSTOMERS records and
list each customer's last name in alphabetical order. 2) For each
CUSTOMERS record processed, find all the related records in the
INVOICES form (those that have the same CUSTOMER #). 3) List the sum
of the ORDER total field for each customer in the set of matching

If

sum and

sum

end

INVOICES

operator

the relational statistical

to include the

sum of

this

whole group of invoices, change

the

fourth line of the query to read:

sum

6-179

of

INVOICES order total

item

sum

Volume

DQL

LEXICON

tan

Keyword:

tan (tangent)

Type:

Trigonometric Function

Purpose: The tan

See Also: acos, asin, atan,


cos, cosh, sin, sinh, tanh

function calculates the tangent of an angle expressed

in radians.

Syntax:

tan(NUMERIC VALUE)

Returns:

numeric value.

Examples: tan(2.53)
Returns:

-0.701292

tan(-1.89)
Returns: -3.025665

Volume

6-180

DATABASE REFERENCE MANUAL


tanh

Keyword: tanh

(hyperbolic tangent)

See Also: acos, asin, atan,

cos, cosh, sin, sinh, tan

Type:

Trigonometric Function

Purpose: The tanh

function calculates the hyperbolic tangent of an

angle expressed

Syntax:
Returns:

in radians.

tan(NUMERIC VALUE)

numeric value.

Examples: tanh(2.53)
Returns:

0.987388

tanh(1.45)
Returns; -0.895692

6-181

Volume

DQL LEXICON
temp
Keyword: temp
See Also: assign, define,
global, variable

Keyword

Type:

Purpose: The keyword temp


temp VARIABLE

Syntax:

Usage:

NAME

Tiie iceyword

temp

used

variable

is

specifies a temporary variable.

specifies a temporary variable.

to store a value

such as a text string or a

calculated result that can change during the processing of a

procedure.

By

specifying the variable's name, the stored

value can be used like any other value in a query.

The status of a variable can be global (denoted by the


keyword global) or temporary (denoted by the keyword
temp).

temporary variable can only hold a value during the current

procedure.

A global

variable can pass

another.

To

variable

must be defined

Example:

define
for

its

value from one procedure to

pass a value from one procedure to another, a


identically in each procedure.

temp "DISCOUNT" Number

INVOICES

with

order total > 500

assign temp DISCOUNT


modify records

ORDER total

;=

:=

(ORDER total

(ORDER TOTAL

0.15)

temp DISCOUNT)

end
This query

DataEase: 1) Create (define) a temporary variable called


number while processing the current query.
2) Give (assign) the DISCOUNT variable a number value determined by
multiplying the order total on each invoice by 15%. 3) Find all the
INVOICES records that have a value greater than $500 in the ORDER
tells

DISCOUNT

TOTAL
of the

field.

to store a

4)

Modify these INVOICES records by subtracting the value


variable from the value in the ORDER TOTAL field.

DISCOUNT

Volume

6-182

DAT

EASE REFERENCE MANUAL

textpos

Keyword:

textpos

Type:

Text Function

See Also: firstcfirstlast,


firstw,jointext, lastc, lastfirst,
lastw, length, lower, midc,

Purpose: The textpos

function returns the

first

position of a substring in

midw, proper, upper

a specified text value.

Syntax:
Returns:

textpos(TEXT value, substring)

An

integer value that indicates the position where the

substring begins in the specified value.

Usage:

The textpos function is not case sensitive (no


made between upper and lower case letters).
If the

substring

is

contained

distinction

is

in the specified text value, the

starting position of the first (leftmost) character in the

substring
If the

is

returned.

substring

returns 0.

is

not contained

in the text value, the

function

Intervening spaces and punctuation symbols are

included in the calculation. Trailing spaces are ignored.

Examples: textpos("DataEase", "Ease")


Returns: 5

textpos("DataEase International

Inc.", "national")

Returns: 15

textpOS(BOOK

TITLE, "wi"),

position of the string wi in every


record that is processed. If a record contains the
value Gone With The Wind in the book title field,
the function returns 6.

Returns the

first

6-183

Volume

DQL

LEXICON

timeampm
Keyword: timeampm
Type:

Time Function

Purpose: The timeampm

See Also: ampm, current,


hours, minutes, seconds
function converts a time value from a

24-hour format
appropriate

Syntax:

to a

2-hour format and appends the

AM or PM designation.

timeampm(TIME VALUE)

Returns:

text value representing the

of either

Usage:

AM

or

2-hour clock time with a suffix

PM.

Converts time values from midnight (00:00:00)

AM.

to

Converts time values from noon (12:00:001

to

:59:59 to

23:59:59

toPM.

Examples: timeampm(1 3:53:1 2)


Returns

01:53:12

timeampm(1
Returns:

1:1

PM

0:30)

11:10:30

AM

timeampm(CHECK-ouT

time)

Returns the value in the checkout time field in the


12-hour clock format and adds the correct suffix for
every record that is processed. If a record contains
the value 19:30:25 in the check-out time field, the
function returns 07:30:25 PM.

Volume

6-184

DATAEASE REFERENCE MANUAL


Transaction Processing

Keyword: Transaction Processing


Type:

Concept

Purpose: Transaction Processing

is

modify, and delete records


a single form.

a technique that lets


in multiple

you

enter.

forms using input from

transaction processing procedure lets

update the information

in the

you

database without having to

physically enter the data into each form in record entry mode.

Because

it

saves time and reduces the possibility of keying

errors, transaction processing

is

widely used for point-of-sale

applications to automate customer billing and inventory

maintenance.

Usage:

With DataBase, each transaction is entered using the


Data-entry form or the input command. After the data
entered,

it is

processed by a predefined

DQL

is

Procedure that

automatically posts the information into the appropriate


related forms.

The High Level Control procedure presented

in Chapter 4 of
manual demonstrates the use of transaction processing in
a mail-order business that uses a special Order Entry form to

this

post information into several database forms (as

shown below).

DQL LEXICON
unlock

Keyword: unlock
Type:

See Also: lock, lock db. query


selection, unlock db

Processing

Command

Purpose: The unlock command


DataBase on a

command

LAN

is

when running

only functional

(Local Area Network). The unlock

unlocks locked forms or records allowing other

users full access to the data.

Syntax:

unlock

all files

The unlock

file

selected record

command

all files

by the procedure.

If

unlock

unlocks all forms referenced

all files is the first

statement

the query, the default locking rules are overridden and


is

locked by individual records.

You may

selective basis using the lock file

The unlock

file

command

lock

command.

files statement, the

In a

data

lock forms on a

command.

unlocks the specified form for the

duration of the procedure, or until the same form


in a

all

in

is

specified

query that begins with a lock

unlock

file

command

lets

all

you unlock

The default LAN Multi-User


Locking Options entered on
the System Configuration form
resolve conflicts that arise

when users attempt to view,


modify, or delete records in a
form at the same time the form
is being accessed by a report
queiy. For more information
see Volume 2. Chapter 4.
System Administration.

forms selectively, while the other forms referenced by the


query remain locked.

The unlock selected records command unlocks

the record

that is currently being processed.

locking rules

are overridden by an

unlock

If the default

unlock

all files or

file

command,

DataBase automatically locks a record from the time


selected for processing until the next record

is

it

is

selected.

Often, significant processing not involving the locked record

may

take place.

By

using the lock and unlock selected

record commands, you can reduce the amount of time a


record remains locked.

LAN:

On

LAN

(Local Area Network),

if

another user

using a resource required by the unlock


displays a Resource Conflict message.
is

at brief intervals.

procedure during

->

currently

While

this

message

displayed, DataBase automatically tries to execute the

command

Volume

is

command, DataBase

this time,

If you want to abort the


you must reboot the computer.

This entry continues on the next page

6-186

DATABASE REFERENCE MANUAL


unlock (cont.)

When

LAN:

the required resource

becomes

available,

DataEase

automatically resumes processing and executes the rest of the

See Volume

procedure.
for

2,

Chapter

more information on resource

4.

System Administration.

conflicts

and Multi-User

Locking Options.

Usage:

The unlock command overrides

the default query processing

locking rules assigned by the database administrator.


In order to override the default locking rules, the first

statement of the query must be either lock


all

filesorms.

at the start

LAN

If neither

of these

all files or

commands

of the query, the default locking rules govern

command
commands are

functioning until a lock or unlock


All lock and unlock

query.

in the

unlock

appears

appears

automatically terminated at the end of a query.

Example:

lock form
for

INVOICES shared

CUSTOMERS

with

ORDER TOTAL > 500)

of

INVOICES

lock selected record

records
LAST NAME

(sum

list

ACCOUNT BALANCE
unlock selected record

end
for

CUSTOMERS

with (highest of

dated < 01/01/80)


delete records

INVOICES

end
tell DataEase: 1) Lock the INVOICES form so other users can
view records but cannot add, delete or modify INVOICES records during

This query

the processing of this procedure.

whose

2) Select all the

CUSTOMERS

records

INVOICES

records have a combined ORDER TOTAL greater


than $500. 3) Lock each record as it is selected for further processing.
related

For each record selected, list the customer's last name and account
BALANCE. After each record is listed, unlock the record before continuing
to the next part of the query.

Locking the INVOICES form at the start of this procedure prevents other
users from entering new records that might alter the sum of calculation.
Locking and unlocking each CUSTOMERS record as it is listed prevents
the ACCOUNT BALANCE information from being modified by another user.

6-187

Volume

DQL LEXICON
unlock db

Keyword: unlock db
Type:

Control

(unlock database)

See Also: lock, lock db, query


selection, unlock

Command

Purpose: The unlock db command


DataBase on a

LAN

is

when running
db

only functional

(Local Area Network). The unlock

cancels the effect of the lock

db command;

it

unlocks a

locked database.

Syntax:

unlock db

Returns:

confirmation message appears on the screen as soon as the

database

On

LAN:

unlocked.

is

LAN

(Local Area Network),

if

another user

using a resource required by the unlock

is

currently

db command.

DataBase displays a Resource Conflict message. While


message
is

this

displayed. DataBase automatically tries to execute the

command

at brief intervals.

procedure during

When

this time,

the required resource

If you want to abort the


you must reboot the computer.

becomes

available,

DataBase

automatically resumes processing and executes the rest of


the procedure.

See Volume

2.

Chapter

4.

System

There's an important
dijference between the unlock
Processing command and the

unlock db Control command.


The unlock Processing
command can he used to
unlock individual forms or
records during a Processing
procedure. The unlock db
command is used to cancel the
effect of the lock db Control

command;

it

unlocks the

whole database.

Administration, for more information on resource conflicts

and Multi-User Locking Options.

Once

Usage:

a database

locked

who

user

Example:

until

lock

db

is

db command it remains
db command is executed or until the
lock db command exits from DataBase.

locked by the lock

an unlock

initiated the

record entry "CUSTOMERS"


run procedure "PRINT INVOICES"
unlock db
.

This query

tells

CUSTOMBRS
3)

When

DataBase:

1)

Lock

the current database.

2) Display the

form so an operator can enter new customer records.

the operator finishes entering records, run the

PRINT INVOICBS

procedure. 4) Unlock the current database.

Volume

6-188

DATABASE REFERENCE MANUAL

upper

Keyword: upper
See Also:

Type:

Text Function

Purpose: The upper

firstc.firstlast.

firstw.jointext. lastc. lastfirst,


lastw. length, lower, midc,

function converts each letter in a text value to

midw.

textpos.

uppercase.

Syntax:
Returns:

upper(TEXT VALUE)

The

specified text value with

all

the letters in uppercase.

The upper function only affects the alphabetical letters A-Z.


Numeric values are noi converted to their Shift key
equivalents.

Examples: upper("DataEase")
Returns:

DATABASE

upper("Washington D.C.")
Returns:

WASHINGTON

D.C.

Upper(LAST NAME)
Returns the value

in the last name field in uppercase


type for every record that is processed. If a record
contains the value holmes in the last name field, the

function returns

6-189

HOLMES.

Volume

DQL LEXICON
value

Keyword:

value

Type:

Keyword

See Also: case, others

Purpose: The value keyword


syntax.

When

compares

is

component of

processing a case

the case

command

command, DataBase

the expression that follows case to each of the

statements specified by the keyword value in the order these

appear

query.

in the

comparison,

When DataBase

executes

it

reaches the

the actions

all

between

that value

statement and the next.


If

The keyword value

Interactive

none of the specified value comparisons are

true,

is

automatically inserted after


the case expression is
specified in High Level

first true

Mode.

DataBase

executes the actions specified after the keyword others. As

soon as the actions following any value or others statement


are executed, processing passes to the first action following

the

Syntax:

end command

for the case statement.

case (EXPRESSION)

COMPARISON

value

ACTION SERIES1.
[value

COMPARISON

ACTION SERIES

[value

COMPARISON N

2.1

ACTION SERIES N]
[others

OTHERS ACTION

SERIES.]

end

The case command

Usage:

requires a case expression, one


comparison value, and an end command. Subsequent value

statements, actions, and the others

others

is

used,

it

must follow

all

keyword

are optional.

If

the specified comparison

values.

Example:

case (current user name)


value

"FRANK"
menu "ADMINISTRATION"
:

call

others

call

menu "MAIN"

end
This query tells DataBase: If the current user is Frank, display the
Administration menu. If the current user is anyone other than Frank,
display the

Volume

Main Menu.

6-190

DATABASE REFERENCE MANUAL


variance

Keyword:

variance

Type:

Statistical

See Also: item, max, mean,

Operator

Purpose: The variance

mitt, std.dev., std.err..

operator calculates the average of the squared

mean

deviations from the

(the average of the squared

difference between each item value and the


set

of data. The result usually appears as a

summary

sum

mean

value)

in

statistic in the

area at the end of each group or the end of the

report.

Syntax:

VALUE

variance [other

Returns:

Usage:

Variance

statistical

operators]

numeric value.
is

used as an indicator of variability

The variance operator can

also be used in

in

a set of data.

Quick Reports. To

generate the variance in a Quick Report, type variance in the


selected

Example:

for

list

field area.

CUSTOMERS

with

records
LAST NAME in order

account balance > 500

list

ACCOUNT BALANCE
end

item

mean sum

variance

This query tells DataBase: 1) Process all the CUSTOMERS records that
have a value greater than $500 in the account balance field. 2) List the
customers by last name in alphabetical order. 3) List each customer's

ACCOUNT balance and include the mean, sum, and


account balance amounts in the report output.
The output from

LAST NAME

this

variance of

all

the

query might look as follows:

ACCOUNT BALANCE

Adams

$595.00
$725.00
$865.00
$525.00
$675.00

Cooper
Evans
Hill

Ivers

MEAN ACCOUNT BALANCE


SUM ACCOUNT BALANCE
VARIANCE

6-19!

IN

DATA SET

$677.00
$3,385.00
$16,870.00

Volume

LEXICON

DQL
variable

Keyword:

variable

Type:

Concept

See Also: assign, current,


define, global,

Purpose: A variable

is

a substitute for another value.

In a query, a variable

can be substituted for any expression

any type of

that returns a value or for


field.

Often a variable

is

field

except a Choice

used to store a numeric value that

can change during the processing of a procedure


running

total

temp

when adding

column of

value can be used like any other value

figures).
in the

(like a

The

query;

stored
it is

referenced by the variable's name.

The define command is used to create and name a variable.


The name of a variable can be any unique name you like, up
to 20 characters in length. The name must be enclosed in
quotes when it first appears in the define command.

Usage:

The assign command

value.

used to give a variable an

is

initial

variable can be assigned to hold any type of value

except a Choice field value.

The

status of a variable

is

either current, global or temporary.

The current system variables

are built-in variables that hold

commonly used system values such


time, current user name, etc.

2.

global variable can pass

another. In order to

do

its

current

value from one procedure to

this, the

identically in each procedure in

3.

as current date,

variable must be defined

which

it

is

used.

temporary variable can only store a value during a single

procedure.

There

is

a separate entry

in this

lexicon for each of these

groups.

Volume

6-192

DAT

EASE REFERENCE MANUAL

weekday
Keyword: weekday
Type:

Date Function

See Also: current, date. day.


Julian, month, spelldate.

Purpose: The weekday

function converts a date value to an integer that

corresponds to the day of the week from

(Monday)

to 7

spellmonth. spellweekday,
year, yearday. yeanveek

(Sunday).

Syntax:
Returns:

weekday(DATE VALUE)

An

integer value

from

to 7.

Examples: weekday(l 2/31/89)


Returns: 7

spellweekday(weekday(1 2/31 /89))


Returns: Sunday

weekday(DATE)
Converts the value in the date field into an integer
from 1 to 7 for every record that is processed. If a
record contains the value 10/31/89 (a Tuesday),
the function returns 2.

6-193

Volume

DQL LEXICON
while

Keyword:

while

Type:

Procedural

Purpose: Like

the if

See Also: case, for,

Command
command,

the while

command

executes a series of

actions based on whether a specified condition

command,

the if
in

which actions

the while

command

if

is

Unlike

true.

creates a processing loop

are executed repeatedly as long as the

specified condition remains true.

When

processing reaches a while

command. DataBase

evaluates the condition that follows the keyword while.

condition

If the specified

actions that follow the

is

true.

DataBase executes

keyword do

until

it

the

all

reaches the

corresponding end command.

DataBase then reevalutes the original condition.


condition

is still true,

again. If the condition

action

Syntax:

while

foUowine

the

If the

DataBase executes the do action


is

series

false, processing passes to the first

end command

for the while statement.

CONDITION do
ACTION
ACTION 2
1

ACTION N
end

Usage:

Brequently, a while
that

is

command

specifies an initial condition

modified during each pass through the loop

counter).

Any

reevaluated must be included in the loop

precede the end


>

Volume

(i.e.,

action that modifies the value to be

command

(i.e., it

must

that terminates the loop.)

This entry continue on the next page

6-194

DATAEASE REFERENCE MANUAL


while (cont.)

Example:

define

temp "SERIAL" Number

assign temp

SERIAL

:=

temp SERIAL < 1000 do


temp SERIAL := temp SERIAL +

while

list

records

jointext

("SYSTEM DISK

",

temp SERIAL)

end
This query

SERIAL.

tells

2)

DataEase:

1)

Give (assign) an

Create (define) a temporary variable called


initial value of
to the SERIAL variable.

3) Print a series of labels joining the


that

is

labels,

5)

the current value of the

words

SERIAL

SYSTEM DISK

variable.

4)

to the

number

While printing the

increment the variable by one each time a new label is printed.


the value of the variable reaches 1000, stop printing labels.

When

The while command

tells DataEase to reevaluate the value of the variable


each time it prints a label. As long as that value is less than 1000,
DataEase prints another label. When the value of the variable reaches
1000, DataEase stops performing the action following the do keyword.

6-195

Volume

DQL LEXICON
with

Keyword: with
See Also: and,

Type:

Purpose: The with


a

Syntax:

form or

with

Usage:

operator specifies the criteria for selecting records

in

a relationship.

(SELECTION CRITERIA)

The with operator


all

or, Selection

Criteria

Operator

tells

DataBase

some rather than


The records that are

to process

the records in the specified form.

selected for processing are those that satisfy the selection


criteria that follow the

Example

1: for

This statement

CUSTOMERS

tells

2: delete

tells

relationship (the

Volume

account balance > 500

$500

in the

CUSTOMERS

ACCOUNT balance

records in INVOICES
< 01/01/80)

with (DATE

This statement

with

DataBase: Process only those

that contain a value greater than

Example

with operator.

records
field.

named "OUTDATED"

DataBase: Delete the records in the "OUTDATED"


records that are dated before 01/01/1980).

INVOICES

6-196

DATABASE REFERENCE MANUAL


year

Keyword: vear
Type:

Purpose: The year


Syntax:
Returns:

See Also: current, dale, day,

Date Function

Julian, month, spelldate,

function extracts the year from a date value.

spellmonth, spellweekday,
yearday, yearweek

year(DATE VALUE)

An

integer value from

selected in

to 99 (inclusive). The date format


System Administration changes the date sequence

but does not affect which value

is

returned by a Date function.

Examples: year( 12/31/89)


Returns: 89 (North American Format)
year(31/12/89)
Returns: 89 (European Format)
year(89/12/31)
Returns: 89 (Metric Format)

year(DATE)
Converts the year portion of the value in the date field
into an integer from
to 99 for every record that is
processed. If a record contains the value 12/31/89 in
the DATE

6-197

field,

the function returns 89.

Volume

LEXICON

DQL
yearday

Keyword: yearday
See Also: current, date, day,

Type:

Date Function

Purpose: The yearday

Julian, month, spelldate,

function converts a date value to the Julian day

spellmonth, spellweekday,
year, yearweek

of the year (1-366).

Syntax:

yearday(DATE VALUE)

Returns:

An

from to 366 (inclusive). The date format


System Administration changes the date sequence

integer value

selected in

but does not affect which value

is

returned by a Date function.

Examples: yearday(1 2/31/89)


Returns: 365 (North American Format)
yearday(31/12/89)
Returns: 365 (European Format)
yearday(89/l2/31)
Returns:

365 (Metric Format)

yearday(DATE)
Converts the day portion of the value in the date field
into an integer from 1 to 366, representing the Julian
date, for every record that is processed. If a record
contains the value 12/31/88 (A Leap Year)
DATE field, the function returns 366.

Volume

in

the

6-198

DATABASE REFERENCE MANUAL


yearweek
Keyword: yearweek
See Also: current, date, day,

Type:

Date Function

Purpose: The yearweek

Julian, month, spelldate,

function calculates the

week number

(1-53) of

spellmonth, spellweekday,
year, yearday

a date value.

Syntax:

Returns:

yearweek(DATE VALUE)

An

from 1 to 53 (inclusive). The date format


System Administration changes the date sequence
but does not affect which value is returned by a Date function.
interger value

selected in

Usage:

This yearweek function always counts January

Week

1,

January 8th- 14th as

Year, the only day


Year,

in

December 30th

Week
is

Week

53

is

2. etc.

In a

December

also counted in

1st -7th as

non-Leap

31st. In a

Week

53

(all

Leap

dates

following February 28 are affected by leap year.)

Examples: yearweek(0 1/0 1/89)


Returns:

yearweek( 12/30/89)
Returns:

52 (North American Format)

yearweek(30/1 2/89)
Returns: 52 (European Format)
yearweek(89/1 2/30)
Returns: 52 (Metric Format)

yearweek(DATE)
Converts the day portion of the value in the date field
into an integer from 1 to 53, representing the week of
the year, for every record that is processed. If a
record contains the value 12/30/87 (A Leap Year)
the date field, the function returns 53.

6-199

in

Volume 3

DATABASE REFERENCE MANUAL


INDEX
Entries in this index are referenced hy the volume
number followed hy the page numher(s). For

example, the entry:

Database Status

1:4-2, 1:4-4- 1:4-6.3:6-57

means you can find information on database status in


Volume 1 on page 4-2 and pages 4-4 through 4-6 and
in Volume 3 on page 6-57.
Entries that contain the letters IG indicate that
information on that topic can also he found in the
Installation

and New Features Guide.

* multiplication sign

INDEX
=

3:6-16

(equal)

1:3-14

as a record selection operator

2:A-2

cache buffer
effect on performance

optimum

2:D-3

2:A-2

size

2:2-64, 2:2-73

calculate
call

menu

call

program

calling

2:3-3,3:6-35
3:6-36

menu

3:6-39,3:6-190
3:6-40

ceil

Chain menu

Change

3:6-16

2:3-3,2:3-8.2:3-29

the Database

Name

2:5-4. 2:5-57
1:1-3

chapter narrative sections

1:1-3

chapter reference sections

3:6-32

3:6-135

not
compatibility with version

3:1-3, 3:6-62

3:6-50

3:6-102

percent

3:6-144

configuration

See Define Configuration, System Configuration


context-sensitive help
control

Type

2:2-52

2:2-55

2:2-52

field

advantages

3:3-5. 3:6-45

1:1-4

commands

3:4-1.3:6-46

backup db

3:6-31

2:3-9

call

menu

2:2-55

call

program

2:2-54

db

2:2-102- 2:2-104

changing choice order

3:6-44

item

1:4-27

Choice Description

3:6-43

count

Check Data Disk


Choice

3:6-63.

3:6-194-3:6-195

constant value

3:6-35

3:6-36-3:6-37
3:6-57

status

3:6-90

import

2-55

install

2-55

lock

during field definition

2-52

record entry

3:6-156

during Import

5-14

reorganize

3:6-159

2-53

restore

2-55

run procedure

choice

1:,

choice

2: etc.

choice numbers

during Record Entryl :2-5.

:2-34

:2-35

entering choice values


in report

2-55

ordering

2-53

limitations

2:2-55.2:2-102- 2:2-104
modify
2:2-102- 2:2-104
modifying choice values
optional choice type

name

2:2-54
2:2-52 -2:2-53

selecting a choice

Columnar format

:3-4.

:3-28.

:3-35

1:3-36

3:5-4-3:5-5,3:5-8 -3:5-11

group headers and

trailers

line length

spacing
statistics

commands

3:5-12. 1:3-36
3:5-9. 1:3-36

3:5-8

3:5-12
3:4-1

list

3:4-1

restrictions

3:4-1

types

3:4-1

comments
comparison operators
< (less than)

<=

2:4-27

conditional statistical operators

2:4-33

Choice

2.

conditional processing

characters per inch

Field

3:6-17

or equal to)

between

2:3-12

3:4-14-3:4-15,3:6-38

case

3:6-37

> (greater than)


>= (greater than

(less than or equal to)

3:6-17,3:6-41

3:3-5,3:6-15,3:6-42
3:6-15
3:6-15

3:6-99

appl

3:6-113-3:6-114

db

3:6-161

db

3:6-162
3:6-188

unlock db

2:3-3.3:1-3.3:4-1.

control procedure

3:4-21 -3:4-24,3:6-46

High

level

3:4-2

example

2:4-34

control strings

convert an application

2:5-56

2:5-37, 2:5-46

2:5-46

conversion procedure

dBASE
files

2:5-37. 2:5-46

2:5-56
2:5-49

converted

2:5-56

installing a converted application

Lotus 1-2-3
Lotus

Symphony

2:5-56

2:5-37.2:5-46
2:5-37, 2:5-46

2:5-56

2:5-55
messages displayed during conversion
2:5-37. 2:5-46 2:5-56
Paradox

performing the conversion


selecting Lotus ranges to convert

2:5-54

selecting the files to convert

2:5-51

specifying the source directory

2:5-50

2:5-52

converting a Quick Report to a

DQL Procedure

1:3-50

1:3-51

DATABASE REFERENCE MANUAL


copy block

DATABASE REFERENCE MANUAL


grouping

DATAEASE REFERENCE MANUAL


processing

commands

INDEX
exception

2:2-100

files

2:5-16

during Import

3:6-67

exit

EXIT menu
in

Form

in

Record Entry

Definition

exp
expanded memory
effect on performance
use of

2 2-18
1

2-18

3 6-68

2:A-3, 2:D-3

2:A-3
1:3-4

1:3-28,3:5-5.3:5-27

Export formats

DIE

3:5-27, 3:5-39

Fixed Length ASCII


Lotus 1-2-3

3:5-27, 3:5-35

MailMerge

3:5-27

MultiMate
Variable Length ASCII
WordPerfect

3:5-27.3:5-30

3:5-36-3:5-37
3:5-27,3:5-31 -3:5-32
3:5-27

exporting data
set

2:2-26

calls

2:A-3

extended character

program

3:5-38

3:5-33-3:5-34

GrafTalk

field

1:2-17-

1:1-7.

Export

external

2:2-17

DATABASE REFERENCE MANUAL


Field Per Line tornia

DATABASE REFERENCE MANUAL


greater than or equal to

INDEX
inconsistent form

DATABASE REFERENCE MANUAL


Load Procedure

DATABASE REFERENCE MANUAL


for forms

2:2-14

nested actions

3:4-6,3:6-134

1:3-3. 1:3-20

order
ordering

3:6-135

in

null value

3:6-33

others

NUM LOCK key

1:1-16

output

not

1:3-20

Quick Reports

3:6-38,3 :6-138

3:5-1.3:5-40,3 5-59,

Number

3:6-

2 2-45

Type

Number field
compared

2 2-46

2:2-45
to

2 2-46

Numeric String

digits of precision

2:

2:5-14, 2:5-26

during Import

2-45

2 5-27

Fixed Point

2:

2-45

2 2-45

Floating Point
in

139-3:6-143,3 :6-l60

See also Define Format

3 6-52

current page
Field

1:3-13

as a record selection operator

naming conventions

Record Entry

2-34

2 2-45

Integer

2 2-97
2 2-45

modify
system provided characters

3:5-53. 3:5-69

page break
page dimensions
page length
page numbering

3:5-70.3:5-76
3:5-76
3:6-52

in a report

3:5-69

page size
page width

3:5-76
2:3-23

parameter substitution

1:1-16

description of

1:1-8- 1:1-9
2:2-21

paste text

3:6-144

percent

Numeric String
Field Type

2:2-43
2:2-43

formatted

2:2-44

2:2-44

2:2-44

other format

phone no.

2:2-43

soc. sec. no.

2:2-43

2:2-44

special punctuation

Numeric String field


compared to Number

2:2-43

2:2-44. 2:2-46

2:2-46

field

2:5-14

during import

2:2-44

in calculations

Record Entry
modify

1:2-32

in

:2-33

2:2-97

2:3-24
2:4-19

parity

password

numeric keypad

2:D-1 -2:D-3

performance factors

3:6-145

periods

2:2-10

permanent relationships

number
when defining configuration
power

port

2:4-17

3:6-146
3:5-2

predefined format

2:2-10.2:2-109

Predefined Relationship

3:6-147

presentvalue

Prevent Data-entry field 2:2-5. 2:2 -35.2:2-70-2:2-71


1:2-5. 1:2-40
in Record Entry

2:2-100

modify
1:2-42-

primary form

:2-44, 1:3-8. 1:3-22

3:3-3-3:3- 4,3:6-148.3:6-164

form definition
example

print

2:5-6

One-time Import

3:6-42-3:6-44,3:6-136

operators

assignment

3:6-14

boolean

3:6-25

comparison
grouping

3:6-15- 3:6-17
3:6-81

3:6-82.3:6-91

3:6-93

sorting

optional choice type

name

optional relationship

names

XV

Print Report Definition

1:3-2. 1:3-5- 1:3-6

1:3-49

an example
in

1:3-48

Quick Reports

print style specification

3:5-1.3:5-70-3:5-82

CPI spacing

3:5-78

default margin settings

3:5-77

default typestyle settings

3:5-78

2:2-54

disk

2:2-105.2 :2-109.

examples

2:2-127

2::2-129

highlights

3:^
:6-i37

in

2:2-87
3:2-4. 3:2-27

3:6-94

3:6-22. 3:6-26

relational

or

3:6-92
3:6-25

logical

Print Procedure Definition

2:2-86-2:2-87

1:3-4,1:3-39,1: 3-41,3:5-73.3:5-82

Quick Reports

3:5-80

3:5-82
3:5-78
1:3-4

DATABASE REFERENCE MANUAL


protected

mode

INDEX
optional relationship

specifying ranges as
1:3-13

selection criteria

Text fields
wild card characters

See also selection

2:2-10

1:3-12

predefined

1:3-12

relationship levels

specifying form

2:2-10,2:2 109,3:6-158
3:6-148

form
using more than three Match
view a relationship
Relationships form

1:2-79
1:2-77, 1:2-79

lock nothing

:2-77- 1:2-78

lock records

record separator character


recovering a deleted field

2:5-22
2:2-95

renaming a database

2:5-4, 2:5-57

3:6-159

1:2-70,2:2-10-2:2-11.

reorganize a form

2:2-132-2:2-133.2:2-138

in

LAN

1:2-44, 1:3-22

1:2-42

relational database

relational database

-).

'

3:3-9

any
Derivation Formulas

3:3-10. 3:4-1

1.

3:4-20

shared

3:6-22

report definition

DOS

named
relational statistical operators

highest of

lowest of

mean of
sum of

3:6-121

relationship concepts

form names

relationships
active

ad-hoc

definition

delete a relationship

form names
in a lookup formula
levels

many-to-one

Match fields
modify a relationship

:3-32

3:5-6.3:5-42.3:6-160
1:3-29

1:3-4,1:3-28. 1:3-35-1:3-36

Columnar
Custom

1:3-4. 1:3-24
1:3-4, 1:3-24

3:6-179

Export
Formatting

_.--iu^

Field Per Line

1:3-4,1:3-28

2:2-1 12

GrafTalk Chart

1:3-4,1:3-28

3:6-158

long:text fields

1:2-45.2:2-111

2:2-10.2:2-109,3:4-12,

3:6-20-3:6-21.3:6-158
advantages
between forms

3:5-

active function keys

3:6-84

3:6-118

2:5-3

3:5-70-3:5-76

report formats

3:6-51

count of

file

report field definition

3:6-157

1:3-52

1:3-52- 1:3-53

filename extension

report destination

2:2-68

3:6-132-3:6-133

one-to-many

1:2-81

exclusive

"^

3:6-26

name

2:2-23

'

all

relationship

2:2-132

report data locking rules

management system

definition

in

2:2-133

replace a field

1:1-4

Relational Operators

2:2-138

considerations

procedure
when to reorganize

1:3-17

definition

1:3-17
2:5-4. 2:5-58

1:2-78

refresh

2:2-125

2:2-130

reorganize

2:2-110.2:2-116-2:2-126

form
Quick Reports

2:2-111
fields

the Database

Remove

1:2-9

recovering deleted records

related

2:2-112

names

the Relationships

record selection locking rules


lock files

2:2-129

permanent

1:3-15

criteria

referential integrity

2:2-127

names

2:2-109
2:2-10

2:2-10.2:2-109

- -

Commands

1:3-24
1:3-4, 1:3-28

Commands

See also Formatting

3:6-164

REPORT menu

-''

'

2:2-113-2:2-115
2:2-130

TO.
109
-- '"^
3:3-1

1:3-27,3:5-42,

3:5-49,3:5-51

30
report margins

1:3-4,1:3-28

system defined
Template
See also Format

7
_._-ii2:2-65
0-'>

2:2-42
1:3-4, 1:3-28

Mailing Labels
Record Entry

Report Formatting

1:3-27,1:3-29

in

Commands
3:5-77

Record Entry

1:2-17, 1:2-26

report ordering
for

Choice

report output
report spacing

fields

2:2-55

3:2-14
3:5-78

XVlll

DATAEASE REFERENCE MANUAL


report statistics

7.1:1-9
user restrictions

name
when changing a database
when defining menus
when defining users
when removing a Database

selection criteria

starting

2:5-4
2:3-6

command
Start-up menu

2:4-8

statistical

2:5-4

item

3:6-119

max
mean

3:6-120

min

3:6-176

std.dev.

3:6-177

std.err.

3:6-178

3-3-2. 3:3-4. 3:3-11.

3:6-165.3.6-196
2-2-64. 2:2-66

sequence
sequenced fields

1:2-82

9-4-19-2:4-21

serial printer port

pnnters
a note about serial

2.4-19

stop bits
word length

2:4-19
1:1-7
1:1-7

signing on

3:6-166

sin

3:6-167

sort

2:A-4

memory

in
in

Soundex search
source form

l-->-8.

1:2-58-1:2-60

3:5-12

procedures
Quick Reports

2:3-17

as a function type

1:3-21

Quick Reports

in

deviation
See also standard

in

1:3-21

Quick Reports

See also standard error

Subform

special effects

2:4-34
2:4-34

spelldate

spellmonth

spellnumber
spellweekday

1:3-14

3:6-169

3:3-10.3:4-

3:6-169

in

3:6-172

spellnumber

3:6-173

spellweekday

3:6-174

sqrt

3:6-176

standard deviation

3:6-177
3:2-3. 3:2-6

2:2-28

1:3-3.3:6-178

Quick Reports

suppress zero padding

3:6-171

2:2-31

2-2-27

1:3-21
in

3:6-173

spellmonth

New Procedure
New Report

2:2-28

sum

3:6-172

spelldate

Start

2:2-28

Subform Definition screen

sum of
summary

3:6-171

3:6-170

Start

2:2-28

modify

3:6-170

spellcurrency

standard error

2:2-28
2:2-

Custom Form

examples
spellcurrency

2:4-19
2:2-9. 2:2-27

Automatic Form
Automatic Table

special 2

spell functions

1:3-3.3:6-177

std.err.

2:4-34

selection criteria
specifying ranges as

1:4-4.1:4-11

1:3-3.3:6-176

std.dev.

special 2

1-4^,1:4-12-1:4-13

Import Specifications
Procedures

stop bits

special

1-4-4.1:4-7-1:4-10

Forms

9-5.3 ^-5-10.2:5-13.2:5-17.2:5-32
-^ ^- - 2:4-34

2:3-17

Status report

2:4-34

special

1:3-20-1:3-21

status

3:3-7

operators
sorting and grouping

3:6-126

statistics

3-6-94. 3:6-168

sorting

3-6-101-3:6-102

3:6-157

2:4-19

sinh

3:6-175

operators

3:6-191

protocol

screen

2:3-5.2:4-12

variance

2:4-19

On

9-3-"'

2:4-19

baud

Sign

line options

sum

2:4-19

parity

IG. 1:1-9

2:4-20

additional questions
rate

DataBase

2:3-7

V4-13. 3:4-20. 3:6-179


3:5-52

report

7-9-46. 2:4-28

Numeric Strings

3:3-13

syntax scan
Svstem Administration

1:1-14.2:4-1

4-14 2:4-16-2:4-27,

Define Configuration

Define Printers
Define Screen Styles

2.4-35

2:4-34

2:4-37

2:4-42

2:4-7 -2:4-8.2:4-11

Define Users
screen
System Configuration

2:4-36

2:4-32

2:4-13

2:4-14

1:3-3.1:3-10.3:4-1

XX

DATABASE REFERENCE MANUAL


System

t'omis

1:2-

Configuration
Dictionary

DOS

filenames

Record Entry

in

Menus
Printers

Relationships

Screen Styles
status

Users

System menus
access from a custom menu

TABLE menu
in

Record Entry

Table View
cursor

movement keys

of records

in

file

tan

tanh
target form
temp
Template format

temporary variable
tertiary

form

Text
delete

Type

Field

Text

field

during Import
in

Record Entry

maximum

length

modify
multiple line
valid data
text functions
firstc
first last

firstw

jointext
lastc
lastfirst

lastw
length

lower

midc

3
1

:3-4.

1:2-2, 1:2-14, 1:4-8,

INDEX

unlock db

3:6-188

in

indexed order

2:3-26

in

order saved

2:5-13

in related

as a function type

update matching

3:6-189

upper

Upper Limit

2:2-6.

;:2-35.

2:2-72

formula syntax

using

Lookup

in

formulas

Record Entry

2-76

modify
view

2:4-6

user

mode

2-55
1:2-8

2-45
2-51

virtual field

2-61

2:2-70 -2:2-71. 2:2-99

-100

w
weekday

3:6-193

3:6-62.3:6-194-3:6-195

while
wild card character
*

menu

1:2-7, 1:2-57. 1:3-12

1:2-57. 1:2-62.3:6-6
1:2-57. 1:2-62

1:2-57,3:6-7

2:3-3,2:3-12-2:3-13

name

2-51

:2-53

view last record


viewing a particular number record

for an indexed search

2:3

:2-23,

using ad-hoc multiforms

2:4-6

as a function type

31.

2-44

2-38

4-26

encryption

1:2-421

2-38
:2-6.

:2-25,

order

field

Users form

user

:2-8.

searching in unchecked

2:2-73

entering valid data

file

2-52

2:2-74

2:2-73

valid formulas

in

2-62

1:2-22,1:2-51-

searching for a particular record

2:2-74

for limits

Upper/Lower Limit

:2-8,

2:2-74

2:2-100

modify
using constants

forms

in reverse

''-52

file
1

IG, 1:1-1,2:1-1

upgrade information

user

displaying a table of records in a

1:4-3. 1:4-33

unlock database

''-23

by record number

3:6-186-3:6-187

unlock

search limitations

1:1-8- 1:1-9

1:2-57

1:2-57.3:6-8

user password
2:4-7

limitations

when changing the database name


when removing a database

2:5-57

2:5-58

user-defined forms

1:2-1

1:4-7. 1:4-10

status report

wild card search

window menu

1:2-7,1:2-57

2:2-33

3:3-4,3:4-3,3:4-19,3:6-196

with

word

length

WordPerfect
export format

2:4-19
3:5-31 -3:5-32

utilities

2:3-20

as a function type

work area
Write Security

1:1-18

2:2-6,2:2-35,

2:2-75-2:2-76, 1:2-41
value

:6-190

3:6-38,

Variable Length ASCII export format 3:5-36


variables

assign

3:5-37
:6-192

3:4-8.

command

3:6-28

3:6-52

current

define

3:6-59

global

3:4-8, 3:6-80, 3 6-192

3:4-8,3:6-182,3 6-192

temporary

3 6-191

variance

Quick Reports
view a form

1:3-21

in

View

Security

viewing a field definition


Viewing Imports

viewing records

2:2-9

1:2-41, 2:2-6. 2:2-35. 2:2-75

year

3:6-197

yearday

3:6-198

yearweek
Yes or No

3:6-199

Field Type
Yes or No field
as a Choice field
in Record Entry

2:2-51

valid entries

2:2-51

2:2-51

2:2-51
1:2-5

2:2-76

2:2-7. 2:2-95

2:5-30
1:2-7. 1:2-51

2-52

xxii

DATAEASE REFERENCE MANUAL

Addendum
The following pages contain

Volume

additional documentation for subjects

DataBase Reference Manual. Each


subject covered in this addendum references the related chapter in
the first paragraph and employs the same stylistic conventions as

covered

in

3 of the

that chapter.

Addendum

DEFINE FORMAT/PRINT STYLE: DESIGNING REPORT OUTPUT


Addendum - CrossView Format

DataEase 4.0 includes a ninth output format for use with


DataBase's new business analysis product, CrossView.
This addendum describes the CrossView format. For more
information on using DQL formats, see Chapter 5, Define
Format/ Print Style, in Volume 3 of the DataEase Reference
Manual. For more information on using CrossView, see the
CrossView Tutorial and Reference Manual.

The CrossView format is the last choice on the Formats menu,


which is accessed through the Define Format option of the DQL
menu. The CrossView format lets you easily gather information
stored in DataEase and apply the multidimensional analytical power
of DataEase CrossView to it. To use this format, the DataEase and
CrossView program files must be installed in separate directories,
and both programs must be located

in the

DOS PATH.

The CrossView format automatically sends data generated by a


Quick Report or DQL Procedure to CrossView, so you can analyze
that data on the CrossView Display Screen. For example, suppose
you've defined a DQL Procedure that lists each customer's full
NAME, ACCOUNT BALANCE. ADDRESS, CITY, STATE, and ZIP CODE. The
query looks like this:

Query
for

CUSTOMERS
list

records

FULL NAME
ADDRESS

CITY

STATE
ZIP

ACCOUNT BALANCE

end
CrossView

lets

you quickly analyze data from

different

Assume you want to


group and analyze these statistics by account balance, city.
STATE, or ZIP CODE. Instead of defining a new query using the
DQL grouping commands, you can send the data generated by this

perspectives without rerunning the report.

procedure directly to CrossView and use its page and hyperpage


dimensions to group and display the data for detailed analysis.

Addendum

DATABASE REFERENCE MANUAL


Addendum - CrossView Format

When you

CrossView

select the

output format that includes a

A sample

(cont.)

format, DataEase produces an

.call

command

to invoke

format for the preceding procedure

is

CrossView.

shown below:

Format
.items

end

.call

prexvu

%m

The transformation is performed by a special CrossView program


named PREXVU (the program specified in the .call command on
the last line of the format). If you edit the DataEase format, do not
change this line. The
parameter creates a temporary filename
for the output and passes this name to PREXVU. This temporary
file is automatically erased when the data is transformed

%m

When CrossView

is

invoked, DataEase temporarily relinquishes

CrossView and the output is automatically transformed


into CrossView format. You can then use CrossView to analyze
the DataEase output just like any other CrossView data file.
control to

When you

press

ESC

to exit

CrossView, you are automatically

returned to DataEase.

Addendum

DataBase
VOLUME

DataBase Query Language Guide

The DOL Reference Guide is a comprehensive


guide to the DataBase Query Language (DOL),
the command language that lets you access

every DataBase operation


all available
through our celebrated interactive menu system.
Combining powerful control, processing, and
procedural commands; relational operators; and
a broad array of math, financial, and text
processing functions; the DOL lets you automate
entire business systems, including: accounting,
invoicing, billing, order-entry

POS operations,

and inventory management The DOL Reference


Guide contains a detailed explanation of every
command in the DataBase Query Language. In
addition, it includes a full-length example of
a

complex invoicing application.

^^ DataBase
INTERNATIONAL

Revised

90

Das könnte Ihnen auch gefallen