August 14, 2008

Hyperlink on Oracle Answers or Interactive Dashboard values

This is both an example on how to add custom hyperlinks to Oracle BI dashboards' values and on the importance that context information from the Web has for BI systems.

So let's get to it: create a new Answers request and include the columns you desire. Go to the Criteria tab and, for the column on which you want to create the hyperlink, click on the "Column Properties" button. Click the "Data Format", enable "Override Default Data Format" and on "Treat Text As" choose "Custom Text Format".

On the text box below, you'll have to enter the expression to create the link - the syntax isn't quite well documented, although this is where you usually insert ActionLinks to interact with Siebel. To create a standard hyperlink, the syntax is:
@[html]"<a href=\"http://codingassistance.blogspot.com \">"@"</a>"

Trying it out, it's easy to determine that the "@" (quotation marks are required) stands for the row value, so this hyperlink will be something like <a href="website.com">RowValue</a>.

If you want to kick it up a notch, you can pass the row value itself as an argument for the URL; for example, the expression
@[html]"<a href=\"http://maps.google.com?q="@"\" \" target="_blank">"@"</a>"
passes the row value to (the q parameter of) maps.google.com and opens a new window pointing to the map of the row value. On a dashboard, the row values are hyperlinks to, for example, "http://maps.google.com/?q=SANTA%20CRUZ%20DAS%20FLORES" where "SANTA%20CRUZ%20DAS%20FLORES" is one of the row values. In this particular case, the row value is a geographical location, hence the choice of Google Maps.

We can embelish it a bit by adding a title to the anchor, like this:
@[html]"<a href=\"http://maps.google.com?q="@"\" \" target="_blank" title=\"Click to view this location on a map\">"@"</a>"
(don't forget to escape your quotation marks!)

So, bringing it all together, we'll have a dashboard like this:



After clicking, a new window opens with a map for the location: