home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
184.lha
/
PubCat_v1.4
/
query.doc
< prev
next >
Wrap
Text File
|
1988-04-28
|
13KB
|
272 lines
Query Instructions
The Query program will allow you to produce a report based on
your selection, sorting and formatting specifications. Upon
entry, you will be presented with a data dictionary and string
gadgets for entering your record selection criteria, sort
sequence and output report format.
The data dictionary presents you with a list of data names that
can be used to display or print values contained in the database.
The SELECT string gadget will allow you to specify some selection
criteria to be used to determine which database entries will be
included in you output display or report. For example,
SELECT:
(Author = "Smith" or "Jones") and Disk = "FF90"
specifies that the database is to be searched for programs
written by "Smith" or "Jones" that are also on disk "FF90".
Remember that in order to enter data into a string gadget you
must first position the pointer within the gadget and depress the
left button on the mouse. Note that the Select parameters
contain parentheses to prevent ambiguities. If there is a
possibility that the key word or phrase you are looking for
contains occurrences with both upper and lower case letters, you
must check for both, e.g., "Smith" or "smith". Another method is
to use the wild character, e.g., "?mith".
The Sort string gadget will allow you to specify the sequence in
which the selected records are to be displayed or printed. For
example,
SORT:
Disk
specifies that the selected database entries are to be sorted in
Disk name sequence. Only one sort field may be entered.
Note: To sort on Date and have the resulting list appear in year
order, enter:
cdate(Date)
The REPORT string gadget will allow you to specify the format of
the output display or report. For example,
REPORT:
Program, col 30, Version, col 40, Type
specifies that the Program Name, Version and Type for the
selected entries are to be displayed. Further, it is specified
that Version is to be displayed beginning in column 30 and that
Type is to be displayed in column 40. If the column parameters
are omitted, the data items will be separated with one space in
the output. The REPORT specification parameters may be very
simple or very complex depending upon the skill of the user.
Upon entering the Query program, you will find that the SELECT,
SORT and REPORT string gadgets already contain some parameters.
These parameters have been designed to provide a simple display
of all the entries in the catalog. You may use these parameters
simply by selecting the RUN gadget, or you may enter your own
customized report specifications. To erase the content on the
parameter string gadgets, first select the gadget and then
depress Right AMIGA - X. To undo (cancel) the last editing
change to the string, depress Right AMIGA - Q. The Report
specification parameters can be classified as either describing
"when to do it" or "what to do".
When To Do It:
page_top - specifies that subsequent functions are to be
executed at the top each printed page or screen.
page_bottom - specifies that subsequent functions are to
the executed at the bottom of each printed page or
screen.
report_top - specifies that subsequent functions are to
be executed only at the beginning of the output report.
report_bottom - specifies that subsequent functions are
to executed only at the end of the report.
top(<data-name>) - specifies that subsequent functions
are to be executed after there has been a change in the
content of <data-name>. For example, top(Disk).
Normally, the specified data-name will be the same as
the sort sequence.
bottom(<data-name>) - specifies that subsequent
functions are to be executed before there is a change in
the content of data-name. For example, bottom(Disk).
detail - specifies that the subsequent functions are to
be executed for each selected database entry.
What To Do:
print - specifies that all output is to be routed to the
printer. Default values for tm, bm and bod are set to
4, 8, and 54 respectively.
display - specifies that all output is to be routed to
the screen. "Display" is the output default. Default
values for tm, bm and bod are set to 0, 0, and 22
respectively.
tm nn - sets the top margin for the output display or
report to the value specified by nn.
bm nn - sets the bottom margin for the output display or
report to the value specified by nn.
bod nn - sets the body of the output display or report
to the value specified by nn. The sum of tm, bm and bod
must equal the desired page length.
<data-name> - causes the specified data name to be
printed or displayed. For example, "Remarks" is a
data-name.
"literal" - causes the specified literal to be printed
or displayed. For example, "The result is:" is a
literal.
trim(<data-name>) - causes the specified data name to be
printed or displayed after all trailing spaces have been
eliminated. For
example,
"trim(Remarks)".
total(<data-name>) - specifies that the summed value of
<data-name> is to be printed or displayed. An numeric
data item from the dictionary or a numeric literal must
be substituted for <data-name>. For example, to print a
count of the entries selected for the report enter:
report_bottom total(1)
cum(<data-name>) - same as total except that the
accumulator is not reset after displaying the result.
To consecutively number items appearing in the output
report, enter:
detail cum(1) "%999"
spacer nn - causes nn spaces to be inserted between
output data items. The default is 1.
col nn - causes the next specified data item to be
displayed or printed in the column specified by nn.
skip n - causes n lines to be skipped before displaying
or printing the next data item. If n is not provided, 1
is assumed.
pause - causes a pause in the output process until the
space bar is depressed.
eject - if "print" has been specified, this command
causes the paper to be ejected to the top of the next
page; otherwise, the screen will be cleared.
EDITING MASKS
Numeric Editing Masks may be used to cause predefined
characters to be imbedded within displayed or printed
numeric items. Numeric items are identified in the data
dictionary with the character "n" following the data
name. The masks must be constructed as an alphanumeric
literal whose first character is "%". If the second
character of the mask literal is other than a numeric
character, that character will be placed in the next
left most position before the resulting edited numeric
value.
Examples:
Input Values Mask Output
01000 "%9,999" 1,000
25245 "%$99,999" $25,245
-5643 "%$999,999" $-5,643
Alphanumeric Editing Masks may be used to cause
predefined characters to be imbedded within displayed or
printed alphanumeric items. Alphanumeric items are
identified in the data dictionary with the character "c"
following the data name. The mask must be constructed
as an alphanumeric literal whose first character is "%".
Examples:
Input Values Mask Output
123456789 "%@@@-@@-@@@@" 123-45-6789
102786 "%@@/@@/@@" 10/27/86
Here is an example of a more complex query that print a disk
label for the selected entries:
SELECT:
Program = "?"
SORT:
Disk
REPORT:
print tm 1 bod 4 bm 1 bottom(Disk) "JANE DOE COLLECTION" skip
Disk "Size:" total(Size) "%99999" eject
By using the BOTTOM command, only one label is printed for each
unique Disk Name in your database. The name of the collection is
printed on the top line and the disk name and size is printed on
the second line.
These parameters are set for 5/16 labels. For other sizes of
labels, simply adjust the margin parameters.
Rules:
(1) The Select statement may contain these operators:
= Equal to
<> Unequal to
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
(2) The field on the left side of the operator must be a
data name from the dictionary.
(3) The field on the right side of the operator may be
either a data name or literal. Literals must be enclosed in
double quotes.
(4) In the case of equal and unequal, the data name on the
left side of the operator is searched for any occurrences of the
data specified on the right of the operator.
(5) The length of the item to the right of the operator may
not be greater than the length of the item to the left of the
operator.
(6) When used in a literal, the "?" is wild. For example,
to select all records in the database enter:
SELECT:
Author = "?"
(7) Commas may used to improve readability; otherwise, they
serve no useful purpose.
(8) All data names must be capitalized. All other commands
must be in lower case.
If your printer carriage is 80 columns in width, try setting your
printer preferences for compressed mode in order to print reports
that are greater than 80 characters in width.