BI Publisher code for Oracle Policy Modeling

BI Publisher code for Oracle Policy Modeling

This topic shows the format that is required when using BI Publisher with Oracle Policy Modeling in order to display attributes (global and entity-level), conditional text and decision reports in an interview document.

For more information on using BI Publisher with Oracle Policy Modeling see Develop a template for an interview document.

Values and properties of global attributes

The table below shows the BI Publisher format (defined as Code in the Advanced tab) needed for the fields to display various values and properties of global attributes. "attribute_id" is the public name of the global attribute.

To display BI Publisher format Example Output Notes
Attribute value (formatted) <?attribute_id_value?> <?assessment_date_value?> 3/06/11 Formatted for the region specified in the OPM project (in this example, Australia). Formatted attribute value fields do not need the default BI Publisher code modified. These fields can simply be dragged and dropped into your template from the Field dialog box and require no further modification.
Attribute text <?attribute_id_text?> <?improvements_text?> There are improvements that the customer could make to the children's diet. Attribute text fields do not need the default BI Publisher code modified. These fields can simply be dragged and dropped into your template from the Field dialog box and require no further modification.
Attribute value (unformatted) <?attribute_id/value?> <?assessment_date/value?> 2011-06-03 BI Publisher provides a range of functions for working with unformatted data, including date settings. To use BI Publishers formatting features, select the Type and Format that you want for the value in the Properties tab for the field.
Attribute question text <?attribute_id/@question?> <?improvements/@question?> Are there improvements that the customer could make to the children's diet?  
Attribute type <?attribute_id/@type?> <?improvements/@type?> boolean This will return the attribute type (ie Boolean, text, currency, number, date, date and time, time of day).
Inferred status <?attribute_id/@inferred?> <?improvements/@inferred?> true This indicates whether the attribute is inferred (ie true) or not (ie false).

Conditional text and formatting

The table below shows the BI Publisher format needed to display conditional text or formatting. Each element enclosed in brackets (<>) is a separate BI Publisher field. Each of these fields must have the specified code set in the Advanced tab for the field. "attribute_id" is the public name of the global attribute. "Display text" is the text that you want to have shown when the specified condition is met.

To display BI Publisher format Example Notes
Text when a boolean attribute has a particular value <?if:attribute_id/value='unformatted attribute value'?>Display text<?end if?> <?if:improvements/value='true'?>Please make an appointment with one of our friendly dieticians to discuss how you could improve your family's health.<?end if?>
Text when a number attribute has a particular value <?if:number(attribute_id/value)>unformatted attribute value?>Display text<?end if?> <?if:number(cars_owned/value)>2?>As you have more than two cars, a double garage may not be suitable.<?end if?> This format/example uses the greater than operator (>) but any of the comparison operators can be used here.
Text when a currency attribute has a particular value <?if:number(attribute_id/value)<unformatted attribute value?>Display text<?end if?> <?if:number(total_reimbursement/value)<9?> You have been reimbursed less than the full amount.<?end if?> This format/example uses the less than operator (<) but any of the comparison operators can be used here.
Text when a date attribute has a particular value <?if:date(attribute_id/value)<date('unformatted attribute value')?>Display text<?end if?> <?if:date(date_of_birth/value)<date('2000-01-01')?>You were born last century.<?end if?> This format/example uses the less than operator (<) but any of the comparison operators can be used here.
Certain text when a formatted attribute has a particular value, otherwise displaying alternate text <?choose:?><?when:attribute_id_value='formatted attribute value'?>Display text when condition met<?end when?><?otherwise:?>Alternate display text<?end otherwise?><?end choose?> <?choose:?><?when:overall_rating_value='Excellent'?>Your children's diet is very well-balanced. Keep up the good work!<?end when?><?otherwise:?>There are improvements that you can make to your children's diets.<?end otherwise?><?end choose?>

Displays the text "Your children's diet is very well-balanced. Keep up the good work!" when the family's overall health assessment is Excellent. Otherwise displays the text "There are improvements that you can make to your children's diets."

This format/example uses equals (=) in the condition element but you can use other comparison operators, in which case, use the formatting described above.

Attribute value formatted a certain way when a formatted attribute has a particular value <?choose:?><?when:attribute_id_value>'formatted attribute value'?><?attribute_id_value?><?end when?><?otherwise:?> <?attribute_id_value?> <?end otherwise?><?end choose?> <?choose:?><?when:total_sweets_value>'4'?><?total_sweets_value?> <?end when?><?otherwise:?><?total_sweets_value?><?end otherwise?><?end choose?>

