home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Press 1997 July
/
Sezamfile97_1.iso
/
msdos
/
database
/
pdx_ti2.arj
/
TI685.ASC
< prev
next >
Wrap
Text File
|
1992-08-25
|
7KB
|
265 lines
PRODUCT : Paradox NUMBER : 685
VERSION : 3.0 & up
OS : DOS
DATE : August 25, 1992 PAGE : 1/4
TITLE : How to Output a Report on Selected Records of a Table
Intended Audience:
This Technical Information Sheet is intended for someone with a
moderate level of Paradox experience.
Prerequisites:
A basic understanding of Queries and Reports.
Purpose:
The purpose of this Technical Information Sheet is to illustrate
a method of outputting a report on selected records of a table.
This Technical Information Sheet demonstrates a technique that
allows a user to output a report on a subset of a table. Each of
the two examples presented below use the Customer sample table.
The first example shows how to print a report containing only
customers whose last name begins with the letter "M." The second
example shows how to print only the first twenty customer
records.
Example 1:
Printing a Report of Customers Whose Name Starts With M"
1. The first step requires use of a query to extract the
desired records into an Answer table.
a. Select {Ask} from the main menu.
b. When prompted for the table name, type in
"Customer".
c. Next, type "M.." in the Last Name field.
Since ".." is the Paradox wild-card symbol, typing
"M.." in the Last Name field will return all of the
records with values in the Last Name field that
start with the letter "M".
d. Place the cursor under the table name and press
<F6> to place a checkmark in all of the table's
fields. All of the fields must be checkmarked to
insure that the table structures of Customer and
PRODUCT : Paradox NUMBER : 685
VERSION : 3.0 and up
OS : DOS
DATE : August 25, 1992 PAGE : 2/4
TITLE : How to Output a Report on Selected Records of a Table
Answer are the same. This will enable the Answer
table to use the reports from the Customer table.
If the table structures are not identical, the
error message "SourceTable and TargetTable don't
have the same field names and field types" will
appear.
e. Press the <F2> key to perform the query. An Answer
table will result.
NOTE: Answer tables are temporary tables and will
be overwritten when another Answer table is
created, when the directory is changed or when you
exit Paradox. If you want to save an Answer table,
you must rename it using Tools | Rename. When
renaming the Answer table, be sure that the name
you choose is not the name of an existing table.
2. Next, copy the report specification from the table you
queried to the Answer table using: Tools | Copy | Report |
DifferentTable.
Following our example, from the Paradox menu select
Tools | Copy | Report | DifferentTable | Customer | 2 |
Answer | 2.
3. After the report has been copied from Customer to Answer,
select Report | Output | Answer | 2 | Printer from the
menu to print a report containing data for the selected
customers.
Example 2:
Printing Only the First Twenty Customer Records
1. Make a copy of the table the report is based on. In our
example, this is accomplished by selecting Tools | Copy |
Table | Customer from the menu. When prompted for a new
table name, type "Cust2."
PRODUCT : Paradox NUMBER : 685
VERSION : 3.0 and up
OS : DOS
DATE : August 25, 1992 PAGE : 3/4
TITLE : How to Output a Report on Selected Records of a Table
2. Add a sequence number field to the table by following the
steps listed below:
a. Select Modify | Restructure | Cust2 from the menu.
b. Press <END> to move your cursor the last field.
c. Press <DOWN> to create a new line.
d. Type "RANK" in the field name column.
e. Type "N" in the field type column.
f. Press <F2> to process the restructure.
3. Create a script named "Counter" to place numbers into the
RANK field.
a. Scripts | Editor | New | Counter
(For Paradox versions 3.0 and 3.5, select Scripts |
Editor | Write | Counter)
b. Type in the script listed below:
EDIT "CUST2" ; substitute your table name in
; quotes for "Cust2"
MOVETO [RANK] ; substitute your field name for
; "RANK"
SCAN
[]=RECNO() ; put the record number in the
; RANK field
ENDSCAN
DO_IT! ; save changes made to the table.
c. Press <F2> to save the script.
PRODUCT : Paradox NUMBER : 685
VERSION : 3.0 and up
OS : DOS
DATE : August 25, 1992 PAGE : 4/4
TITLE : How to Output a Report on Selected Records of a Table
4. Play the script to add the numbers to the RANK field by
selecting Scripts | Play | Counter from the menu. The
RANK field should now contain the value that equals the
corresponding record number.
5. Use a query to extract the first twenty records from a
table.
a. Select {Ask} from the menu.
b. When prompted for a table, type in "Cust2".
c. Place the cursor under the table name and press
<F6>. This causes all of the fields to be checked.
d. Type "<=20" in the RANK field of the query form.
e. Press <F2> to process the query.
6. Copy the report from Cust2 to the Answer table by
selecting Tools | Copy | Report | DifferentTable| Cust2 |
2 | Answer | 2 from the menu.
7. Print the report by selecting Report | Output | Answer | 2
| Printer from the menu.
For additional information about PAL, refer to the PAL Reference
Guide (PAL User's Guide for versions earlier than 4.0).
DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information
pertains.