Set occurrences for a record

You can define how many rows are printed for each record in your report.

Note:

The Occurrences property is available only in business records for reports (.4rd files), not for forms (.4fd* files) or web services (.4ws or .4wsj files).

When a record is fetched, it may contain multiple rows of data. Depending on the report’s needs, you may not want to print all of those rows. You control this behavior using the Occurrences property in the .4rd file.
Figure: Report: number of rows to print

Report Business Record diagram highlighting the Occurrences property
Important:

In order for this property to affect the printing of lines, the rows must be ordered. Go to Order records in the Business Records diagram.

Table 1. Occurrences property options
Option Description
1

The record prints, and only the first row of data is shown. All other rows are ignored.

If there are no rows, the report still prints one row. By default, this row will be empty.

You can add default values for a row using the OnComputeFields code event. To create this event, select the OnComputeFields() property for the record. In the event function, you must check whether the row has data:
  • For text fields - Test if the primary key is NULL or empty.
  • For numeric fields - Test if the primary key is zero , for example, a SERIAL type.
If the row is empty, assign your default values to the fields. This logic is implemented inside the <POINT> tag of the OnComputeFields() function in the .4rd file.
0 or 1

The record prints, and only the first row of data is shown. All other rows are ignored.

If no rows are fetched, nothing is printed for the record.

0 or more

The record prints, and all rows of data are shown, whether there is one row or many.

If no rows are fetched, nothing is printed for the record.

1 or more

The record prints, and all rows of data are shown, whether there is one row or many.

If there are no rows, the report still prints one row. By default, this row will be empty.

You can add default values for a row using the OnComputeFields code event. To create this event, select the OnComputeFields() property for the record. In the event function, you must check whether the row has data:
  • For text fields - Test if the primary key is NULL or empty.
  • For numeric fields - Test if the primary key is zero , for example, a SERIAL type.
If the row is empty, assign your default values to the fields. This logic is implemented inside the <POINT> tag of the OnComputeFields() function in the .4rd file.