Was this helpful?
Define the SaleRep Frame
SaleRep is a Report frame that calls the Report-Writer to produce a report on the quantities of a particular product sold. You display the pop-up Salerep frame by selecting Sales from the Topframe menu.
To create this frame
1. Choose Create from the Edit an Application menu.
2. From the Create a Frame or Procedure pop-up, select Frame.
3. The Create a Frame pop-up appears. Select the REPORT frame type.
4. The Create a REPORT Frame appears. In the Name field, type salerep. The following figure shows this stage:
5. Choose OK to load a default report definition for Salerep into the Report layout frame. The Edit a REPORT Frame Definition frame appears, shown in the following figure.
6. The Frame Name is salerep. If you like, enter a brief description in the Short Remark field.
7. In RBF Report (y/n) field, enter n. Salerep calls Report-Writer and thus uses a report source file.
8. In the Report Source File field, enter the name srep.rw, because that is the name of the source file that you are entering for Salerep in the next section.
9. In the Report Parameters Form field, enter the name of the form that the user can use to enter the parameter or variable. This can be the same as the frame name and the report name.
10. The Output File field indicates the type of output for the report. This can be Printer, Terminal, or a file name. Enter terminal here.
The frame also contains a Command Line Flags field in which you can enter command line arguments for running reports. For more information on Command Line Flags, see Creating Report Frames.
The following figure shows the completed frame. The next section describes the Report-Writer source file srep.rw.
Enter a Report-Writer Specification Using sreport
In the Edit a Report Frame Definition frame, the Report Source File field names a source file that contains the Report-Writer commands for the Salerep report. If you select RBF to define the report, the Report Source File field remains blank.
The example in this chapter uses the source file srep.rw. You already entered this name in the Report Source File field in the previous section.
To enter the Report-Writer specification for the example into this file
1. Select Edit.
The report is named Salerep and contains one variable name, product_value. The user defines the variable (in this case, the type of product reported on) in the query that retrieves the data.
.name salerep 
.query
   select product, custname, quantity
     from orders
     where product = '$product_value'
.declare product_value = varchar(20) 
with prompt "Enter Product: " 
.position product (0,30), 
custname (35,50), quantity (70,4) 
.sort product, custname
.head report
   .underline
     .center
     .print 'Sales Report'
   .nounderline
   .nl 2 
.head product
   .underline
     .left product    .pr 'Product Name'
     .left custname   .pr 'Customer Name'
     .left quantity   .pr 'Quantity'
   .nounderline
   .nl
   .tformat product(c30) 
.head custname
   .nl
   .tformat custname(c30)
.detail
   .tab product                  .pr product (b30)
   .tab custname                 .pr custname (b30)
   .tab quantity                 .pr quantity (f4)
   .nl
2. Save the text file. When you leave your editor, ABF returns you to the Edit a REPORT Frame Definition frame.
3. Choose Compile. This invokes sreport. The report name has the same name as the frame, so salerep appears in the Report Name field.
After the source file is compiled, you return to the Edit a REPORT Frame Definition frame.
Define the SaleRep Pop-up Form
The Report Form field contains the name of a form in which the user can enter parameters for the report. This makes entering parameters easy and provides a consistent interface for the user.
A form is optional in a report frame. If you do not enter one, ABF calls the Report-Writer directly when the user runs the report frame. The FormEdit operation is not active unless you specify a form.
The Salerep frame has a pop-up form. Creating a pop-up is the same as creating a fullscreen form, with the exceptions noted in the steps below.
The report has one variable, product_value, which the user specifies. You need a form that has a single field with the same name as the variable. In this case, the form requires a field with the name product_value. The "$" is not part of the prompt nameā€”do not include the "$" in the field name.
To define the pop-up form
1. Choose the FormEdit operation to call VIFRED. Choose the BLANK option at the VIFRED Creating a Form Menu.
2. Create a form similar to the one in the following figure. Because this is a pop-up, use the VIFRED FormAttr option to change the style to pop-up. The figure below shows this stage. The Salerep pop-up is positioned near its associated menu listing.
3. Choose VisuallyAdjust. The Resize option allows you to move the cursor to change the size of the form and determine its displayed position on top of Topframe. Exit back to ABF.
Test the Report Frame
After you build the frame, try testing it from the Edit a REPORT Frame Definition frame. Select Go to compile and run the report frame on its own. The frame for SaleRep is displayed, as shown in the illustration of the Sales Entry Application frame.
Alternatively, you can check to see how the entire application is shaping up in the following way:
1. Use the Compile operation on the report source file.
2. Choose End to return to the Edit an Application frame.
3. Highlight topframe.
4. Choose Go. If you did not set up a default start frame, ABF prompts: "Start execution at 'topframe'?" Enter y (yes).
5. The application is now running.
6. To test the report frame that you just defined, choose Sales. Topframe now calls SaleRep.
Run the SaleRep Frame
Display the SaleRep frame by following the steps in the previous section. The menu in the window is the one ABF automatically supplies for all Report frames:
Report Help End
The SaleRep form contains a single field displaying the name of a product. Assume that there is data in the orders table.
To run the frame
1. Enter the product bookcase, which results in the window shown in the following figure:
2. Choose the Report operation. The Report-Writer runs, and the output appears on your screen. Sample results are shown in the following figure:
3. When the display is finished, press Return to clear the screen. The frame SaleRep is redisplayed so that you can run the report again.
4. When you have finished generating reports, choose End, which returns you to Topframe.
5. From Topframe, choose End to exit the application. You return to the Edit an Application frame.
Last modified date: 12/14/2023