Counting records

ebednezebednez Member Posts: 22
I have only one table in a report which is the "Sales Invoice Header" table. In this report I filter based on a date range and have one grouping field (a dimension field we use in the header table)

I only print the footer of that grouping field which includes the name of each record in this field and a sales total for that record. The end result is a listing of each item in the group with a total sales for that period.

I also need to count the records that make up the total sales per each item in this group and report it besides the sales total.

Totalling amounts are easy because the properties for the table has a "TotalFields" property. There is no count property however (at least not one I am aware of).

Any thoughts on how to count records for a group with only a header table in a report?

Thanks,

Ed

Comments

  • kinekine Member Posts: 12,562
    You can use one trick: CurrReport.CREATETOTALS which enable you to create totals of any global variable. Create one global integer variable, assign 1 into it and call CurrReport.CREATETOTALS(MyVar) in OnPreDataItem. If you use this variable in the footer or groupfooter, you will have correct record no. (it will work as any other field used for totaling...)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ebednezebednez Member Posts: 22
    I tried C/AL code in the body portion of the report with no items printing and that worked. (which is odd because it did not work the first time I tried it.) This time I listed the detail until I got the number correct and then dropped the detail, shrunk the body section but left the code.

    Thanks for the suggestions.

    Ed
Sign In or Register to comment.