Template Preparation and Sample Data
After selecting to customize a template such as a confirmation letter, or folio, two files (*.rtf and *.xml) are downloaded to the client workstation and Microsoft Word automatically opens the [filename].rtf. Use the Oracle BI Publisher toolbar to load the corresponding XML data (select Data, select Load XML Data, and then select the applicable XML file).
Note:
The Oracle BI Publisher toolbar appears in Microsoft Word after installation of the Oracle BI Publisher software. If the toolbar does not appear automatically, select View, select Toolbars, and then select Template Builder to add it to the existing toolbar display. Alternatively, you can use the Oracle BI Publisher function menu, which always appears with the other function menus at the top of Microsoft Word once the Oracle BI Publisher software has been installed.
Figure 8-1 Load XML Data
Figure 8-2 sample_guest_confirmation.xml file
Once the XML is selected, a “Data loaded successfully” message appears and informs you that the sample XML data is now loaded for use in customization.
Note:
Only standard operating-system packaged fonts are supported.
Note:
Although this tool utilizes Microsoft Word for customization, not all elements can be used on the template. An RTF template is a document which describes how data is presented. It does not contain knowledge of how to extract data, only tags containing field names. Macros cannot be used because the report is stored in *.RTF format.
Adding and Editing Form Fields
clicking an existing field or selecting Tools and then selecting Field Browser to edit existing fields or
clicking Insert and then selecting Field to add a new field to the template document.
Figure 8-3 Selecting a Field from the List of Field Values
It is recommended that tables are used to keep the field positions static. When creating a new table in Word, be sure to set the AutoFit behavior to ‘AutoFit to Contents’ to avoid truncating fields larger than the actual cell size or resizing a cell to accommodate a field with a longer description than the display data. Refer to Microsoft Word Help (F1) for more details.
After the XML data has been loaded into the Template document, use the Insert and Field menu items to insert new fields in the document and edit accordingly.
Select the XML tag or field to add to the customizable report from the list of available fields. The Tree of available fields is divided into the sections applicable to the report, (for example, header, footer, body, and so on). You can add fields by highlighting and dragging to the document or double clicking on a selected field from this list.
Advanced Layout Options
Adding and Editing IF Statements for Conditional Regions of the Template
Notice that IF statements appear throughout the document template. IF and ENDIF represent the IF and END IF statements provided with the sample reports. All content contained within the IF to ENDIF statements only appears based on the conditions of the IF statement being met. For instance, if a guest has a reservation where a deposit is not required for their stay, the IF statement suppresses the field DEPOSIT_DUE from displaying on the confirmation.
Figure 8-4 Adding IF Statements
Viewing and/or editing the condition of an existing IF statement can be done one of two ways. First, double-click on the field for the IF statement you want to modify. The Text Form Field Options screen appears. Click the Add Help Text button. The Form Field Help Text screen appears. From here you can manually edit the IF statements to meet your requirements.
<?if: [ELEMENT][CONDITION]?>
Where element is the field name and condition is what must evaluate to true. Ensure the [ELEMENT] from the XML is referenced in uppercase.
IF can be combined with other string functions.
CONTAINS
<?if: contains(ELEMENT,’txt_to_search_for’)=’true’?>Yes it does <?end if?>
<?if:(VIP='V1')
STARTS-WITH
<?if: starts-with(COMPANY_NAME,'Oracle')?><?end if?>
Figure 8-5 Field Browser screen
Adding Conditions for Internal Parameters
Each customizable report contains internal parameters that are used for report generation. These parameters can be utilized when creating conditions for report generation. For example, if a property wants to display a graphic on a confirmation letter only when generating output in a PDF format, these internal parameters would be used. The XML Tags of Param Name and Param Value are displayed in the available fields list.
Figure 8-6 Internal Parameters List
To see the list of available internal parameter values, open the [filename].xml that is downloaded to the workstation along with the customizable [filename].rtf file (where [filename] is the name of the file you have customized).
<?if:PARAM_VALUE[../PARAM_NAME='DESFORMAT']='PDF'?>
Figure 8-7 Form Field Help Text screen
Insert an ENDIF statement to close the condition, then click OK and OK again to return to the customized report.
Inserting Images
There are two methods for inserting images into templates. For HTML email delivery (for example, confirmation letters), images must be published to a web server and the URL reference method must be used to reference the URL to the image. Referencing the image using the URL method provides a faster load/processing time for the template file since the file is smaller when the image is referenced rather than imbedded in the file.
Note:
There is a file size limit of 2MB for RTF templates.
Directly Inserting Images
For PDF output, images can be inserted directly into the RTF template.
Insert the jpg, gif, or png image directly in the template by selecting Insert and then selecting Pictures.
Inserting Images with URL References
Reference to a web image means the image is fetched at runtime; the image can be updated at any time without the need to modify the template(s).
Include an alternative text link for an image.
Insert a dummy graphic into the layout in Word by selecting Insert and then selecting Pictures.
Right-click the image and select the Format Picture option and then click the Alt Text tab.
URL:{'http://<image location>'}Some examples for web images:
URL:{'http://www.example.com/images/ora_log.gif'}
URL:{'http://www.hotelserver.com/images/logo.gif'}
Figure 8-8 Format Picture and Alt Text tab
Graphic Image Size
The external images used within the document should be sized to suit the layout of the document and then published to the web server. The dummy graphic (used as a place holder within the RTF) can also be set to the required image size using picture tools.
Formatting Date and Number Fields
Specify an explicit date format mask using Microsoft Word’s native date format mask.
Specify an explicit date format mask using Oracle’s format-date function.
Note:
Only one method should be used. If both the Oracle and MS Word format masks are referenced for a field, the data is formatted twice causing unexpected behavior.
Open the Form Field Options dialog box for the placeholder field.
Set the Type to Regular Text.
Click the Add Help Text button to open the Form Field Help Text dialog.
<?format-date: [DATE FIELD]; ’[MASK]’?>
<?format-date:ARRIVAL_DATE_ISO;’YYYY-MM-DD’?>
Figure 8-9 Date Format Mask
Table 8-1 Predefined Format Masks
Mask | Output for US Locale |
---|---|
SHORT |
12/31/1999 |
MEDIUM |
Dec 31, 1999 |
LONG |
Friday, December 31, 1999 |
SHORT_TIME |
12/31/99 6:15 PM |
MEDIUM_TIME |
Dec 31, 1999 6:15 PM |
LONG_TIME |
Friday, December 31, 1999 6:15 PM |
SHORT_TIME_TZ |
12/31/99 6:15 PM GMT |
MEDIUM_TIME_TZ |
Dec 31, 1999 6:15 PM GMT |
LONG_TIME_TZ |
Friday, December 31, 1999 6:15 PM GMT |
Figure 8-10 Text Form Field Options with field type as a Date
Specify an explicit format mask using Microsoft Word’s native number format mask.
Specify an explicit format mask using Oracle’s format-number function.
Figure 8-11 Text Form Field Options with field type as a number
Open the Form Field Options dialog box for the placeholder field.
Set the Type to Regular Text.
Select the Add Help Text button to open the Form Field Help Text dialog.
<?format-number:fieldname;'999G999D99'?>
Figure 8-12 Form Field Help Text
Note:
For further information on formatting dates and numbers, refer to https://docs.oracle.com/middleware/12211/bip/BIPRD/GUID-7BD3C665-851A-43FE-BA2D-7501390D95AC.htm
Adding Hyperlinks for PDF and HTML Output
Figure 8-13 Inserting a link in the template
Figure 8-14 Entering the URL for the link
Figure 8-15 Defining a link for an image
Non-Western Fonts
Only OS-packaged, standard fonts are supported. To support internationalization and non-Western character sets, a unicode font must be used in the RTF template. Arial Unicode and Lucida Sans Unicode are two standard Unicode fonts installed with Microsoft Windows and Microsoft Office.
Figure 8-16 Selecting a Unicode font
Extended SQL and XSL Functions
<?xdofx:expression?> for extended SQL functions
<?xdoxslt:expression?> for extended XSL functions
<?xdofx:if [ELEMENT][condition] then result1 else result2 end if?>
For further information, refer to https://docs.oracle.com/middleware/12212/bip/BIPRD/GUID-B39D756A-C54D-4C64-A822-DD2CFFC3A54E.htm#BIPRD3160.
Preview and Finalize the Template
Figure 8-17 Preview Options for Custom Report