Howto Include Custom Javascript in Cognos 8 by Default

Do you often need to manipulate controls in prompt pages in cognos? Well if you do there is one major point to take in consideration – cognos intrinsic control names. To access any of the cognos prompt controls via javascript you will need to supply the cognos intrinsic control name plus the given name in order to identify the control.

Now imagine its two years down the line and your busy upgrading to a new version of cognos. You run a report and bam, javascript errors abound on your custom prompt page. No worries you fire up firefox/firebug and low and behold cognos have decided to rename their intrinsic controls. You start sweating trying to calculate how may hours its gonna take to go through two years worth of reports to update your javascript.

Well here’s a very easy solution to abstract away this dependency. Follow these steps (Cognos 8+ & Windows, requires admin access on cognos server(s) and a system bounce):

1. Navigate to <congos-install-dir>\webcontent

2. Create a new folder, I will use etc for the this example

3. Create a js file in your newly created dir, mine is <congos-install-dir>\webcontent\etc\etc.js

4. Add some javascript to hold the cognos control names e.g.
var Cognos = {
Dropdown: '_oLstChoices',
Textbox: '_textEditBox'

5. Now open the file <congos-install-dir>\templates\ps\prompting\p_include.xsl

6. Search for the text
<xsl:if test="//promptButton or //defaultPromptFooter or //selectValue or //textBox or //selectDate or //selectWithSearch or //selectWithTree or //selectTime or //selectInterval or //selectDateTime or //selectDataSourceSignon">

7. Add a script element below this to include the js file – mine is

<script language="javascript" src="../etc/etc.js" type="text/JavaScript">//leave this comment here to assure we have an explicit end tag for script</script>

8. Save and close, bounce cognos

Now all cognos prompt pages will include this js file, so if cognos one day decides to rename their controls you can modify the names in the js file and your set. Obviously you can take this one step further and create a library providing macros for routine prompt screen javascript stuff.

technorati tags:,

Blogged with Flock

37 thoughts on “Howto Include Custom Javascript in Cognos 8 by Default

  1. Hi Angus,

    do you know a way to do a enable/disable for 2 date range prompts used in a prompt page of cognos 8.3?

    I am unable to enable/diable either of the prompts based on selection of either of the 2 date range prompts.

    any help would be appreciated.


  2. After going over a handful of the blog articles on your web site, I
    seriously like your technique of blogging. I bookmarked
    it to my bookmark webpage list and will be checking back soon.
    Take a look at my website as well and let me know what
    you think.

  3. I’ve been exploring for a little for any high-quality articles or weblog posts on this sort of space
    . Exploring in Yahoo I at last stumbled upon this website.
    Reading this information So i’m glad to show that I’ve a
    very good uncanny feeling I came upon just what I
    needed. I most no doubt will make sure to do not put out
    of your mind this site and give it a glance on a relentless basis.

  4. In the ase of really expensive, Hawaii does not laughihg
    matter. But ttruth to tell if I simply had thhe funds then I’m pretty sure I would be canoing in Waikiki
    oor maybe chilling at Sunset. It sure beats shoveling a
    foot a snow forr what seems like every other day.

  5. That’s why plenty of people have nno wsh to know if hiss /
    her’s spouse is actually two timing them. It frightens tthem that this is an emotional atomic bomb with no chance of recovery.
    A bunch of us don’t wish to be placed in that situation.
    If you found out do you think that you ccan deal with it?

  6. Have you ever considered about adding a little bit more than just your articles?
    I mean, what you say is valuable and everything. However think of if you added some great visuals or video clips to give your posts more,
    “pop”! Your content is excellent but with images and clips, this website could definitely
    be one of the most beneficial in its niche. Fantastic blog!

  7. This is precisely wwhy many folks don’t wih to know whether his or her’s significant
    other is cheating. It frightens them that this iss an emotional trainwreck with no chance
    to recover. Many folks don’t want to bee put in that position.
    In case you found out do you recckon you ccan handle it?

  8. Thiss is whyy a lot of folks do not want to know if
    his / her’s significant other is really unfaithful.

    It frightens them that tjis is an emotional atomic bomb with no
    chance oof recovery. Some of us don’t want tto bbe put in this predicament.

    If you discovered it do you reckon that you can handle it?

  9. This is why countless people don’t choose to knpw whether their spouse is two timing them.
    It scares him or her that this mzybe something they never get
    over. Lots of us don’t want to be placed in that position.
    In the event you discovered it you think you can handle it?

  10. Try to keep a record of the merits and minuses of the different kinds of binoculars you
    are interested in. There are numerous great field glasses to choose from but let’s be honest there is absolutely no perfect pair.

  11. This is precisely why lots of people don’t reallyy want to know if his or her’s significant other is really unfaithful.
    It frightens him or her that this maybe something they never get
    over. A lot of people do not wish to be put in that situation. In the event you
    found out do you reckon that you can deal with it?

  12. That is generally why lots of people don’t want to know
    if their mate is really unfaithful. It frightens them that not only is this
    ann emotional tran wreck but a train wreck they might not be able to recover from.
    Lots of people do not want to be pput in this position. In case you discovered it do you
    thin you can deal with it?

  13. Keep a checklist regarding the benefits and drawbacks regarding
    the different types of field glasses you may be sincerely interested in. There are several outstanding binoculars available
    to you but truth be told there is absolutely no perfect pair.

  14. That is realply fascinating, Ƴou’re an ovewrly skilled blogger.
    I havе joined your feed and look forward to in quest of more of your grdeat pօst.
    Aԁditionally, I have shared yohr web site in my social networks

  15. I’m not sure where you are getting your info, but good topic.
    I needs to spend some time learning more or understanding
    more. Thanks for great info I was looking for this information for my mission.

  16. Fantastic goods from you, man. I’ve understand your stuff previous to and you’re just too fantastic.

    I really like what you have acquired here, certainly
    like what you’re stating and the way in which you say it.

    You make it entertaininng and you still take care of to keep it smart.
    I can’t wait to read much more from you. This is actually a terrific site.

  17. I loved as much as you’ll receive carried out right here.

    The sketch is tasteful, your authored material stylish. nonetheless,
    you command get got an impatience over that you wish be delivering the following.

    unwell unquestionably come more formerly again since exactly the same nearly a
    lot often inside case you shield this increase.

  18. Are you looking for effective advertising that actually gets good results? Sorry to bug you on your contact form but actually that’s exactly where I wanted to make my point. We can send your promotional message to websites via their contact pages just like you’re getting this message right now. You can specify targets by keyword or just do bulk blasts to sites in the country of your choice. So let’s assume you would like to push through a message to all the contractors in the US, we’ll scrape websites for just those and post your advertisement to them. Providing you’re promoting something that’s relevant to that business category then you’ll receive awesome results!

    Shoot me a reply to for the details

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s