1. BI Publisher
formerly XML publisher
BI Publisher Classes
2. Agenda
• BI Publisher overview.
– What is it and Where is it?
– Advantages of BI Publisher.
• Advanced Reporting
– Using People Code BI Publisher Classes.
3. BI Publisher
• Released in PeopleTools 8.52.
• Standalone Java based technology that streamlines report generation.
• Template based reporting tool, separating data extraction from report layout.
• Can create report templates using Windows applications like Microsoft Word, Adobe Acrobat.
• Generate multiple reports in many formats like PDF,RTF,HTML and EXCEL,POWER POINT etc.
4. What is BI Publisher?
A template-based reporting tool
Separates querydata, Report layout, Translation
Creating and generating day to day Business oriented Reports
Users can create:
• Customer-ready PDF documents, such as financial statements, marketing materials, contracts, invoices, and
purchase orders utilizing colors, images, font styles, headers and footers, and many other formatting and
design options
• Excel output to create a spreadsheet of your report data
• PowerPoint slides for presentations
• "Filled-out" third-party provided PDF documents (such as 1099s). Download a PDF document, such as a
government form, to use as a template. At runtime, the data and template produce a "filled-out" form
5. BI Publisher Classes
BI Publisher classes divided into the following sections:
• BI Publisher Report manager Definition class
• BI Publisher Report manager class
• BI Publisher Engine class
Before using above classes following application packages are import the peoplecode
program
import PSXP_RPTDEFNMANAGER
import PSXP_REPORTMGR
import PSXP_ENGINE
6. 1.Report Definition Class
ReportDefn
Syntax
ReportDefn(ReportId)
Note : Report id should be unique
Description
Use the ReportDefn class to generate and publish report output.
Example
import PSXP_RPTDEFNMANAGER : ReportDefn &rptDefn;
7. Report Definition Class Methods
Get
Syntax
Get(); Eg :- &RptDefn.Get();
Description
Use the Get method to return a reference to the existing ReportDefn object.
Parameters
None. It does not take any Input parameters.
Returns
A reference to the newly instantiated and populated ReportDefn object.
SetRuntimeDataXMLFile ( Data Source is XML file )
Syntax
SetRuntimeDataXMLFile(FilePath)
Description
Use the SetRuntimeDataXMLFile method to specify an existing XML file as the data source for the report.
Example :
&rptDefn.SetRuntimeDataXMLFile(&sFileName).
8. Report Definition Class Methods Continued….
GetPSQueryPromptRecord ( Data Source is PS Query )
Syntax
GetPSQueryPromptRecord()
Description
Use the GetPSQueryPromptRecord method to return the runtime prompts of a query as a record object. This
method should only be used when the data source type associated with the report definition is a PeopleSoft
query. This method returns a null when the data source type isn't a PeopleSoft Query.
SetPSQueryPromptRecord
Syntax
SetPSQueryPromptRecord(&Record)
Description
This method can only be used with reports that have a PeopleSoft query defined as the data source.
You must use this method before using the ProcessReport method.
9. Report Definition Class Methods Continued….
ProcessReport
Syntax
ProcessReport(TemplateId, LanguageCD, AsOfDate, OutputFormat)
Use the ProcessReport method to generate a report and store the information.
Before you generate the report, you must:
Set the report output destination with the OutDestination property if the output type is a file.
After you use the ProcessReport method, you can use the Publish method to post the report, the DisplayOutput
method to display the report in a browser window, or the PrintOutput method to print the report.
10. Report Definition Class Methods Continued….
Publish
Syntax
Publish(ServerName, ReportPath, FolderName,ProcessInstanceId)
&rptDefn.Publish(&serverName, "", &folderName, &PID);
Description
use the Publish method to post the report
11. Report Definition Class Methods Continued….
DisplayOutput
Syntax
DisplayOutput()
Description
Use the DisplayOutput method to display the report generated by the ProcessReport method in a separate
browser window.
You must successfully call the ProcessReport method prior to calling this method.
This method displays a single report. Therefore, the report definition must not be set for bursting.
Parameters
None.
Example : &rptDefn.DisplayOutput ()
12. 2.BI Publisher Engine Class
BI Publisher Engine class can be divided into 4 categories
1.PageNumber class
2.PDFMerger class
3.Properties class
4.Watermark class
PageNumber
Syntax
PageNumber()
Description
Use the PageNumber constructor to instantiate a PageNumber object.
Example :
import PSXP_ENGINE:PageNumber;
Local PSXP_ENGINE:PageNumber &pNum;
&pNum= create PSXP_ENGINE:PageNumber(); ( Creating a Page Number )
13. 1.PageNumber Class Properties
FontSize
Description
Use the FontSize property to specify the size of the page number, as a number.
The default value is 8.
This property is read-write.
Example :
Local PSXP_ENGINE:PageNumber &oPageNumber;
&oPageNumber.FontSize = 16;
PositionX
Description
Use the PositionX property to specify the X axis position of the text page number in the merged document.
This property is read-write.
PositionY
Description
Use the PositionY property to specify the Yaxis position of the text page number in the merged document.
This property is read-write.
Example :
&oPageNumber.PositionX = 300;
&oPageNumber.PositionY = 20;
14. PageNumber Class Properties….
StartFromPageNum
Description
Use the StartFromPageNum property to specify the page index from
which you'd like to start the page numbering.
For example,
if you have a PDF document which has two cover pages, and you want to start printing
page numbers on the document from the third page, specify a three for this property.
This property is read-write.
15. 2.PDFMerger Class
PDFMerger
Syntax
PDFMerger()
Description
Use the PDFMerger constructor to instantiate a PDFMerger object.
Parameters
None.
Returns
A reference to a PDFMerger object.
Example :
import PSXP_ENGINE:PDFMerger;
Local PSXP_ENGINE:PDFMerger&Merger
&Merger =createPSXP_ENGINE:PDFMerger();
16. PDF Merger Class Methods….
MergePDFs
Syntax
MergePDFs(PDFFileArray, PDFOutputFile, Error)
Description
Use the MergePDFs method to merge the specified PDF files into a single output file.
The order of the files specified in the array are the order in which the files are merged.
Parameters
PDFFileArray
Specify an already instantiated and populated array of string containing the names of the PDF files that
you want to
merge together.
PDFOutputFile
Specify the full path name of the file you want populated with the merged PDF file.
Forward or back slashes are used in the path according to the operating system of the application server
or process scheduler server. That is, on Unix servers, the directory separator is a forward slash, while a
Windows server returns a path with back slashes.
Error
If any errors occur during processing, this parameter is populated with the text of the error message after
processing.
17. Returns
A Boolean: true if the method completed successfully, false otherwise. If this method returns false,
The Error parameter is populated with the text of the error message that occurred.
Example :
Local PSXP_ENGINE:PDFMerger &Merger;
&sErr = "";
&arrayName = CreateArray(&sPdfFile1);
&arrayName.Push(&sPdfFile2);
&Result = &oMerger.mergePDFs(&arrayName, &sOutputPdfFile, &sErr);
18. Sample BI Publisher Program
To generate and publish a report:
Step 1 :
Import the appropriate application class.
Because this program generates and publishes a report, you need to import the report manager definition class.
import PSXP_RPTDEFNMANAGER:ReportDefn;
Step 2 :
Initialize variables.
The variable declaration strings not only specify values for the variables, but give them type and scope as
well. This can be very useful when debugging.
Local string &sFileName = "c:pathfilename.xml";
Local string &rptDefnId = "Financial";
Local string &LanguageCode = "ENG";
Local date &effdt = Date(20090821);
Local string &outputfmt = "HTM";
Local string &folderName = "General";
Local string &serverName = "PSNT";
Local PSXP_RPTDEFNMANAGER:ReportDefn &rptDefn;
19. Sample BI Publisher Program
Step 3 :
Instantiate the report definition object and initialize it.
/* Create report definition and connect to the generated XML document. */
&rptDefn = create PSXP_RPTDEFNMANAGER:ReportDefn(&rptDefnId);
Step 4:
After instantiate report definition objet using Get method to populate report definition object.
&rptDefn.Get();
Step 5:
Specify the data for the report.
This report uses an XML file as the data source, so you must specify the runtime data source for the report
before you process it.
&rptDefn.SetRuntimeDataXMLFile(&sFileName);
20. Sample BI Publisher Program
Step 6 :
Process the report.
You must process the report, generate a version of it for the report repository, before you can distribute
the report.
&rptDefn.ProcessReport("", &languageCd, &effdt, &outputfmt);
Step 7:
Publish the report.
After you've generated the report, you may want to publish it to another location.
&rptDefn.Publish(&serverName, "", &folderName, &PID);