Condition LastPage() is not Working

Valid from List & Label 5
As List & Label works database independent, the fact that the current page is the last one is only known after the application has sent the last record. Thus, LastPage() can only be evaluated correctly for objects which are printed after the table object has finished printing.

If you want to make sure that your object will be printed after the table object you can link it to the table object. Simply go to the object list (Objects > Object List), select your table object and click the "Link to..." button. Select your object and confirm the dialog.
IDKBTE000577 KBTE000577