Wednesday, February 25, 2009

OBIEE Executing your own JavaScript

Recently I was asked how to asked your own JavaScript from the OBIEE dashboard. I actually fairly simple.

Step 1: Add your script to Common.JS (this usually file is found in the {OracleBI}\web\app\res\b_mozillahere is an example:

// MY Stuff
function obi_popup()
{
    alert("Hello World")
}

image

Step 1b: If you are using OC4J sync the file with the one in {OracleBI}\oc4j_bi\j2ee\home\applications\analytics\analytics\res\b_mozilla

Step 2: restart the presentation server and you webserver.

Step 3: Add the execution code to your dashboard:

image

<input type="button" onclick="obi_popup()" value="Click Me!">

Don't forget to check the Contains HTML Markup!

Step 4: Save your dashboard page and test....

image

Till Next Time

17 comments:

Anonymous said...

Hi John,

We have a requirement where we have to navigate between reports using javascript and Go URL.
But our table and column names contain spaces, so its only navigating but not passing values to the other report.
Can you please help us out with this?

John Minkjan said...

Hi
Did you try replacing the spaces with %20 ?

regards

Anonymous said...

John,

Do you know if it is possible to update a filter on Dashboard report by clicking a value from another Dashboard report. If it's doable, I am guessing it would a matter of formatting a value in HTML that calls a custom JavaScript that would update a Presentation Variable "on-click" of the value selected. I can give you more background it the above description is a little fuzzy.

John Minkjan said...

@Anonymous,

Wouldn't that overcomplicated that? How about playing around with drillpaths?

Regards

John

Anonymous said...

hi,
is it possible to add survey forms in BIEE dashboards? we can use writeback as a workaround. but, we are trying to explore using html and javascript to create surveys for users to fill up. Since we couldn't create radio buttons or listbox using writeback, maybe we can use html and javascript instead. would that be possible? thanks

John Minkjan said...

@Anonymous,

Yes, but please use OBIEE for what it is intended. Most incompagny portal have far better capabillty for that.

regards

John

Siva said...

Hi John,

The "OBIEE Executing your own Javascript" post is a good one. I am looking whether is it possible to capture the logical sql of an OBIEE report.

John Minkjan said...

Why don't you add the SQL view to your report, hide it and add a script to read the idLogicalSqlCell

Regards

Siva said...

Hi John,

This is what I was exactly looking for. But I donot know how to call the idLogicalSqlCell with in the function. Also, I have noticed that we can hide the columns in the request but the not the View (i,e Logical Sql View) in the compound layout.

Please provide details how to use the idLogicalSqlCell function.

Thanks in Advance

Siva

John Minkjan said...

@Siva,

It's seems you already got your answer from Joe:
http://forums.oracle.com/forums/thread.jspa?messageID=4028795&#4028795

Regards

Josh said...

Where could I add a jquery script definition so that I could write jquery? Is this possible?

The reason I want to do this is because I have a requirement to change the colors of the tabs (it is not going to be fun at all since there is just the 2 different classes... it would just be much easier with jquery). Has anyone done this yet? Any tips?

Josh said...

Ok... so, I overlooked the fact that I could just drop in a jquery script definition right inside a Text section in an OBIEE dashboard. My main question is how feasible it is to have say 10 tabs, and color 3 blue, 3 red, 3 green, and 1 purple. I understand the tabs on the dashboard deal with images, so I am fine creating different shaded images, but it seems tricky since there is only 2 main classes: TabDimCell, TabHiCell (and the dang separators of course). Thanks in advance.

Guy_mu1 said...

John,

I am trying to add JS on the GO button of the prompt. I am not able to access the button. I actually want to add JS to make particular prompt mandatory.

sirish said...

Hi John,
I have a scenario where i have multiple column selectors on the report and the 'Go' button for them is going to the right hand side cornor .Now is it possilbe to stack these column selectors vertically using JS?


Regards
Raj

yogi said...

Hi john, here is my question,

i want show empty show empty dashboard initially. we have prompts in dashboard right. my requirment is when ever we click the go button it will show all the content in the report with out entering any prompt values.

can you please provide the solution for this. my client want this type of methde.

John Minkjan said...

@sirish,

Do google for the scripting of Joe Betram, he is a master on manipluating the screen with JS.

regards

Niamh said...

Hi - this is a great post, really useful. Thanks you..

I have a related problem and cannot find the answer. I want to call a session variable value from within a JavaScript function in the Common.js file. The reason for this, is I want the user to be redirected to another site, and the group session value to be passed but not visible in the html or button/link properties. (It will link to a php which will redirect based on the value in the URL).. I cannot get the javascript syntax right to take the 'nqsession.group' value. Is it possible?

Many thanks (anyone!)

Niamh, Dublin