Beruflich Dokumente
Kultur Dokumente
Upgrading JavaScript
Applications from Cognos
ReportNet 1.x and Cognos
8.1/8.2 BI to Cognos 8.3/8.4
BI
Revision 10, 11 March 2010
Copyright
Copyright © 2008 Cognos ULC (formerly Cognos Incorporated). Cognos ULC
is an IBM Company. While every attempt has been made to ensure that the
information in this document is accurate and complete, some typographical
errors or technical inaccuracies may exist. Cognos does not accept
responsibility for any kind of loss resulting from the use of information
contained in this document. This document shows the publication date. The
information contained in this document is subject to change without notice.
Any improvements or changes to the information contained in this document
will be documented in subsequent editions. This document contains
proprietary information of Cognos. All rights are reserved. No part of this
document may be copied, photocopied, reproduced, stored in a retrieval
system, transmitted in any form or by any means, or translated into another
language without the prior written consent of Cognos. Cognos and the
Cognos logo are trademarks of Cognos ULC (formerly Cognos Incorporated)
in the United States and/or other countries. IBM and the IBM logo are
trademarks of International Business Machines Corporation in the United
States, or other countries, or both. All other names are trademarks or
registered trademarks of their respective companies. Information about
Cognos products can be found at www.cognos.com
This document is maintained by the Best Practices, Product and Technology
team. You can send comments, suggestions, and additions to
cscogpp@ca.ibm.com.
Proprietary Information
Upgrading JavaScript Applications from Cognos ReportNet 1.x 3
and Cognos 8.1/8.2 BI to Cognos 8.3/8.4 BI
Revision History
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
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.
Proprietary Information
Upgrading JavaScript Applications from Cognos ReportNet 1.x 4
and Cognos 8.1/8.2 BI to Cognos 8.3/8.4 BI
Proprietary Information
Upgrading JavaScript Applications from Cognos ReportNet 1.x 5
and Cognos 8.1/8.2 BI to Cognos 8.3/8.4 BI
Contents
1INTRODUCTION............................................................................................5
1.1WHY DO THESE UPGRADE ISSUES EXIST?.........................................................................5
1.2PURPOSE..............................................................................................................5
1.3APPLICABILITY........................................................................................................5
2KNOWN ISSUES............................................................................................6
2.1AUTOSUBMIT( ) FUNCTION REPLACED..............................................................................6
2.2CHECKDATA ( ) FUNCTION REPLACED..............................................................................6
2.3REFERENCE TO THE FORMWARPREQUEST HAVE CHANGED......................................................... 7
2.4CHECKBOXLIST*.UPDATESELECTED( ) NO LONGER REQUIRED...................................................7
2.5REMOVEATTRIBUTE(“HASLABEL”) FUNCTION ADDED.............................................................. 8
2.6PROMPT OBJECT NAMING CONVENTION............................................................................8
2.7ATTACHEVENT() FUNCTION..........................................................................................8
2.8ONLOAD AND ONBEFORELOAD EVENTS.............................................................................9
2.9CANSUBMITPROMPT ( ) FUNCTION ADDED.........................................................................9
2.10THE REFERENCE TO LISTBOX SELECTALL HAVE CHANGED........................................................ 9
2.11RUNREPORT () FUNCTION HAS CHANGED.........................................................................9
2.12TO DE-SELECT AN OPTIONAL DATE PROMPT CHECKBOX REQUIRES A FIREEVENT................................10
2.13ONLOAD PAGE EVENT IS NOT ALWAYS CALLED.................................................................. 10
2.14PAGENAVIGATIONOBSERVERARRAY NEEDS PREFIX...............................................................10
2.15CHANGE IN HOW TO DETERMINE THE NAME OF A VALUE PROMPT AND CHECK IF IT IS REQUIRED............ 11
2.16OUTPUT FORMAT CANNOT BE CHANGED IN A RUNNING REPORT................................................ 11
3TIPS............................................................................................................12
3.1LEARN JAVASCRIPT................................................................................................12
3.2JAVASCRIPT APPLICATION MAINTENANCE.........................................................................12
3.3COMMON JAVASCRIPT MODULES..................................................................................12
3.4REPORT TEMPLATES................................................................................................12
3.5USE STANDARD PROMPT BUTTONS...............................................................................12
3.6DYNAMIC REPORTSPEC UPDATER (DRU).......................................................................12
3.7PROBLEMS USING WINDOW EVENTS...............................................................................13
3.8OBFUSCATION......................................................................................................13
3.9DOCUMENT.WRITE.................................................................................................13
3.10DIFFERENCES IN RERUN BETWEEN 8.3 AND 8.4..............................................................13
4KNOWN DEFECTS....................................................................................... 14
4.1599023 – UNABLE TO GRAB THE TREE PROMPT CONTROL USING JAVASCRIPT IN IBM COGNOS 8.3......14
1INTRODUCTION............................................................................................5
1.1WHY DO THESE UPGRADE ISSUES EXIST?.........................................................................5
1.2PURPOSE..............................................................................................................5
1.3APPLICABILITY........................................................................................................5
2KNOWN ISSUES............................................................................................6
2.1AUTOSUBMIT( ) FUNCTION REPLACED..............................................................................6
2.2CHECKDATA ( ) FUNCTION REPLACED..............................................................................6
2.3REFERENCE TO THE FORMWARPREQUEST HAVE CHANGED......................................................... 7
2.4CHECKBOXLIST*.UPDATESELECTED( ) NO LONGER REQUIRED...................................................7
2.5REMOVEATTRIBUTE(“HASLABEL”) FUNCTION ADDED.............................................................. 8
2.6PROMPT OBJECT NAMING CONVENTION............................................................................8
2.7ATTACHEVENT() FUNCTION..........................................................................................8
Proprietary Information
Upgrading JavaScript Applications from Cognos ReportNet 1.x 6
and Cognos 8.1/8.2 BI to Cognos 8.3/8.4 BI
Proprietary Information
Upgrading JavaScript Applications from Cognos ReportNet 1.x 7
and Cognos 8.1/8.2 BI to Cognos 8.3/8.4 BI
1 Introduction
These people have reverse engineered the 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
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 Cognos 8.3 and Cognos 8.4. But as we have
no definitive list of issues we are unable to either document all of them in
Cognos 8.3 or 8.4 nor to guarantee 100% compatibility between Cognos 8.3
and Cognos 8.4.
1.2 Purpose
This document provides advice and guidance on for upgrading JavaScript
applications which run in the Cognos Viewer from Cognos ReportNet 1.x or
Cognos 8.1 or 8.2 BI to Cognos 8.3 or 8.4.
1.3 Applicability
This document applies equally to Cognos 8.3 BI and Cognos 8.4 BI.
Proprietary Information
Upgrading JavaScript Applications from Cognos ReportNet 1.x 8
and Cognos 8.1/8.2 BI to Cognos 8.3/8.4 BI
2 Known Issues
A bulk search/replace utility such as DRU may be useful to deal with this
issue.
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 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.
Proprietary Information
Upgrading JavaScript Applications from Cognos ReportNet 1.x 9
and Cognos 8.1/8.2 BI to Cognos 8.3/8.4 BI
Note: Cognos 8.3 SP1 and Cognos 8.4 both have the refererence to
formWarpRequest reinstated to facilitate upgrades but getFormWarpRequest
() is the preferred mechanism.
Proprietary Information
Upgrading JavaScript Applications from Cognos ReportNet 1.x 1
and Cognos 8.1/8.2 BI to Cognos 8.3/8.4 BI 0
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
Proprietary Information
Upgrading JavaScript Applications from Cognos ReportNet 1.x 1
and Cognos 8.1/8.2 BI to Cognos 8.3/8.4 BI 1
frm._oLstChoicesXXXX.onChange = doSomething;
Proprietary Information
Upgrading JavaScript Applications from Cognos ReportNet 1.x 1
and Cognos 8.1/8.2 BI to Cognos 8.3/8.4 BI 2
By default <Namespace> is _NS_ (this is the case when the report is run
from the Cognos Connection)
<Namespace> is RS if the report is run from the 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;
}
Proprietary Information
Upgrading JavaScript Applications from Cognos ReportNet 1.x 1
and Cognos 8.1/8.2 BI to Cognos 8.3/8.4 BI 3
2.15 Change in how to determine the name of a value prompt and check if
it is required
Pre 8.3, you could use the name attribute of a <select> to find the
associated JavaScript object. There isn't such an explicit link in 8.3.
You can use the global objects listBox* to figure out the name rather than
going through the <select> box.
Proprietary Information
Upgrading JavaScript Applications from Cognos ReportNet 1.x 1
and Cognos 8.1/8.2 BI to Cognos 8.3/8.4 BI 4
3 Tips
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.
Proprietary Information
Upgrading JavaScript Applications from Cognos ReportNet 1.x 1
and Cognos 8.1/8.2 BI to Cognos 8.3/8.4 BI 5
DRU is available from the IBM Cognos Customer Support site in the Cognos
Diagnostic Tools section via the following link:
http://support.cognos.com/en/support/diagnostics/index.html
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 HTMLItem 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
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.
Proprietary Information
Upgrading JavaScript Applications from Cognos ReportNet 1.x 1
and Cognos 8.1/8.2 BI to Cognos 8.3/8.4 BI 6
http://www-01.ibm.com/support/docview.wss?rs=0&uid=swg21423922
4 Known Defects
4.1 599023 – Unable to grab the tree prompt control using Javascript in
IBM Cognos 8.3
Fix available in hotsite 8.3.82.1066 which includes prompt toolkit 8.3.720
Proprietary Information