Using counters

The Report Counters facility allows you to specify a start number at the start of the report run and increment the number as each document is processed. The start number can either be entered at run-time as a parameter or retrieved from a data field value.

You can increment a counter based on the change of a value of a field.

  1. Select Edit > Report Counters. The Report Counters dialog is displayed.
  2. You can select an existing counter and click Edit to edit as required, or click New to create a new one. To use the report counter, either insert an expression and select the counter from Special Fields or use the counter in a multi-part document number.
  3. A document number is created by selecting Insert > Document Number or within Special Fields, by right clicking the counter, or by dragging the counter onto the canvas.
  4. A document number is incremented either on each change of the reset level defined in the Counter, or by a page break. Many different document fields can refer to a single counter. By default, the document number is one part, with a value of the counter name and a format of F0, meaning fixed length of 10 with 0 decimals and a blank delimiter. Any number of parts can be added to construct a document number and each part can be a constant, counter, or a data field value. Using the document number component is only required if you do not need to update the reference back to the database or when the counter part to be incremented on a field value cannot be incremented by standard functions. Otherwise, use Transaction References.
  5. Specify this information:
    Name
    Enter a name for the counter.
    Increment Value
    Specify the value for the counter to be incremented by. The default is 1. Enter the value or use the browse button to display the Value Expression dialog. Click Add Case to open the Value Expression dialog where you can define that the increment only applies where specific filters are applied at runtime.
    Increment on change of: Page
    Select this radio button if you require the counter to be incremented on every page break.
    Increment on change of: Group
    Select this radio button if you require the counter to be incremented on the change of a specified group. When this option is selected, the adjacent drop down list is enabled where you can pick from the list of existing 'order by' groups.
    Start Number: Number Stream
    You can start the numbering using a number stream. Select a number stream from those available on the drop down list. For further information on number streams in SunSystems, refer to SunSystems Administrator Guide.
    Start Number: Expression
    You can start the numbering using an expression.
    Start Number: Parameter
    You can start the numbering using a parameter. For example, a runtime entry parameter.
  6. A counter is created which can be added to the report. Select View > Special Fieldsto display the available counters in the Special Fields Browser and drag and drop the counter you require onto the report.