June 2, 2010 by
How Do URLs Currently Work In Cognos
Within IBM Cognos, a URL object is a very easy way of linking to any external file or web site. Using URLs helps you keep the files and web sites you use most frequently at your fingertips. However, the default behavior of a Cognos URL object opens the file or web site in the current browser, causing the user to move off of the current Cognos page. After opening the URL, you will have to click on the Back button in the browser to return to Cognos portal.
Within IBM Cognos, a URL object is a very easy way of linking to any external file or web site. Using URLs helps you keep the files and web sites you use most frequently at your fingertips. However, the default behavior of a Cognos URL object opens the file or web site in the current browser, causing the user to move off of the current Cognos page. After opening the URL, you will have to click on the Back button in the browser to return to Cognos portal.
Can You Drive a URL Object to Behave Differently?
Is there a way to open the URL link in a new re-sizable web browser window, allowing you to easily toggle between Cognos and an external file or web site? Luckily, the answer is Yes! Let’s explore how this can be accomplished.Development Environment
- Cognos 8.4.1
- IE 6.0 or Fire Fox 3.0.5
Step by Step Demo Instructions
- Login to Cognos and create a folder where you would like the URL object to be saved. In this example I create a folder called “test” under Public Folders.
-
Open the “test” folder by clicking on the folder link then copy and save the URL.
http://localhost/cognos8/cgi-bin/cognos.cgi?b_action=xts.run&m=portal/cc.xts&m_folder=i9D92B2A95AEC44118A9C7FB767EAB95D
- In the upper right hand corner of the Cognos portal page, click on the new URL icon to launch the “Create a New URL” wizard.
-
When prompted, enter the following information:
- Name Prompt: Type “Open in new URL”.
- URL Prompt: Enter “http://localhost/cognos8/mywebsite.html” as the URL value.
- Location Prompt: Make sure the location is set to the” Public>test” folder.
-
Click the Finish button to create this new URL object. You should now be able to see it under the “test” folder.
-
Open a Notepad instance , copy and paste the following code:<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″>
<title>My Company Website</title>
<script type=”text/javascript”><!–
var windowWidth=(screen.width-200), windowHeight=(screen.height-200);
//target URL, replace this with your real target URL
var mycompanyURL=”http://www.ironsidegroup.com/”;
//folder URL,replace this with the real folder’s URL.
var testfolderURL=”http://localhost/cognos8/cgi-bin/cognos.cgi?b_action=xts.run&m=portal/cc.xts&m_folder=i9D92B2A95AEC44118A9C7FB767EAB95D”;
onload= function(){
var newwin = window.open(mycompanyURL, ‘mynewwindow’, ‘width=’+windowWidth+’, height=’+windowHeight+’, scrollbars=yes, resizable=yes’);
window.location.replace(testfolderURL);
}
//–></script>
</head>
</html>
- Update the values of variables “mycompanyURL” and “testfolderURL” to reflect your environment.
- Save it as “mywebsite.html” under the cognos root/webcontent folder.
- Go back to the Cognos Connection “test” folder
- Click on
- You will see a new smaller window pop up (you may need to disable popup blocker in your browser). In the case of our example, it is the Ironside homepage. It is scrollable and re-sizeable. You can now freely jump between Cognos Portal and another website.
Development Environment
- Cognos 8.4.1
- IE 6.0 or Fire Fox 3.0.5
Step by Step Demo Instructions
-
Login into Cognos and launch Report Studio, select “create a new List” report template and use the sample Go Sales (query) package.
- Drag and drop Product line, Revenue, Quantity query items from Sales (Query) namespace to create a simple list report.
-
From the Insertable Objects tab, drag a HTML item before the list created in prior step. Type the following code as HTML item source text:<a href=”javascript: void(0)” onclick=”window.open(‘http://www.ironsidegroup.com’, ‘mynewwin’, ‘width=450, height=377, resizable=yes,left=100,top=100,screenX=50,screenY=50′); return false;”>My Company Web Site</a>
-
Save and run the report. You will notice that a hyperlink “My Company Web Site” is shown on report. Click on that hyperlink, a new small window is popped up. In our example the Ironside Group company web page is displayed in this new resizable window.
---------
WHICH ATTRIBUTIES OF HYPERLINKS CAN YOU CHANGE?
As you know, the IBM Cognos 8 suite is a collection of web based applications. The professional report you built from Report Studio is actually a web page when rendered in HTML format. Like any other ordinary web page, a report page is constructed of many HTML elements. For each HTML element, authors can use HTML language rules to specify its “appearance” and behaviors. The “appearance”, in formal HTML language, of each object is defined by its “Styles“. These styles define most of the common visual properties for each HTML element on a web page, such as font color, size, background and etc. Styles were introduced with HTML 4, and have become the accepted and preferred method to style HTML elements. With HTML styles, authors can add styles to HTML elements directly by using the style attribute (<style> tag), or indirectly in separate style sheets (CSS). Here we are going to look into how to use Cascading Style Sheets (CSS) to define the styles of a hyperlink in Report Studio.
There are four main selectors with respect to the CSS hyperlink style. You can specify any CSS supported style to each of these selectors. The four selectors are:
A:link – Defines the style for unvisited links.
A:visited – Defines the style for visited links.
A:active – Defines the style for selected links.
A:hover – Defines the style when the user mouse’s over a link.
Note: The hover selector is NOT supported by Netscape browsers prior to version 6.
You can read more information about CSS at
http://www.w3.org/TR/REC-html40/present/styles.html.
Tested Environment
- Cognos 8.4.1
- IE 6.0+ and Fire Fox 3.0.5+
Step by Step Demo Instructions
- Login into Cognos and launch Report Studio, select the “List” report template and use the sample Go Sales (query) package.
-
Create a simple list report as follows:
- Group the list report by the Year and Country columns.
- Enter “Product Sales by Year and Country” as the report title.
- Set the list size to 70% and the page body to be center aligned.
-
From the Insertable Object tab, drag a HTML item and drop it before the list. Double click on the newly created HTML item and type the following code:<style type=”text/css”>
.classA1 A:link {text-decoration: none; color: gray;font-weight:bold;}
.classA1 A:visited {text-decoration: none;color: #993366;}
.classA1 A:hover {text-decoration: underline; color: #777444;font-weight:bold;}
.classA1 A:active {text-decoration: none;color: #993366;}
</style>
<table style=”font-size: 8pt”>
<tr>
<td class=”classA1″>
<a href=”javascript: void(0)” onclick=”window.open(‘http://www.ironsidegroup.com’, ‘mynewwin’, ‘width=400, height=277, resizable=yes,left=100,top=100,screenX=50,screenY=50′); return false;”>My Company Web Site</a></td>
<td> |  </td>
<td class=”classA1″>
<a href=”javascript: void(0)” onclick=”window.open(‘http://www.ibm.com’, ‘mynewwinibm’, ‘width=400, height=277, resizable=yes,left=100,top=100,screenX=50,screenY=50′); return false;”>IBM Cognos Web Site</a>
</td>
<td> |  </td>
<td class=”classA1″>
<a href=”javascript: void(0)” onclick=”window.open(‘http://www.google.com’, ‘mynewwingl’, ‘width=400, height=277, resizable=yes,left=100,top=100,screenX=50,screenY=50′); return false;”>Business Glossary</a>
</td>
<td> |  </td>
</tr>
</table>
-
Save and Run this report. You will see three custom hyperlinks are created: My Company Web Site, IBM Cognos Web Site and Business Glossary. All three hyperlinks are displayed in a bold, gray color when the report page initially loads. If you click on the My Company Web Site link, it will open the Ironside Group Company home page in a new browser window. You should also notice that after the click, the My Company Web Site hyperlink changes its color to purple (#993366). If you mouse hover over any of the three links, for instance the IBM Cognos Web Site link, that hyperlink will dynamically change its color to greenish (#777444) and become underlined.
your Business intelligence blog spot is really awesome and nice good things have been enlightened here.
ReplyDeleteCognos Training in Chennai