Extending Report Studio Reach
Date: 09/02/2017

By Seth Hickey

As more and more users are running reports and utilizing their company’s data, developers find themselves looking for new ways to enhance their reports when possible.  Business users and developers alike enjoy new, exciting features that help push reports from a static list/crosstab to a dynamic reporting tool that has the ability to go beyond Cognos, if necessary.  An easy way for developers to assist business users is through an insertable object in the Report Studio Toolbox, the HTML Item.

With HTML Items, developers have the freedom to insert text into a page and specify exactly how they will be rendered.  This becomes useful when developers upgrade ordinary items within a list or crosstab, for example, and are able to create hyperlinks that can take a user to another system within a company, open an internet search allowing them to explore a product, and more.  Here in this article we will take a take a look at this method of adding HTML Items to a report and allowing them to concatenate in order to create a dynamic hyperlinks that take the user to exciting new places … all from within their Cognos reports!

Perhaps within our example company, we have users that deal with a large variety of Product Brands that they do not always know.  In their day-to-day work, these users find themselves constantly having to investigate product brands by going to Google (or their favorite search engine) to search for products by name.  The business users are asking for a simple report that will serve as a one-stop dictionary to investigate these brands as they encounter them.   As a developer, we can create a simple report that will do exactly that while giving us flexibility to add in a bit of a ‘wow’ factor for the business users.  Note: For the purpose of this exercise, I’ll create a simple report using the GO Data Warehouse (Query) package.

Getting Started

Let’s begin by creating a simple list report with some product information.  I’ve added Product Type, Product Line, Product, and Product Brand into my list that is within a 2 X 1 table.  For ease of viewing, I’ve gone ahead and grouped Product Type as well as Product Line.

HTML links in Report Studio_simple list report.png

Running this simple report would return information looking like this:

HTML links in Report Studio_simple list output.png

With our basic report in place, we need to begin creating our hyperlink so that the product brand column is more dynamic.  By combining HTML Items in the column for Product Brand, we can create our Hyperlink that will take us directly to an external source – a google search in this case.   For starters, we need to unlock our report, select the “Toolbox” and locate the HTML Item, and then drag these items directly into our product brand column.

HTML links in Report Studio_hyperlinks.png

We will drag three HTML Items into the beginning of the column (before <Product brand>) and one final HTML Item at the end.  Your report will look like this:

HTML links in Report Studio_html items.png

Now that we have our HTML Items are in place, we need to select each HTML Item and edit them in order to create our hyperlink.  Our first HTML Item will need to be an <a> Tag in order for our hyperlink to start.  Go ahead and double click the first HTML Item and type:

<a href="http://www.google.com/#hl=en&source=hp&q=

HTML links in Report Studio_html edit hyperlink.png

Normally the “q=” portion of the previous URL is followed by a search word or phrase.  Since this will be a dynamic search, we will click OK and specify what the “q=” will now be targeting instead of typing in a value.   We can single click on our next HTML Item and we will be looking at the Properties Area and more specifically the Source Type.  We will need to select “Data Item Value” from the selection box for Source Type (notice how the row below changes from “HTML” to “Data Item Value” once clicked).  Since we are hoping to search on Product Brand, we will then click “Product Brand” from the Data Item Value selection box.

HTML links in Report Studio_data item value.png

Our third HTML Item is simple – we will be closing the quotation marks from the first HTML Item’s search (http://www....):

HTML links in Report Studio_close quotation.png

The actual data item itself for Product Brand we will not touch and can leave alone.  The <Product brand> data item will serve as the text for the hyperlink we are creating – no one would want to see a long URL!

The final HTML tag can be treated much like the third – we will be closing off our initial <a> tag

HTML links in Report Studio_final html tag.png

Once we’ve edited these HTML items, we can re-run the report and take a look at our new output:

HTML links in Report Studio_new output.png

We can now see that our Product Brand column has added hyperlinks to each Product Brand in each row.  If we click on the first row, Antoni, we will be taken to a google search:

HTML links in Report Studio_google search.png

One issue we will immediately notice is that when we click on a hyperlink within our report, we are taken to the google search from within our same window.  This is slightly cumbersome and annoying when trying to actually do a significant amount of searches, so we will need to make this more user friendly.  We need to go back into our report and edit our third HTML item.  Whereas before this item simply closed a quotation and ended our href=, we will now specify where to open our newly linked item. By double clicking our HTML Item and adding target=”_blank” we are pushing this Google search to a new window/pane.

HTML links in Report Studio_target_blank.png

Now when we click our first row, we will see that a new window is opened to accommodate the search.  We do not have to worry about our users being confused or slowed by having to click back if they want to conduct multiple searches.

HTML links in Report Studio_multiple searches.png

To go a step further (depending on the website being used), the users could also use an Inline Frame (<iframe>) tag to create a window within the report that will launch the search as needed.  (Note that google will need Application Programming Interfaces (API) in order to work within iframes, so I will modify the search to demonstrate this feature using Bing - <a href="https://www.bing.com/search?#hl=en&source=hp&q= is now being used.)  This can be achieved by dragging a fresh HTML Item into our second pane in our table and typing in the following: <iframe name="ProductbrandSearch" width=750 height=750 frameborder=0> </iframe>.

HTML links in Report Studio_product brand search.png

What this has allowed us to do is define an area within our report page (width, height, and also a frameborder specification) in order to house the search.  Since we are hoping to change the destination of our search from “target=_blank”, we need to go back and edit our third HTML Item as well.  The updated HTML item will replace the “_blank” with the name we assigned to our search container – “ProductbrandSearch”:

HTML links in Report Studio_target product brand search.png

Now that our search has a new destination, let's run it and see how things look:

HTML links in Report Studio_search and display.png

Now you will see that our designated space is running our search and displaying our Product brand selection.  Each new click will keep the user on the same page while allowing them to browse freely in the iframe space.  Again it is worth mentioning that depending on the website/search engine the functionality here could be limited.

At this point we’ve covered the basics in regards to adding HTML Items to your report which allow users to easily search with a hyperlinked data item.  The scenario I have presented is obviously very basic but the premise of making our own hyperlinks to take users from one report to another location by passing information is very powerful.  The potential that comes with this dynamic hyperlinking opens new pathways between systems which users might not have been able to access, prior.  These shortcuts help users become more efficient and more productive by leveraging HTML items. 

Application

Just as we sent our Product Brand information to a search engine, we could have passed an Invoice Number from Cognos to another reporting solution (perhaps an external, accounting reporting tool) in order to generate a new report by simply clicking on the invoice number within Cognos, originally. If a company manufactures and sells auto parts, for example, you could hyperlink a product number column to send the product number directly to a relevant retailer website in order to quickly access pricing information and competitors. Another example could be sending geographic data to in order to show specific locations on a map (zip code, for example). 

Conclusion

Hopefully all of these possible examples demonstrate how easy it can be to link Cognos reports to take your users to new and exciting places. For more information on how to implement hyperlinked items into your reports and report development in general, contact us at:


Australia Singapore, Philippines, Thailand     United States
Cornerstone PMsquare | A Cornerstone Group Company     PMsquare

Call +61 1300 840 048 or
email Piers Wilson
Call +65 6635 1700 or
email Carsten Brandt
    Call +1 (630) 607 0570 or
    email Chris Loechel


Blog post shared courtesy of PMsquare US