Reporting on Arrays | |
 | When reporting on an array, as a convention, REPORT examines array element zero (e.g. ARRAY[0]) to determine the number of array "rows" on which to report. Therefore, you can report on the entire array or just a portion of it by specifying the appropriate value in array element zero. |
 | When referring to an array in an output statement for a report, you are required to use the internal variable %ITEM as the first index (i.e. the "row" index). Subsequent indices in the reference, if any, enable you to access specific pieces of information in that "row" of the array. For example, a reference in the form ARRAY[%ITEM,n] would be used to access a specific piece of information in the "row" of Array indicated by %ITEM. In this example, n represents an index value which, when used in conjunction with the index indicated by %ITEM, forms a unique identifier for a specific piece of information in the array. |
 | Arrays can also be passed as parameters to a report. To illustrate this feature, suppose that at the end of each month, you want to create a sales summary report for each or your four sales regions. You have created one array for each sales region, in which you have stored all sales data pertinent to the region for the month. These arrays are reg1sales[ ], reg2sales[ ], reg3sales[ ], and reg4sales[ ]. You would like to use the same report form for all four regions. To accomplish this, within the form, you should declare that an array will be received as a parameter. This declaration is made with the following statement: |
 | Parameters sales[ ] |
 | In this example, sales[ ] corresponds to the actual array that will be passed, which will be reg1sales[ ], reg2sales[ ], reg3sales[ ],or reg4sales[ ]. The REPORT statement's /PARAMETERS qualifier provides the method by which the actual array is passed to the report form. For example, the following statement would be used to produce the sales summary report for region three: |
 | Report reg3sales[ ] /Parameters=reg3sales[ ] & |
 | Form=MONTHLY_SALES |
| Qualifiers |
/Break=(expr [, keywords]) | |
 | Specify the actions to be taken on intermediate level breaks. | |
| | EJECT | Go to the top of the next page after the level break has been processed. This is suppressed automatically if an outer (higher) level caused the break. |
| | EJECT_BEFORE | Go to the top of the next page before the level break is processed. This is suppressed automatically if an outer (higher) level caused the break. |
| | GOSUB | Execute a subroutine before processing the break. If the subroutine returns %ERROR, the level break is suppressed. If the subroutine returns %EJECT, a new page begins before the level break is processed. |
| | NOEXECUTE | Do not execute the break_footing DML code contained in the form. |
| | NOTOTALS | Suppress printing of totals for this level. (Nototals also implies Nounderlines). |
| | NOUNDERLINES | Suppress printing of underlines before the totals. |
| | RESET_PAGE | Reset the page number counter so that the next page number will be one. |
| | SKIP [ = n ] | Skip n lines after processing the level break. The default is one line. This will not skip past the end of the page. |
| | SKIP_BEFORE [ = n ] | Skip n lines before processing the level break. The default is zero lines. You can specify -1 to stay on the same line (i.e. don't output the last record until the level break has been processed). |
| | TEXT [ = expr ] | Merge a segment of text left-justified beside the totals. This expression can contain the level break field. Example: /Break=CUTSTOMER(STATE), & Text="Total for state " & CUSTOMER(STATE) |
| | TSUPRESS | Suppress printing of totals (and text) if there is only one record in the level break. |
| | Example: Report AP &
| |
| | /Break0 = (Gosub = GRAND) /Break = AP(VENDOR_NBR), Eject & /Pointer & /Form = AP_CHECKS | |
| | After all records have been processed for Accounts Payable, do a final break that executes a subroutine and calculates the grand totals. | |
| | /Break0=( keywords, ...) | |
| | Specify the actions to be taken on the final (grand total) level break. See keywords for /BREAK. | |
| | /Cspace=expr | |
| | Control the number of spaces between detail columns. The default is one. This overrides the form parameter.
Example: Report CUSTOMER & | |
| | /Cspace=3 & /Fields=(CUSTOMER(CUSTNO), & | |
| | CUSTOMER(SNAME), & CUSTOMER(STREET), & CUSTOMER(CITY), & CUSTOMER(STATE), & CUSTOMER(ZIP)). | |
| | Creates a report of all the customers in the CUSTOMER database placing three spaces between each field to be included in the report. | |
/Fields=(db(fld1) [,...db(fld12)]) | |
| | Specify the fields that you want to display in the report. You will probably use this only for simple reports. Any numeric fields are automatically totalled. | |
/Form=formname | |
| | Specify the form that contains OUTPUTs describing the report. Use a form for more complex reports. When writing to the screen, REPORT automatically toggles the screen width as required by the size of the form. | |
/Get [=([KEY=db(key)] [,START=expr] [,LIMIT=expr] [GENERIC])] | |
| | A processing sequence for the database. Record selection is provided by the optional START and LIMIT parameters. If used in combination with the /GET_SUB qualifier, each record is fetched before the /GET_SUB subroutine executes. | |
| | KEY | If the file is relative or sequential, the data is presented in record order sequence, and this should be omitted.
If the file is indexed, the specified key is followed. If no key is specified, and if the first field specified in the /FIELDS qualifier is a key field, then the database is accessed by that key. If it is not a key, the records are accessed by the primary key. |
| | START | The starting key (or partial key if GENERIC specified). |
| | LIMIT | The ending key (or partial key if GENERIC specified). |
| | GENERIC | If specified, the START and LIMIT keywords refer to partial keys. |
| | Example: Report AP & | |
| | /Form=DETAIL_PAST & /Get=(key=AP(NAME), & | |
| | Start='A', & Limit='B', & Generic)) | |
| | Create a report that Gets all names that start with the letter 'A' or 'B' using the key to do a partial match. | |
/Get_sub=SUBR | |
| | Execute this subroutine as each record is read from the database. You can control whether or not the record is processed by using the following status returns: | |
| | Return | OK to process the record. |
| | Return %CONTINUE | Reject the current record, and continue processing. |
| | Return %ERROR | Stop reading records, and exit the report. |
| | Return %EXIT | Stop reading records, and exit the report. |
| | If there is a /GET_SUB subroutine specified, and there is no /GET qualifier, then you are expected to get the records to pass to the report routine. | |
/Height=detail_height [, abs_height ] | |
| | Controls the number of lines displayed on a page (the page height). | |
| | detail_height | The maximum height of the heading plus detail lines. The default is 55 lines. |
| | abs_height | The absolute size of the page. Defaults to the detail height plus 10 lines. This usually leaves enough lines for totals and page footing lines on almost all reports. |
| | Example: Report CUSTOMER & /Height=33, 40 | |
| | Creates a report which displays only 33 lines of heading and detail on a page of 40 lines. | |
/Lspace=expr | |
| | Controls the number of blank lines displayed between lines of text. The default is zero. This overrides the form parameter. Example: Report CUSTOMER & /Lspace=2 | |
| | This places two (2) blank lines between each customer record. | |
/Margin=expr | |
| | Shifts the entire report to the right by the value indicated by the given expression. | |
/Noheading | |
| | Suppresses the detail column headings, but not the outputs in the PAGE_HEADING section. | |
/Output=filename [, form=queue_expr] [, APPEND] | |
| | I | |
/ | |
| | | |
/ | |
| | | |
/ | |
| | | |
/ | |
| | | |
/ | |
| | | |
/ | |
| | | |
/ | |
| | | |