Saturday 27 May 2017

Accessing page numbers in SSRS report body

This post demonstrate how to access page numbers in SSRS report body AX 2012/AX 7/ Dynamics 365. 


1. Goto Report à Report Properties à Code in Visual studio

2. Write the below logic in code

Public Function PageNumber() as String
     Dim str as String
     str = Me.Report.Globals!PageNumber.ToString()
     Return str
End Function

Public Function TotalPages() as String
     Dim str as String
     str = Me.Report.Globals!TotalPages.ToString()
     Return str
End Function

3.  Create a text box and the below expression

=Cstr(Code.PageNumber()) & Space(2) & Labels!@SYS26401 & space(2) & Cstr(Code.TotalPages())


4. Example output 1 of 4