|
Oracle BI Publisher Tipp
Getting dynamic
Excel-Sheets with RTF-Templates
|
|
Goal
In this Tipp following Report should be created:

We want a list of the employees for one department with salary & commission and the addition of both. In the last line we want the summary for all columns. Based on the query
select ename, job, sal, comm, deptno
from emp
where deptno = :p_deptno
this requirement is quite easy to implement (Download Template here):

For the addition of salary and commission we choose <?xdofx:decode(COMM,'',SAL+COMM)?> , because COMM could be NULL.
Using this Template for Excel-Output works, but changing a cell in the resulting sheet wouldn't change the addition or the summaries:

All Cell-Values are hard and thers' no Excel-Logic in the sheet.
Creating a Template for a dynamic Excel-SheetThe green marked fields had to be changed to get a dynamic sheet.

=CROW+DROWwhere ROW is a form-field with
<?position()+3?>
as content. For the summary of the salaries we use =SUM(C4:CMaxR)
where MaxR is a form-field with <?xdofx:count(ENAME)+3?>
as content. Like in the additions the 3 is available here, because the
output of data starts in the fourth row. Therefore the
hardcoded C4 in the formulae. Both could be implemented dynamic
with variables, which helps in maintainance situations (for example a
new hard-coded line at the top). The same we do for Column D
(commission) and Column E (Income).
