Skip to content →

COGNOS/jQuery – The Basic Setup

There’s only one really good way to troubleshoot issues with custom Javascript and Cognos Viewer – get Firefox, then get Firebug, and get it immediately. In order to test the selectors that you are going to be using to manipulate data, it is much faster to find UID’s and other HTML attributes with Firebug. If you aren’t familiar with it, it will save you hours of headaches so get familiar with it as soon as possible.

Once you have installed it, use the Inspector to find out how COGNOS renders HTML, and some of the attributes it uses to uniquely identify elements. You’ll notice that rows of information get a UID, which you can use to create all sorts of custom charts and data through API’s like Google Charts.

After that, take a look at Ross Hartshorn’s blog B. Intelligence about how to get jQuery running in the viewer. Note that you cannot use $(). – it conflicts with IBM’s Javascript.

Once you have both installed, create a simple list or crosstab for yourself and render it to the viewer. Now we can start to have some fun.

Using the command line in Firebug, fire off some jQuery selectors to see what you get. Select a td element and see what its UID is, then type the following in console:

[sourcecode language=”javascript”]jQuery("td[uid=15]").val();[/sourcecode]

You’ll need to replace 15 with the UID of one of your rows, but you’ll see that you can actually transverse the table that COGNOS produces and manipulate some of the data.

Here’s an important one that I discovered – give it a shot in console.

[sourcecode language=”javascript”]promptAction(‘finish’); // This is the function that is called when Auto-Submit = yes, or a Reprompt button is pressed. This will be useful when you want to manually trigger a refresh of COGNOS data. [/sourcecode]

More coming!

Published in jQuery/Cognos

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *