How Do I Define a Global Page Header or Footer? (Magic xpa 4.x)
It is often useful to have standard page headers that print on reports. Besides making the reports more consistent, it saves a lot of work when creating new reports. It also avoids the problem of having a hard-coded “Company name” that has to be changed when the company name changes.
Since the page header and footer are specified in the I/O device properties, it is a simple matter to point the task to the global form rather than a local one.
You create a global form simply by creating the form in the Main Program. The process is exactly the same as creating the form in any task.
Once the form is created, it will show on the form list, above the forms for that task. In the example above, you can see our two global forms, which are forms #2 and form #3. Our local forms for this task are forms #6 and #7.
There are some considerations when creating global headers and footers.
First, the report name typically prints in the header, along with perhaps some words about what filters were used. You can handle this easily by adding global variables to the Main Program, and updating them in Task Prefix of your reporting task.
Second, the Main Program doesn’t have access to the page number via the Page(n,n) function which is typically used for reports, so you need to update a global page number variable from your reporting task. This is done by setting a Page Header event. When the Page Header event is triggered, it updates the global page number. In our example, it is updated to Page(0,1) because the I/O device is the first I/O device in the current task.
The Online and Rich Client Samples projects (program RP04 and RRP04)