Decision Reports / Explanations in Forms

There is no doubt that the ability to “rewind” an outcome like “Computer says No” and find out why the computer says what it says is a fundamental part of many Oracle Intelligent Advisor projects. The explanation control is smart to use and easy to configure with the Silent and Invisible options, and just looks good out of the box. This is a very simple example I grant you but the look and feel is just, well, nice.

At most, one could perhaps complain that there is no extension capability or styling extension for a decision reports / explanations (please comment on that if you are of the same opinion) , but you can get round the latter with a bit of work.

But where a lot of practitioners get less enthusiastic, and perhaps lose a bit of faith in decision reports / explanations is when they decide to put one in a form. Then it is pretty much back to the drawing board. There are two types of decision report that you can put in a Form. If you only have a single level of explanation, as in my case above, you can use the One Level Deep version shown in the link.

If you have a multi-level explanation you can add the template shown on the same documentation page and use that. Here is an example of another explanation with two levels, using the template.

I think I can imagine the Oracle Intelligent Advisor developer saying “Asterisks? Seriously? That’s all I can offer to make it look good?”. We are used to a lot of flexibility and power in Oracle Intelligent Advisor, so when you see that for the first time it feels a bit…dull. Not to mention the Euro Symbol seems to have vanished!

So what can we do? Well there are several things we can do. For example, we can study the nature of the data that Oracle Analytics Publisher has at its disposal to get a better understanding of exactly what we have to work with. Go to the Debugger and Export the Form Data for a closer look:

Generate XML of Explanation

The explanation / decision report is found in the XML file that you get from that. I encourage the use of a decent XML viewer in Notepad ++ to be able to see the structure:

Decision Report XML

Once you see this, you begin to understand the structure of the template file pointed out in the documentation:

Each time you call the decision report template, it will be inserted in the text of your report.

If there is an attribute node, indent yourself by 7 mm per the number of levels above, then insert a list item and build a label (“*”) and add the text of the attribute node as the body of the list item. Then drop down one level to the child attribute nodes (./attribute-node) and call the same template. Keep going until there are no more levels to work through.

You can probably see from the very simple walk-through there are some key things to take away:

  1. A template that is inline is just a chunk of layout defined with a name in your file. There are other types of template in Analytics Publisher that get stored in other files, but that is beyond the scope of this.
  2. This template uses XSL:FO as the means to work with the XML of the decision report.
  3. XSL:FO has many structural elements (“block”, “list-item” and so on)
  4. You use XPath-style navigation to get into the structure – “./attribute-node” to drop down a level for example.
  5. You can access attributes and values of tags (“@text” is just getting the text attribute of the attribute-node) :

Once you get that into perspective, you can see a way forward. Firstly though, let us get the Euro Symbol back. You just need to use a Font that actually has the symbol. There are several steps. Use the font in the document, obviously, and ensure that the font is installed on your computer. Assuming you have the correct licence to use the font, embed it in the document to ensure that it is available at runtime. The net result should be like the example shown below – the font is in the fonts folder of your project, and the font is shown as being available. You can optionally substitute another font if, for whatever reason, your chosen font is not available at runtime.

Decision Report Embedding Fonts

Albany WT is a good example because it includes the Euro Symbol. So our explanation at least gets back the correct symbol.

Decision Report with Euro Symbol

But what about the rest of the stuff we just talked about. Well, armed with this knowledge you could for example use one of the symbol fonts. Oracle themselves has produced a symbol font called (obviously) “oracle” which is used in several applications. It includes a host of useful icons. Assuming you a) have permission to use it and b) have it in TTF format, you can use it in your Form Template and in your runtime environment.

You can begin to customise the decision report, by manipulating the provided templates. For example, changing the simple decision report template to something like this:

<?for-each:xxxx/decision-report/attribute-node/attribute-node?><fo:inline font-size="14pt" font-family="oracle" font-weight="bold" color="red" space-before="3pt" space-after="3pt">  </fo:inline> <fo:inline font-size="14pt" font-family="Albany WT" font-weight="bold" color="black" space-before="3pt" space-after="3pt"><?@text?></fo:inline><?end for-each?>

Notice the font specified, and the fact that there is a rectangle in the middle. That’s a character I pulled from Word, using Insert > Symbol – using a specific font – and then I pasted it into my example. In the example, I get this for the simple output:

And you can move to the complex version and add your icons, and perhaps for debugging purposes you decide to navigate the XML of the decision report and display other tags and other attributes (just for fun in this case).

Decision Report with new Font and Colors

In the above example, you might have a template that looks like this:

<fo:list-block start-indent="{count(ancestor::attribute-node) * 7}mm">
<fo:block font-size="14pt" font-family="oracle" font-weight="bold" color="green" space-before="1pt" space-after="1pt"></fo:block>
<fo:block>Instance Id :<xsl:value-of select="@instance-id"/> - <xsl:value-of select="@text"/> (<xsl:value-of select="./value/@state"/>)</fo:block>
<?for-each@inlines:./attribute-node?><?call-template:decision-report?><?end for-each?>
<?end if?>
<?end template?>

There is a lot more that can be done. The goal here is not to be spending too much time becoming Analytics Publisher experts – goodness knows there are so many out there – but rather to understand that it is possible. This is all about knowing who to talk to and how to frame the discussion with a reasonable chance of a good outcome!

The Zip Archive of this example is available in the Online Store. It’s free.

Author: Richard Napier

After 8 years in case management and ERP software roles, Richard Napier joined Siebel Systems in 1999 and took up the role of managing the nascent Siebel University in Southern Europe. He subsequently was Director of Business Development and Education for InFact Group (now part of Business & Decisions) for 8 years. He now runs Intelligent Advisor IT Consulting OÜ. Owner of, he also is Co-Founder of the Siebel Hub.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Intelligent Advisor IT Consulting Serving Customers Worldwide
Hide picture