top of page

RS Hyperlinks and HTML URLs

ABSTRACT (by Federico Levis ) Category: RS

RS Tip: Hyperlinks & HTML objects to open GoogleMap or to send pre-formatted Email clicking the Cells of a RS List

Examples of the various Features, with the required Code

1) Hyperlink opening in the same Window the Google Map of selected City:

Clicking Kabul we generate the URL https://www.google.com/maps/place/Kabul that will Open in the same Window (instead of the Cognos Report) following Google Map window:

Implementation Code:

  • Insert in the List a Colum with following Hyperlink object:

2) HTML Item opening in a NEW Window the Google Map of selected Country:

Implementation Code

Now we want to open the URL in a NEW WINDOW; therefore we have to use an HTML Item instead of the Hyperlink of Point 1:

  • Insert in the List a Colum with following HTML Item object:

With following Report Expression:

'<a class="hy" href="https://www.google.com/maps/place/' + [QryTable].[Country] + '" target="_blank">' + [QryTable].[Country] +'</a> '

(NOTE: class="hy" allows to have the standard Cognos hyperlink look, like color)

3) Hyperlink URL to send Pre-formatted EMAIL with fields related to the selected List Row (NOTE: some fields are not visible, like Address, Postal Code)

When we click VERA.MCCOY@sakilacustomer.org Cell, we generate following URL

mailto:VERA.MCCOY@sakilacustomer.org&subject=......

that will prepare following EMAIL pre-formatted with the fields of the selected List Row:

Implementation Code:

  • Insert in the List a Colum with following Hyperlink object:

Follow the complete value to set for Report Expression properties:

'mailto://' + [QryTable].[Email] + '&subject=A Special Offer for ' + [QryTable].[First Name] + ' ' + [QryTable].[Last Name] + '&body=Mr/Miss ' + [QryTable].[First Name] + ' ' + [QryTable].[Last Name] + ' %0D%0A%0D%0A' + [QryTable].[Address] + ' %0D%0A%0D%0A' + [QryTable].[Postal Code] + ' ' + [QryTable].[City] + ' - ' + [QryTable].[Country] + ' %0D%0A%0D%0A %0D%0A%0D%0A' + 'There is a Very Interesting Offer for you: ' + ' %0D%0A%0D%0A' + 'Please visit http%3A%2F%2Ffedericolevis.wix.com%2Fcognos ' + ' %0D%0A%0D%0A %0D%0A%0D%0A' + 'Best regards'

  • In The List set the Properties attribute selecting the used Query Column that are not Visible in the List (e.g [QryTable].[Address], [QryTable].[Postal Code]). We can simply select all the columns, to allow referencing them:

NOTE

Follow the Layout of the List, containing the described objects and also the HTML span used for the List Cell Tooltips (as described in Tooltip in TS Post) :

bottom of page