How is your Javascript breaking on an upgrade?

Here’s a question I posed for discussion on COGNOISE:

Since I’m so new to Cognos, I haven’t experienced an upgrade where everything breaks because IBM decides to change how they render prompts or something.

As a matter of fact, I have no way of knowing if any of the jQuery stuff I’ve been writing will translate to 10, because frankly, we use none of it at my job. I think I have a pretty solid strategy, though.

If I had to guess, I think that the problem is with Javascript breaking because of code like warping – the ID or class is changed, then everything breaks. I’ve countered this by wrapping pretty much all of the elements I’d like to manipulate in HTML items and giving it a div with an ID. I’m pretty sure that isn’t going to change through an upgrade, as I’m writing static code, not the rendering engine.

I’m also selecting by element and position, which may create a problem. Unlike Javascript without a framework, because most of the operations are one line only in jQuery, finding and resolving issues should be easy even in my absence. For example:

[code]jQuery("#YOURIDHERE option:first").remove();[/code]

This code for removing an option is one line and pretty much self-explanatory. Go to the ID, and find the first option in that prompt. It’s hard to see a scenario where this would change drastically during an upgrade.

So that’s what I’m asking! There’s a sense of fear when it comes to using JS with Cognos – it would be naive to say it’s not a problem, but I think maybe developers are overcomplicating the JS and introducing developer tie-in with their code. What are you seeing?

Join the Conversation


  1. Two thoughts:
    1) putting in your own HTML elements (with an ID you pick) sounds less integrated than using Cognos’ own javascript functions and id’s, which is what leads some developers to not do it. I think you’re correct, though, that it’s more robust to future changes in Cognos.

    2) however, IBM is now (I think) a lot more aware of what report developers are doing than they were before. So, they may be more careful with changing id’s, function names, etc. when there’s not a great need.

    On balance, I think you’re right to not trust/use the Cognos-generated classes, id’s, or javascript functions.

  2. Ross,

    I think if some of the devs that feared Javascript (like I once did; I used to hate it) implemented a framework like jQuery/JQUI, not only does Cognos become more powerful, but there’s a lot less code. That means easier maintainability and less consultant “lock-in” as it were. Lots of good points to be made on the matter, though.

Leave a comment

Leave a Reply to Ross Hartshorn Cancel reply

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