Problem with TotalPages when printing more than one report

Hi everyone,

I am having a problem with page numbers in NAV 2013 reports.
I am using a textbox with the following expression:

="Page " & Globals!PageNumber & "/" & Globals!TotalPages

It works just fine when I print one report at a time, but when I print many reports together, it gives me something like:
Page 1/20, Page 2/20, Page 3/20, etc…as if it was only one document…
How can I fix that???

Thanks in advance :)


What is meant by many reports printing ??

For exmple, if I print multiple copies of one report…

You simply can’t do that on a batch report or multiple copies of the report,

no one has yet ever manage to do a clean and elegant implementation of Page X of Y.

However people have implemented some tricks like doing a two pass reports on the data set.

First Past → Your Preview or print on a PDF your report to actually count the N° of page and store this information for usage in pass 2

Second Pass → your print your report and get the count from the the first pass.

Such a trick is described in Matt Traxinger’s book :

This is a missing feature that I’ve got on my wish list since 1997 (Navision Financial 1.30!)

Almost two decade later I’m still wishing for what may seems a straight forward task to do …

try this in the page number =Code.IsNewPage(0,Fields!Sales_Invoice_Header_No_.Value,Fields!OutputNo.Value)

and the new page text box should have


and add below code in the report code

REM Reset Page Number:

Shared offset as Integer

Shared newPage as Object

Shared currentgroup1 as Object

Shared currentgroup2 as Object

Shared currentgroup3 as Object

Public Function GetGroupPageNumber(NewPage as Boolean, pagenumber as Integer) as Object

If NewPage

offset = pagenumber - 1

End If

Return pagenumber - offset

End Function

Public Function IsNewPage(group1 as Object, group2 as Object, group3 as Object) As Boolean

newPage = FALSE

If Not (group1 = currentgroup1)

newPage = TRUE

currentgroup1 = group1

currentgroup2 = group2

currentgroup3 = group3


If Not (group2 = currentgroup2)

newPage = TRUE

currentgroup2 = group2

currentgroup3 = group3


If Not (group3 = currentgroup3)

newPage = TRUE

currentgroup3 = group3

End If

End If

End If

Return newPage

End Function

Hey Anil:

I guess you meant to say:

insert this code → =Code.GetGroupPageNumber(ReportItems!NewPage.Value,Globals!PageNumber)