I want to count the number of records per grouping.
I tried CREATETOTALS (but it didn't work) ... I'm working with a string field.
Help please and thanks,
-S.
Computers can figure out all kinds of problems, except the things in the world that just don't add up. - James Magary
0
Comments
Are you running this in a report? If so, then COUNTing the records before each grouping loops through isn't as efficient as just using an integer value incremented through the looping through of the records, as long as you don't need that value before the processing of those records.
Cheers!
Microsoft Dynamics NAV Developer
Than you can use CurrReport.CREATETOTALS(VariableName).
In VariableName you will have the record count for each group and grand total if you will use this varibale in GroupFooter or Footer... ;-)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I'm not sure what you are doing here.
I tried a test to just output a list of records from Table 18, creating a basic report using the wizard. I did the setup you suggested, and the first problem I encountered was that CREATETOTALS didn't want to take an integer type variable. Next, adding the value in the GroupFooter didn't automatically update.
For this suggestion, did you mean it would be totalled automatically, or is there more setups/coding that will make this solution work?
Cheers!
Microsoft Dynamics NAV Developer
Yes, if you use CREATETOTALS with some variable, the variable value will be summed after end of OnAfterGetRecord. It is same like TotalFields property for table fields but only with some global variable...
The CREATETOTALS must be in OnPreDataItem section...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Thanks for the info!
Microsoft Dynamics NAV Developer
The CREATETOTALS do not need to Show the value to be counted.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.