Displays the total number of sweets consumed by the children in bold red format if that number is greater than 4. Otherwise displays the total number of sweets consumed by the children in black non-bold format.

This can also be achieved by implementing conditional formatting. See the BI Publisher Users Guide for more information.

Values and properties of entity-level attributes

The table below shows the BI Publisher format needed to display entity-level attributes in various layouts. Each element enclosed in brackets (<>) is a separate BI Publisher field. Each of these fields must have the specified code set in the Advanced tab for the field. "entity_id" is the public name of the entity. <entity_level_attribute_element> is a field that takes the same format as those used to display global attributes (see above) but using entity-level attribute values and properties instead.

To display BI Publisher format Example Output Notes
Entity-level attributes grouped by entity

<?for-each:entity_id?>

<entity_level_attribute_element>

<entity_level_attribute_element>

<entity_level_attribute_element> ...

<?end for-each?>

<?for-each:child?>

<?child_name_text?>

<?child_rating_overall_text?>

<?child_rating_overall/@question?> <?child_rating_overall_value?>

<?end for-each?>

The child is Hayden.

Hayden's overall star rating is 4.

What is Hayden's overall star rating? 4

The child is Courtney.

Courtney's overall star rating is 2.

What is Courtney's overall star rating? 2

This format is also used when displaying entity level attributes in a native Microsoft Word table. That is, the first cell in the row needs to start with the <?for-each:entity_id?> field, and the last cell in the same row needs to end with the <?end for-each?> field (with the entity-level attribute fields in between).
Entity-level attributes grouped by attribute

<?for-each:entity_id?><entity_level_attribute_element><?end for-each?>

<?for-each:entity_id?><entity_level_attribute_element><?end for-each?>

<?for-each:entity_id?><entity_level_attribute_element><?end for-each?> ...

<?for-each:child?><?child_name_text?><?end for-each?>

<?for-each:child?><?child_rating_overall_text?><?end for-each?>

<?for-each:child?><?child_rating_overall/@question?> <?child_rating_overall_value?><?end for-each?>

The child is Hayden.

The child is Courtney.

Hayden's overall star rating is 4.

Courtney's overall star rating is 2.

What is Hayden's overall star rating? 4

What is Courtney's overall star rating? 2

 
Entity-level attributes sorted alphabetically by entity name

<?for-each:entity_id?>

<?sort:entity_name_id_value;'ascending';data-type='text'?>

<entity_level_attribute_element>

<entity_level_attribute_element>

<entity_level_attribute_element> ...

<?end for-each?>

<?for-each:child?><?sort:child_name_value;'ascending';data-type='text'?> <?child_name_value?>:
<?child_servings_sweets_text?>
<?child_servings_fruit_text?>
<?child_servings_dairy_text?> <?end for-each?>

Courtney:

The number of servings of sweets Courtney eats per day is 5.

The number of servings of fruit Courtney eats per day is 2.

The number of servings of dairy food Courtney eats per day is 3.

Hayden:

The number of servings of sweets Hayden eats per day is 0.

The number of servings of fruit Hayden eats per day is 3.

The number of servings of dairy food Hayden eats per day is 2.

This format can be used in native Microsoft Word tables too. That is, the first cell in the row needs to start with the <?for-each:entity_id?><?sort:entity_name_id_value;'ascending';data-type='text'?> fields, and the last cell in the same row needs to end with the <?end for-each?> field (with the entity-level attribute fields in between).

Decision reports

To display a decision report you need to:

The table below specifies the BI Publisher code needed to define the two fields described above.

Field BI Publisher code Example Notes
decision-report template <?template@inlines:decision-report?>

<?if@inlines:"attribute-node"?>

<fo:list-block start-indent="{count(ancestor::attribute-node) * 7}mm">

<fo:list-item>

<fo:list-item-label>

<fo:block>*</fo:block>

</fo:list-item-label>

<fo:list-item-body>

<fo:block><xsl:value-of select="@text"/></fo:block>

</fo:list-item-body>

</fo:list-item>

</fo:list-block>

<?for-each@inlines:./attribute-node?><?call-template:decision-report?><?end for-each?>

<?end if?>

<?end template?>

n/a

This field only needs to appear in a template document once.
call decision report template <?for-each:/global-instance/attribute_id/decision-report/*?><?call-template:decision-report?><?end for-each?>
<?for-each:/global-instance/improvements/decision-report/*?><?call-template:decision-report?><?end for-each?>