Kbase 5074: F.T. - How to Create report that prompts for the query info
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/05/1998 |
|
F.T. - How to Create report that prompts for the query info
900627-cmb02
INTRODUCTION: Date Last Modified: 8/24/90
=============
This Product Services Technical Support Knowledgebase entry explains
how to prompt for a value to be used for query purposes within a Fast
Track Report.
WHY YOU WOULD WANT TO DO THIS:
==============================
By using an include file, you can prompt the user for the query
information (qualification) on which to base the output from a report.
You can also prompt the user for the output destination for the report.
This allows you to write a single report that produces different
output.
PROCEDURAL APPROACH:
====================
The Fast Track Report Writer allows you to call in an include file by
specifying DEFINE INCLUDE within a report section. You can specify
the include file to be "included" before, during, or after the FOR
EACH statement that will be executed for that section of the report.
In this way, you can create an include file that prompts the user for
the information they want to query on, and then you can pass that
information to the report using shared variables.
Since you'll be prompting for the information from the user at the
terminal, this can cause a slight problem. The output destination has
already been named by the time you get to the FOR EACH loop, and may
conflict with the output destination (the terminal) that you are
attempting to use to display and prompt the user for information.
To avoid this problem, call in an include file from SETTINGS REPORT
which executes the appropriate OUTPUT statement.
The example below illustrates how to prompt the user for input to be
used in the report qualifications statement. The example works off the
PROGRESS demo database. Please create a demo database and try the
following steps:
** Note that it will be necessary to slightly modify the generated
PROGRESS code once the COMMAND GENERATE is executed.
1. Create a demo database: prodb new demo.
2. Start Fast Track: proft new.
3. At the Fast Track Main Menu, press <F4> to go to the PROGRESS
editor.
4. Type in the following include file code:
DEFINE NEW SHARED VARIABLE cnum AS INT.
SET cnum.
OUTPUT TO TERMINAL PAGED.
5. Save the file (press <CTL> <p> or <F6>) to a file called:
cnum.i.
6. Return to the Fast Track Main Menu (type: RUN ft.p.).
7. At the Fast Track Main Menu, choose: 3. Report Writer.
8. Name and Create a report called custrpt from the Customer
file. Place the fields cust-num and name in the report by
typing <CTL> <O> INSERT FIELD cust-num name.
9. DEFINE VARIABLE cnum as an integer.
10. DEFINE FILE and enter qualification: cust-num gt cnum.
11. SETTINGS REPORT Output Type: Include, Class/Option: cnum.i.
12. COMMAND GENERATE the custrpt (Creates custrpt.p and
custrptr.p).
13. LEAVE SAVE custrpt.
14. <F4> <F4> returns you to the PROGRESS editor.
15. <CTL> <G> or <F5> to GET filename: custrptr.p.
16. Change the first line of the procedure from DEF VAR cnum AS
INT to: DEF SHARED VAR cnum AS INT.
17. <CTL> <p> or <F6> to save the procedure back.
18. Clear the edit buffer with <F8> or <CTL> <z> and type in the
command: COMPILE custrptr.p SAVE.
19. Now run the report by typing in: RUN custrpt.p. The user is
prompted for the value of cnum which is passed to the report
qualification. If 12 is entered for example, only the records
for customers with a customer number greater than 12 are
displayed.
REFERENCES TO WRITTEN DOCUMENTATION:
====================================
FAST TRACK User's Guide - Chapter on The Report Writer
FAST TRACK Tutorial - Chapter on The Report Writer
PROGRESS Reference Manual - { } Include File option
PROGRESS Programming Handbook - Chapter on Designing and Changing Your
Database
Progress Software Technical Support Note # 5074