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.