Share via


RDLC Display TextBox within Body on Last Page Only

Question

Wednesday, January 22, 2014 10:18 AM

Hi,

I have a table with a group footer.  In the footer i have a textbox.  I only want to display this on the last page.

I tried =IIF(Globals!PageNumber=Globals!TotalPages, False, True).  The problem is it doesn't let me use this within the body, only in the header or footer.

Is there anyway, i can display this textbox only on the last page?

Thanks in advance

All replies (1)

Friday, January 24, 2014 1:10 AM ✅Answered

Hi,

When you use these in a textbox in the body of a report you got an error:

So adding a textbox to the body of the report and determining via an expression if we are on the last page and then showing/hiding it is not an option. Why would we do this you might think. If you place something at the bottom of the Body it is automatically shown only on the last page, no? Well, in Dynamics NAV Document reports, the Body contains a List, putting it in the List would make it appear on every page and putting it below the List is not an option, because it needs to be shown on the last page, for everydocument.

No problem, let’s put it where it’s allowed, for example the Footer.

To be able to show a field in the dataset on a Footer (or Header) we will need to declare a Variable, a Set function and a Get function:

Shared LastPageInfo as Object
Public Function GetLastPageInfo() as Object
 Return Cstr(LastPageInfo)
End Function
Public Function SetLastPageInfo(NewData as Object)
 If NewData > "" Then
 LastPageInfo = NewData
 End If
End Function

Now we will create a Layout:

The textbox in the Footer is inside a Rectangle and in the Hidden property of the Rectangle we can set the following expression:

And voila the result:

Here you can download the example: InfoOnLastPage v1

For more Information, see:http://thinkaboutit.be/2012/12/show-a-footer-only-on-the-last-page/