Professional Documents
Culture Documents
Guideline
Upgrading JavaScript
Applications from I BM Cognos
ReportNet version 1.x and I BM
Cognos 8 BI versions 8.1, 8.2
to I BM Cognos BI versions 8.3,
8.4
Revision 9, 27 October 2008
Product(s): IBM Cognos 8 BI versions 8.3,8.4
Area of Interest: Upgrade/ Migration
Upgrading JavaScript Applications from I BM Cognos ReportNet 2
version 1.x and I BM Cognos 8 BI versions 8.1, 8.2 to I BM
Cognos BI versions 8.3, 8.4
Copyright
These Diagnostics and Troubleshooting Tools ("Software Tools") have been developed to
assist you in diagnosing and troubleshooting issues you may be experiencing with your use of
IBM Cognos Software.
This document is maintained by the Best Practices, Product and Technology team.
You can send comments, suggestions, and additions to cscogpp@ca.ibm.com.
Revision History
15 June 2008 Initial Release
02 July 2008 Section 2 has been renumbered. Section 2.2 CheckData has been
extended. New sections 2.5 and 2.6 have been added.
10 July 2008 New section 2.8 onLoad and onBeforeLoad Events added. Section
2.2 checkData ( ) Function Replaced has been corrected
17 July 2008 Minor edits and corrections. No material changes.
18 July 2008 Added knowledge base article references, defect numbers and new
issues encountered and resolved. New sections 2.9 through to
2.13, and section 4.
24 July 2008 Added section 2.14
5 August 2008 Added sections 3.7 and 3.8
18 August Added section 3.9 (Rev 8)
2008
17 September Modified sections 2.2, 2.3 and 2.14 (Rev 8)
2008
22 September Fixed typo in 2.13 heading – first change for (Rev 9)
2008
23 September Added section 2.15 (Rev 9)
2008
Contents
1 ................................................................................................ I NTRODUCTI ON .. 5
1.1 ..................................................................... WHY DO THESE UPGRADE I SSUES EXIST?... 5
1.2 ............................................................................................................. PURPOSE ... 5
1.3 ....................................................................................................... APPLICABILITY ... 6
2 ................................................................................................ KNOWN I SSUES .. 7
2.1 ......................................................................... AUTOSUBMIT( ) FUNCTION REPLACED ... 7
2.2 .......................................................................... CHECKDATA ( ) FUNCTION REPLACED ... 7
2.3 ................................................. REFERENCE TO THE FORMWARPREQUEST HAVE CHANGED ... 8
2.4 ........................................... CHECKBOXLIST* .UPDATESELECTED( ) NO LONGER REQUIRED ... 8
2.5 ....................................................... REMOVEATTRIBUTE(“ HASLABEL”) FUNCTION ADDED ... 9
2.6 ....................................................................... PROMPT OBJECT NAMING CONVENTION ... 9
2.7 .......................................................................................ATTACHEVENT() FUNCTION ... 9
2.8 ........................................................................ ONLOAD AND ONBEFORELOAD EVENTS. 10
2.9 ................................................................. CANSUBMITPROMPT ( ) FUNCTION ADDED . 10
2.10 ........................................THE REFERENCE TO LISTBOX SELECTALL HAVE CHANGED . 10
2.11 ................................................................... RUNREPORT () FUNCTION HAS CHANGED. . 10
2.12 .................... TO DE-SELECT AN OPTIONAL DATE PROMPT CHECKBOX REQUIRES A FIREEVENT. . 11
2.13 ............................................................. ONLOAD PAGE EVENT IS NOT ALWAYS CALLED. . 11
2.14 ......................................................... PAGENAVIGATIONOBSERVERARRAY NEEDS PREFIX . 11
2.15 . CHANGE IN HOW TO DETERMINE THE NAME OF A VALUE PROMPT AND CHECK IF IT IS REQUIRED . 12
3 ................................................................................................................... TI PS 13
3.1 ................................................................................................. LEARN JAVASCRIPT . 13
3.2 ..................................................................... JAVASCRIPT APPLICATION MAINTENANCE . 13
3.3 ................................................................................ COMMON JAVASCRIPT MODULES . 13
3.4 ................................................................................................ REPORT TEMPLATES. 13
3.5 ............................................................................. USE STANDARD PROMPT BUTTONS . 13
3.6 ..................................................................... DYNAMIC REPORTSPEC UPDATER (DRU) . 13
3.7 ............................................................................ PROBLEMS USING WINDOW EVENTS . 14
3.8 ....................................................................................................... OBFUSCATION . 14
3.9 ................................................................................................. DOCUMENT.WRITE . 14
4 .............................................................................................. KNOWN DEFECTS 15
4.1599023 – UNABLE TO GRAB THE TREE PROMPT CONTROL USING JAVASCRIPT IN IBM COGNOS 8 BI VERSION 8.3 1
1 I ntroduction
Various people have created JavaScript applications which interact with
undocumented and unsupported application programming interfaces (API)
and objects in the IBM® Cognos® Viewer such as prompt controls, buttons,
and functions. Despite the undocumented and unsupported nature of these
Sun® Microsystems® JavaScript ® (JavaScript) applications and APIs, we
understand that there is business value our customers are deriving from
these applications and we are committed to assisting in the upgrade process
to the extent of providing high level guidance.
These people have reverse engineered the IBM Cognos Viewer source code
and built JavaScript applications that are dependant on that source code. As
these JavaScript applications have been developed without the knowledge of
IBM Cognos development, we are unable to anticipate the full extent of the
changes required to upgrade a given JavaScript application. Therefore, this is
intended to be a living document in which we will add additional information
as it becomes available.
Now that we are aware of these issues, we have tried to ensure that known
areas are not changed between IBM Cognos 8 BI version 8.3 and IBM Cognos
8 BI version 8.4. But as we have no definitive list of issues we are unable to
either document all of them in IBM Cognos 8 BI versions 8.3 or 8.4 nor to
guarantee 100% compatibility between IBM Cognos 8 BI version 8.3 and IBM
Cognos 8 BI version 8.4.
1.2 Purpose
This document provides advice and guidance on for upgrading JavaScript
applications which run in the IBM Cognos Viewer from IBM Cognos ReportNet
version 1.x or IBM Cognos 8 BI version 8.1 or 8.2 BI to IBM Cognos 8 BI
version 8.3 or 8.4.
1.3 Applicability
This document applies equally to IBM Cognos 8 BI version 8.3 BI and IBM
Cognos 8 BI version 8.4.
2 Know n I ssues
Issues with JavaScript applications tend to fall into two areas:
The JavaScript application must be modified to use a different object or API.
This document discusses known areas and strategies for correction.
The changes in IBM Cognos Viewer are such that a JavaScript application
cannot be modified to work.
IBM Cognos 8 BI version 8.3 Service Pack 1 has resolved all issues of this
nature that we are aware of. Therefore, we recommend that this release (or
later) be used.
This section documents specific items that we are aware of. If you come
across issues not covered in this section, please open a call with customer
support.
Many samples have been updated in our Support Knowledge Base. Follow
the below link and search by number to find the most recent document
revision: General Search for IBM Cognos resources.
A bulk search/ replace utility such as DRU may be useful to deal with this
issue.
Note that any use of checkData currently working in IBM Cognos 8 BI version
8.3+ should remain in the product for the foreseeable future. It is not
available on some objects (such as text items) where it was available in past
releases.
Note: IBM Cognos 8 BI version 8.3 SP1 and IBM Cognos 8 BI version 8.4 both
have the refererence to formWarpRequest reinstated to facilitate upgrades
but getFormWarpRequest() is the preferred mechanism.
All other prompt objects need to be accessed using another technique, such
as using a named span tag (< span> ) around the prompt object and
accessing the span tag via the getElementById() function and the prompt
object items using the getElementsByTagName() function.
These changes cannot be handled by the DRU application. The changes will
depend on what was originally accomplished by the script.
With this
frm._oLstChoicesXXXX.onChange = doSomething;
By default < Namespace> is _NS_ (this is the case when the report is run
from the IBM Cognos Connection)
< Namespace> is RS if the report is run from the IBM Cognos Report Studio.
A dynamically generated namespace is used when running within a portlet.
fW._oLstChoicesMyFieldName.selectedIndex = 0;
var preFix = "";
if (fW.elements[ "cv.id"] )
{
preFix = fW.elements[ "cv.id"] .value;
}
setTimeout('oCV' + preFix + '.promptAction(\ 'finish\ ')', 100);
You can use the global objects listBox* to figure out the name rather than
going through the < select> box.
3 Tips
3.1 Learn JavaScript
We find that many customers have used JavaScript applications without
understanding how they operate and therefore, how to fix issues as they
arise. It is recommended that appropriate JavaScript skills be provided to
support these applications.
DRU can be useful for any bulk search and replace operations. For example,
references to an obsolete JavaScript function might be replaceable with the
correct function name.
DRU is available from the IBM Cognos Customer Support site in the IBM
Cognos Diagnostic Tools section via the following link: IBM Cognos
Diagnostic Tools and Utilities
General advice: Stay away from using events, especially on the window
object. It not the best way to have your custom scripts run and usually it
makes them IE-specific.
As alternatives for a simple list report, place the HTML Item containing the
script you want to run every time the page is updated in the footer, and place
it after the table if you want it to run only on the last page.
3.8 Obfuscation
The variables/ functions starting with an underscore and then some random
letters are variables/ functions we have renamed when packaging our
JavaScript code to hide their true meaning. They are by design unstable and
subject to change with each product release. Therefore, these functions and
variables should never be used or referenced.
3.9 Document.Write
In the following example document.write is being used to insert standard HTML into a
number of reports:
document.write("<select name='returnList'>");
document.write("<option value='public'>Public Folder</option>");
document.write("<option value='New'>New Folder</option>");
document.write("<option value='Second' >Second Folder</option>");
document.write("<option value='Third' selected>Third Folder</option>");
document.write("</select>");
Alternative solutions:
1) Use a Layout Component Reference to an htmlItem (which has the desired
<select> as is) in Report Studio rather than using <htmlitem> to include a javascript
file that builds a <select> using document.write. The Layout Component Reference
can point to any existing report, including one used to hold common htmlItems re-
used in many reports.
2) Add a span with an ID in the same htmlItem as the JavaScript include to be used
as a container, then create the <select> using DOM or innerHTML.
4 Know n Defects
4.1 599023 – Unable to grab the tree prompt control using Javascript in
I BM Cognos 8 BI version 8.3
Fix available in hotsite 8.3.82.1066 which includes prompt toolkit 8.3.720
• Microsoft, Windows, Windows 2000, Windows NT, and the Windows logo are
trademarks of Microsoft Corporation in the United States, other countries, or
both.