CNT (set total count)

Top  Previous  Next

 

CNT( [ variable ] )

CNT

Calculates the number of times DETAIL structures have been printed.

variable

The label of a numeric variable to receive the intermediate values calculated for the CNT. This allows you to create totals on other totals. The value in the variable is internally updated by the print engine, so it is only useful for use within the REPORT structure.

The CNT attribute (PROP:CNT) specifies an automatic count of the number of times DETAIL structures have been printed. Unless the TALLY attribute is present, the result is calculated as follows:

A CNT field in a DETAIL structure increments each time the DETAIL structure containing the control PRINTs. This provides a "running" count.

A CNT field in a group FOOTER structure increments each time any DETAIL structure in the BREAK structure containing the control PRINTs. This provides a total of the number of DETAIL structures printed in the group.

A CNT field in a page FOOTER structure increments each time any DETAIL structure in any BREAK structure PRINTs. This provides a total of the number of DETAIL structures printed on the page (or report).

A CNT field in a HEADER is meaningless, since no DETAIL structures will have been printed at the time the HEADER is printed.

The CNT is reset only if the RESET or PAGE attribute is also specified.

Example:

CustRpt REPORT,AT(1000,1000,6500,9000),THOUS

Break1   BREAK(LocalVar),USE(?BreakOne)

Break2    BREAK(Pre:Key1),USE(?BreakTwo)

Detail     DETAIL,AT(0,0,6500,1000),USE(?DetailOne)

           STRING(@N$11.2),AT(6000,1500,500,500),USE(Pre:F1)

          END

          FOOTER,AT(0,0,6500,1000),USE(?BreakOneGroupFoot)

           STRING('Group Count:'),AT(5500,500)

           STRING(@N$11.2),AT(6000,500),USE(Pre:F1),CNT(LocalVar),RESET(Break2)

          END

         END

         FOOTER,AT(0,0,6500,1000),USE(?BreakOneGroupFoot)

          STRING('Grand Count:'),AT(5500,500)

          STRING(@N$11.2),AT(6000,500),USE(LocalVar),CNT,TALLY(?BreakTwo)

         END

        END

       END