Report page numbering
Now familiar with Page ## to get page numbers in a footer, but its almost useless without the number of pages after it.
How can that be accomplished?
Be nice if that were simple right? For some reason, FileMaker does not offer a built in function or layout placeholder for that.
You can use the following script, however.
#after finding and sorting recors as needed for your report....Enter Preview mode //clear pause check boxGo to Record/Request/Page [last]Set Variable [$$TotalPages ; value: get ( pageNumber ) ]
If you then put this layout text in the header or footer:
## of <<$$TotalPages>>
You can run the above script and be able to see Page 1 of 5 or whatever on the pages of your report.
Script trigger in OnLayoutEnter?
That's one of many options.
What do you suggest as being the most efficient?
Doesn't much matter. It's more a case of convenience than efficiency. One way or other you have to run the script. Some systems have a navigation button that takes you to the report layout. If that button is set to run a script, the script can change layouts and then do whatever steps are needed to produce the report--including counting the pages to the report.
Other reports require that a use specify criteria to be used to pull up the needed records for the report. In those cases, the button to start the script that uses such criteria to find records can then include the needed code to count the records.
You can even use the change mode trigger to run the script so that manual finds by the user includes code to count the pages.
Same script, just different ways to make it run. The optimal choice depends on what else needs to happen before you number your report changes.
Note that it may also be able to calculate the total pages from the number of records in your report's found set. This approach is a lot trickier than the scripted method and won't work if you have any fields that slide up and resize the enclosing part to adjust for variable amounts of data.
Retrieving data ...