BI Publisher formerly XML publisherBI Publisher Classes
Agenda• BI Publisher overview. – What is it and Where is it? – Advantages of BI Publisher.• Advanced Reporting – Using People Code BI Publisher Classes.
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.
What is BI Publisher? A template-based reporting tool Separates querydata, Report layout, Translation Creating and generating day to day Business oriented ReportsUsers 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
BI Publisher ClassesBI Publisher classes divided into the following sections:• BI Publisher Report manager Definition class• BI Publisher Report manager class• BI Publisher Engine classBefore using above classes following application packages are import the peoplecodeprogram import PSXP_RPTDEFNMANAGER import PSXP_REPORTMGR import PSXP_ENGINE
1.Report Definition ClassReportDefnSyntax ReportDefn(ReportId) Note : Report id should be uniqueDescription Use the ReportDefn class to generate and publish report output.Example import PSXP_RPTDEFNMANAGER : ReportDefn &rptDefn;
Report Definition Class MethodsGetSyntax 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).
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 isnt a PeopleSoft Query.SetPSQueryPromptRecordSyntax 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.
Report Definition Class Methods Continued….ProcessReportSyntax 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.
Report Definition Class Methods Continued….PublishSyntax Publish(ServerName, ReportPath, FolderName,ProcessInstanceId) &rptDefn.Publish(&serverName, "", &folderName, &PID);Description use the Publish method to post the report
Report Definition Class Methods Continued….DisplayOutputSyntax 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 ()
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 )
1.PageNumber Class PropertiesFontSizeDescription 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;PositionXDescription Use the PositionX property to specify the X axis position of the text page number in the merged document. This property is read-write.PositionYDescription 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;
PageNumber Class Properties….StartFromPageNumDescription Use the StartFromPageNum property to specify the page index from which youd 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.
2.PDFMerger ClassPDFMergerSyntax 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();
PDF Merger Class Methods….MergePDFsSyntax 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.ParametersPDFFileArray 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.
ReturnsA 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);
Sample BI Publisher ProgramTo 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;
Sample BI Publisher ProgramStep 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);
Sample BI Publisher ProgramStep 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 youve generated the report, you may want to publish it to another location. &rptDefn.Publish(&serverName, "", &folderName, &PID);