Tip:
Highlight text to annotate it
X
0:00:03.066,0:00:07.000
Do you need to have multiple report pages appear
on a physical page?
0:00:07.000,0:00:14.066
In this presentation I will cover working with logical
and physical pages, within the application code
0:00:14.066,0:00:17.066
and within the report design document.
0:00:18.000,0:00:24.033
Typically, we do not think in terms of logical and
physical pages when we create a report
0:00:24.033,0:00:29.066
as we expect each report page to print on its own
physical page.
0:00:29.066,0:00:37.000
There can be times, however, when you need to
have multiple report pages print on a single
physical page.
0:00:37.000,0:00:45.033
In terms of definitions, a logical page refers to the
page as defined by the paper settings of the report
design document
0:00:45.033,0:00:49.000
or by API calls within the report application itself.
0:00:49.000,0:00:55.033
To implement logical page mapping -- the mapping
of logical to physical pages --
0:00:55.033,0:01:03.066
the report application calls reporting API functions
that specify how the logical pages will be mapped
to the physical pages.
0:01:06.066,0:01:13.033
For my demonstrations, I'm going to use a report
that I've created and named the "Simple List
Report".
0:01:13.033,0:01:18.000
I've set up my reports demo application to include
this report,
0:01:18.000,0:01:28.000
which outputs the default of one logical page per
physical page.
0:01:31.033,0:01:38.066
In order to implement logical page mapping -- in
order to have multiple logical pages on each
physical page --
0:01:38.066,0:01:44.000
I need to add some page-related reporting API
functions to the report application.
0:01:44.000,0:01:48.066
These include
fgl_report_selectLogicalPageMapping,
0:01:48.066,0:01:51.066
fgl_report_configureMultipageOutput,
0:01:51.066,0:01:55.066
and fgl_report_setPaperMargins.
0:01:57.000,0:02:03.000
Information about these functions can be found in
the Genero Report Writer documentation,
0:02:03.000,0:02:06.033
specifically within the reporting API functions
0:02:06.033,0:02:12.000
relating to the page.
0:02:14.066,0:02:19.066
The first function is
fgl_report_selectLogicalPageMapping.
0:02:19.066,0:02:23.000
This function takes a single string parameter as its
argument.
0:02:23.000,0:02:32.033
To specify that multiple ISO or JIS sized pages be
printed on the physical page, you set this
parameter to "multipage".
0:02:34.033,0:02:42.066
The next function to add is
fgl_report_configureMultipageOutput. There are
three parameters to specify for this function.
0:02:42.066,0:02:50.066
the first parameter is pageExponent. With this
parameter, you specify the exponent to apply to the
number 2.
0:02:50.066,0:03:00.033
if you enter 2, for example, you are specifying 2 to
the power of 2, resulting in four (4) logical pages
printed on a physical page.
0:03:00.033,0:03:05.066
if you enter three, you are specifying 2 to the power
of 3,
0:03:05.066,0:03:09.000
resulting in eight (8) logical pages printed on a
physical page.
0:03:09.000,0:03:15.000
Enter 4 and you end up with 16 logical pages, and
so on.
0:03:15.000,0:03:19.000
The second parameter is the ISO number
parameter which takes an integer.
0:03:19.000,0:03:26.033
As per our example, if you want the logical page to
be an ISOA4 page, you would enter 4.
0:03:26.033,0:03:36.000
if the page is defined as an ISO or JIS sized page
-- defined in the report definition or set it by the
application with fgl_report_configurePageSize --
0:03:36.000,0:03:42.033
then you can enter NULL for this parameter and the
predefined size will be used.
0:03:42.033,0:03:47.033
The last parameter specifies whether you want the
layout to be portrait or landscape.
0:03:47.033,0:03:51.066
For portrait set to TRUE, for landscape set to
FALSE.
0:03:53.000,0:04:00.066
The lasat function that I will add is
fgl_report_setPaperMargins which allows you to
specify a top,
0:04:00.066,0:04:13.000
bottom, left, and right page margin size for my
physical report page.
0:04:14.033,0:04:18.000
Let us switch back to studio and add code to our
report application.
0:04:18.000,0:04:27.033
we need to add these reporting API functions to the
function that configures our report, so I am looking
for my configureReport function.
0:04:27.033,0:04:32.033
We need to add it prior to calling
fgl_report_commitCurrentSettings.
0:04:32.033,0:04:41.033
To same time, I have added the code here; let me
remove the comments and review the code. We
check to see if the report is the Simple List Report;
0:04:41.033,0:04:46.033
We use fgl_report_selectLogicalPageMapping to
specify a multipage report;
0:04:46.033,0:04:54.000
We use fgl_report_configureMultipageOutput to
specify 4 logical pages per physical page (2 to the
power of 2),
0:04:54.000,0:04:58.033
an ISO size of 4, and a portrait layout;
0:04:58.033,0:05:08.000
and we use fgl_report_setPaperMargins to provide
a top and bottom margin of 2.5 cm and a left and
right margins of 0.5 cm.
0:05:08.000,0:05:13.033
We save our changes and we run the report.
0:05:13.033,0:05:20.033
Switching to the Genero Report Viewer, we can
see that we now have four logical pages to each
physical page.
0:05:20.033,0:05:27.033
Our report displays a logical page number on each
logical page. Now let us add the physical page
numbers to that same footer.
0:05:29.066,0:05:34.033
To add the physical page numbers to a report
footer we need to do the following:
0:05:34.033,0:05:37.066
at a Page Number Box to the report footer
0:05:37.066,0:05:43.033
and edit the text expression property to include
numeric methods that return physical page
information;
0:05:43.033,0:05:52.000
either the getPhysicalPageNumber returning the
physical page number, or the getTotalNumberOf-
PhysicalPages page count.
0:05:52.000,0:05:55.066
These two methods do not take any arguments.
0:05:59.033,0:06:03.000
To show this, let us look at the Simple List Report
design document.
0:06:03.000,0:06:12.066
I find the footer and I add a new Page Number Box.
0:06:12.066,0:06:19.066
Having selected the new Page Number Box, I
search its properties for the Text Expression
property
0:06:19.066,0:06:24.033
and I open the Expression Editor.
0:06:24.033,0:06:31.000
I start by entering a string with quotes that states
"Physical page "
0:06:31.000,0:06:37.066
then a plus sign, then I start entering my first
method starting with format.
0:06:37.066,0:06:41.000
The Control + Space Bar combination opens up
the Code Completion box,
0:06:41.000,0:06:46.033
allowing me to select from a list of valid choices
based on the current context.
0:06:46.033,0:06:55.000
I specify the getPhysicalPageNumber method
followed by a set of parentheses, and I want the
number displayed as an Arabic.
0:06:55.000,0:07:00.033
Next, I had an additional string, including the word
"of" surrounded by spaces,
0:07:00.033,0:07:07.066
and finally I add another format method, passing in
the getTotalNumberOfPhysicalPages method
0:07:07.066,0:07:12.066
and specifying that the resulting number displays
as an Arabic number.
0:07:12.066,0:07:15.000
I ensure that I have "Expression OK"
0:07:15.000,0:07:20.000
and I save my changes.
0:07:20.000,0:07:34.000
The report is ready to run, and I can run the report
as I have only changed the report definition. I do not
need to recompile the application.
0:07:34.000,0:07:35.000
Looking at the report created,
0:07:35.000,0:07:45.066
I can see that it now contains information in the
footers about the physical page.