To Dynamically insert blank
rows in RTF template
1) Why we require Dynamic
Blank rows in RTF template?
Few business requirements demand fixed BIP report tabular layout irrespective
of number of rows displayed per page. For example if a query returns 32 rows
and BIP layout per page is fixed to show 10 rows , report would span across 4
pages. The layout of the report should be intact though there are 2 rows to be
shown on the last page. Row filler concept can be used to fill the table in RTF
with blank lines dynamically.
2)
Steps to insert Blank rows in the template
·
Create a variable at Table header
to select all the rows from the Group element.
·
Write a logic in the End for each
tag to fix how many number of records that should come in each page.
·
Add an Extra Blank Row in the
table for Row filler functionality
·
Write a logic to find how many
number of blank rows need to be inserted in the table based on the number of
rows in the group element
·
Write a logic to put a straight
line at the end of the each page when data is floating to next page.
o Create a variable at Table header to select all the rows from the Group
element.
In the
above screenshot, we have created a variable "rowlimit" to select all the
records from the group element with below formulae.
<xsl:variable
xdofo:ctx="incontext" name="inner_group"
select=".//G_1"/>
From
this formula, we can get the total number records that we need to display in
the report.
o Write a logic in the End for each tag to fix how many number of records
that should come in each page.
Based on
the requirement, if we need to show only 10 lines in each page then below
formulae will help to fulfill the requirement.
<?if:position() mod 17=0?><xsl:attribute
name="break-before">page</xsl:attribute> <?end
if?><?end for-each?>
o Add an Extra Blank Row in the table for Row filler functionality
In order to use the Row
filler functionality we need to insert an extra blank row in the table as
below.
o Write a logic to find how many number of blank rows need to be inserted
in the table based on the number of rows in the group element
Here comes the main part of
the logic to find how many number of records to be inserted in the table based
on the total number of records available in the group element.
Considering earlier
scenario, we have 32 number of records in the group element and only 10 rows to
be printed on each page. Below formula can be used to calculate how many blank
records needs to be printed on last page.
<?for-each:xdoxslt:foreach_number($_XDOCTX,1,10 -
(count($inner_group) mod 10),1)?>
From above formula, $inner_group is total records present
in the Group element. Considering the earlier scenario, last page only 2 rows
to printed from 10 rows, remaining 7 blank rows has be inserted by the above
formula.
o Write a logic to put a straight line at the end of the each page when
data is floating to next page.
Additional requirement to
turn Cell Boarders On and Off when data is floating to second page, then below
formula can be used.
<?attribute@incontext:border-bottom;'0.01pt solid #000000'?>
From above 0.01pt is the thickness of the line,
the more you increase the value the more thickness of line increase.
To achieve this create a
variable in the Row filler section (Extra blank row) and use the above formula.
The cell boarders shall
appear in the report as below.