这里演示一下,开发一个最简单BI Publisher Report的流程,下图为开发的基本流程.
Data Template(.xml) 作为Data Source,用于数据源的定义,以及取数的SQL语句;
Template(.rtf) 用于定义输出展示(Layout); (RTF:Rich Text Format)
1.首先创建一个Demo数据
- CREATETABLE demo_products
- ( product_code NUMBER,
- product_name VARCHAR2 (100));
- INSERTINTO demo_products
- VALUES (569, 'Oracle Cost Management');
- INSERTINTO demo_products
- VALUES (401, 'Oracle Inventory Management');
- COMMIT;
2.Define Data Template
Date Template为XML文件,基本的格式如下图
<parameters><parameter>为传入参数项
<dataQuery><sqlStatement>为Report所执行的Query语句
<dataTrigger>用于指定beforeReport或afterReport,调用那个Function/Procedure
<dataStructure>为XML输出的结构
这里创建我们的Data Template文件
- <?xmlversion="1.0"encoding="UTF-8"?>
- <dataTemplatename="demoProductsDT"description="Demo Products Details"version="1.0">
- <parameters>
- <parametername="p_product_id"datatype="number"/>
- </parameters>
- <dataQuery>
- <sqlStatementname="DQ">
- <![CDATA[ SELECT product_code, product_name FROM demo_products
- WHERE product_code = NVL(:p_product_id,product_code) ]]>
- </sqlStatement>
- </dataQuery>
- <dataStructure>
- <groupname="G_DP"source="DQ">
- <elementname="PRODUCT_CODE"value="product_code"/>
- <elementname="PRODUCT_NAME"value="product_name"/>
- </group>
- </dataStructure>
- </dataTemplate>
3.Create Data Definition & Associate with Data Template
XML Publisher Administrator -> Data Definitions -> Create Data Definition
这里的Code会被后边定义的Concurrent Program用到.
接下来,Data Template 'Add File',选择我们第二步定义的XML Data Template.
4.接下来切换到Application Developer职责下,定义一个新的Concurrent Program
注意:
1. Output format应该XML
2. Short Name和之前定义Data Definition中的Code完全一样
What is XDODTEXE used in the Executable section of Concurrent Program?
XDODTEXE
is a BI Publisher Data Template Executable. The purpose of this
executable is to identify data template file (.xml) and execute the data
template to generate the raw xml data, that later can be used by BI
Publisher formatting engine to format as as per the layout (RTF, PDF
etc).
This executable will be used by all the BI Publisher reports
(Concurrent Program) which are using Data Template to generate the xml
data.
5.Concurrent Program Parameter
6.把这个新定义的Concurrent Program绑定到对应Request Group里
切换到System Admin职责,Security > Responsibility > Request,把刚定义好的Program绑定到一个Request Group里
7.运行Concurrent Program
8.Output
保存上面这个Output成XML格式,我们还需要基于这个xml output做RTF template,RTF Template为了让报表输出更友好,更灵活的展示,而不是只给用户一个XML结果。
9.下载安装XML Publisher Desktop
refer:http://blog.csdn.net/pan_tian/article/details/8283543
10.Define the RTF Template using the Generated Data XML
加载项> 导入XML数据导入第8步的output的xml文件
然后“插入”> “表向导”
掠过定义模板的几步,最终RTF模板文件样子大概如下,
11.Registering the Template with BI Publisher
XML Publisher Administrator -> Templates -> Create Template
12.Run the concurrent program to see the output
重新切换到Concurrent Program的定义Form上,更改输出的文件类型,然后文件输出的格式也就随之发生改变