Friday, December 7, 2012

OBIEE and Narrative - simple tile, in English

We covered the basics of Narrative here.

I was asked to create a tile, with value based color of the Number and description, some dynamic and some static.
I can do it easily in Table with some design in OBIEE, but it will have some limitation on the graphical representation. So I decided to do some very basic HTML in Narrative.
So again I created an analysis with 3 columns and a filter on Product Type (is prompted):
  • Product Type.
  • Color name based on the Value of revenue.
  • Revenue. 
The next step was to add a Narrative. I my case I need only the Narrative section. Since I want to create a new table for each value.  I wanted to use HTML so I marked "Contains HTML Markup".
_________________________________________________________________________
Lets do some very very basic HTML examples, if you don't have the knowledge, you will find numerous guides in the net:
<br> means line break
<b> - start bold font, </b> - stop bold font
 <font ....> - give some definitions of the following font, for examle: size and color. </font> - end the block influenced by the font definition.
<center> - start centered alignment, </center> finish it.

<TABLE...> Start a table definition with parameters
    border - Border size (0 or means none)
    bgcolor - the background color
    background - the background image you can see the codes in OBIEE color selector.

in Table <TR> is new row and <TD> a new table data cell.
</TR>, </TD>, </TABLE> ends the relevant objects.
_________________________________________________________________________

So I wanted a table with minimal border, I selected a random color:

<TABLE border=1 bgcolor=#0FFFF0>
I started the single row and cell in the table:
<TR> <TD>
I want the text centered and an empty line at the top:
<center><br>
I wanted the value of the Product Type (first column), then a new line:
@1 <br>
I wanted bigger font for Revenue value and to use the color I selected in column 2:
<font size="6" color=@2>@3</font> <br>

At the end I add some more text:
<b> US $ </b><br><br>
<font color=grey> Product Revenue<br>for a Cycle</font><br>

And I close it all:
 </center></TD></TR> </TABLE>

I can do the same with some background image, this time without the border:
 <TABLE background="http://www.angelfire.com/fl5/html-tutorial/a/raindrop.jpg" >
<TR> <TD><center>
<br>
@1 <br>
<font size="6" color=@2>@3</font> <br>
<b> US $ </b><br><br>
<font color=grey>Product Revenue<br>for a Cycle</font></center><br></TD></TR> </TABLE>



I will just add a line break as a Row Separator.


Just add a basic prompt and the result is:


If you need more control over the size of each cell you can use the height and width parameters of TD, for example <TD  height="200"  width="200">. Just remember that if the size of the frame is too small, the parameters will be disregarded. 


What can I do if I want them side by side? This time it is one big table so I will have to use the prefix and postfix of the Narrative (and my son wanted a Super Mario Background image):

Prefix:
<TABLE border 1  background="http://wallpaperhost.org/wp-content/gallery/10_wallpaper_hd_02/super-mario-hd-wallpaper.jpg" >
<TR>


Narrative:
 <TD><center>
<br>
@1 <br>
<font size="6" color=@2>@3</font> <br>
<b> US $ </b><br><br>
<font color=grey>Product Revenue<br>for a Cycle</font></center><br></TD>

Postfix:
</TR> </TABLE>




The HTML doesn't work?
The most common problem is to leave the numbers with a thousand seperator (this is good: 999999, this is bad: 999,999).
Turn of HTML in Narrative and see if this is the case.


You can read about Tiles with Pivot tables instead of Narrative here.

1 comment: