Reputation: 864
Is there a way to trigger the row visibility depending on the page number?
i need to show a grant total at the beginning of a table and a subtotal at the end of every page, but the subtotal only, if the report will be greater than 1 Page.
I tried with some code execution on the footer / header section and store the PageNumber, because Globals!PageNumber isn't accessible from the body. But no effect, seems the footer and header section is created later so my variable in the report code is always 0 while reading it in the table row hidden expression.
How could this be done? Any different ideas how to hide a table row on first page?
Upvotes: 1
Views: 2119
Reputation: 1281
Similar to re-setting page number in this post, you can add custom code to check what page you are on and then call setPageNumber
function from the header for first page only and checkIfFirstPage
function in Visibility Expression for your row:
Shared pageNumber as Integer
Public Function setPageNumber()
pageNumber = 1
Return newPage
End Function
Public Function checkIfFirstPage() as Boolean
Dim isFirstPage as Boolean
If (pageNumber = 1)
isFirstPage = true
pageNumber = pageNumber + 1
Else
isFirstPage = false
Endif
Return isFirstPage
End Function
To add custom code, open Report properties window, Code tab:
To call setPageNumber
from report header on first page only - you can add small text box in the header and set it to display white on white (so it won't show the value). Set the expression of the text box to:
= IIF(Globals!PageName = 1, Code.setPageNumber(), 0)
Another approach to your problem is to use Variables and text box in the header similar to this post.
Upvotes: 2