If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

How to point a Report Studio Hyperlink object to open in a new window

Started by RubenvdLinden, 22 May 2009 09:29:17 AM

Previous topic - Next topic

RubenvdLinden

I have a report in Cognos 8 that uses a Report Studio Hyperlink to link to a report on our Impromptu WebReports server (Cognos 7, based on a report parameter). The hyperlink works great, but unfortunately it opens in the same browser window. Is there a way to open it in a new window? I tried to create an HTML Item, but couldn't get it to work.

globalbear

Is it a normal HTML link you are using? In that case this old HTML code would work:
<A href="http://www.google.com" target="New">My link</A>

Target="New" makes the link open in a new window.

RubenvdLinden

Thank you for your reply. I have problems creating an HTML link, so I couldn't get the TARGET parameter to work. Maybe I'm doing something wrong?

I put an HTML item before the label with an anchor tag (<a>) and I put an HTML item after the label with the closing anchor tag (</a>). That doesn't seem to work.

globalbear

Try this code:
works fine for me

<report xmlns="http://developer.cognos.com/schemas/report/3.0/" expressionLocale="en"><!--RS:8.2-->
   <modelPath>/content/package[@name='GO Sales']/model[@name='model']</modelPath>
   <queries>
      <query name="Query1">
         <source>
            <model/>
         </source>
         <selection><dataItem name="Data Item1"><expression>'Link to Google'</expression></dataItem></selection>
      </query>
   </queries>
   <layouts>
      <layout>
         <reportPages>
            <page class="pg" name="Page1">
               <pageBody class="pb">
                  <contents>
                     <list class="ls" refQuery="Query1">
                        
                        
                        
                        <style>
                           <CSS value="border-collapse:collapse"/>
                        </style>
                     <listColumns><listColumn><listColumnTitle class="lt"><contents><textItem><dataSource><dataItemLabel refDataItem="Data Item1"/></dataSource></textItem></contents></listColumnTitle><listColumnBody class="lm"><contents><HTMLItem>
                                       <dataSource>
                                          <staticValue>&lt;A href="[url="http://www.google.com/"TARGET="new"&gt;"]http://www.google.com/"TARGET="new"&gt;[/url]</staticValue>
                                       </dataSource>
                                    </HTMLItem>
                                    <textItem><dataSource><dataItemValue refDataItem="Data Item1"/></dataSource></textItem><HTMLItem>
                                       <dataSource>
                                          <staticValue>&lt;/A&gt;</staticValue>
                                       </dataSource>
                                    </HTMLItem>
                                 </contents></listColumnBody></listColumn></listColumns></list>
                  </contents>
               </pageBody>
               <pageHeader class="ph">
                  <contents>
                     <block class="ta">
                        <contents>
                           <textItem class="tt">
                              <dataSource>
                                 <staticValue/>
                              </dataSource>
                           </textItem>
                        </contents>
                     </block>
                  </contents>
                  <style>
                     <CSS value="padding-bottom:10px"/>
                  </style>
               </pageHeader>
               <pageFooter class="pf">
                  <contents>
                     <table class="tb">
                        <tableRows>
                           <tableRow>
                              <tableCells>
                                 <tableCell>
                                    <contents>
                                       <textItem>
                                          <dataSource>
                                             <reportExpression>AsOfDate()</reportExpression>
                                          </dataSource>
                                       </textItem>
                                    </contents>
                                    <style>
                                       <CSS value="vertical-align:top;text-align:left;width:25%"/>
                                    </style>
                                 </tableCell>
                                 <tableCell>
                                    <contents>
                                       <textItem>
                                          <dataSource>
                                             <staticValue>- </staticValue>
                                          </dataSource>
                                       </textItem>
                                       <textItem>
                                          <dataSource>
                                             <reportExpression>PageNumber()</reportExpression>
                                          </dataSource>
                                       </textItem>
                                       <textItem>
                                          <dataSource>
                                             <staticValue> -</staticValue>
                                          </dataSource>
                                       </textItem>
                                    </contents>
                                    <style>
                                       <CSS value="vertical-align:top;text-align:center;width:50%"/>
                                    </style>
                                 </tableCell>
                                 <tableCell>
                                    <contents>
                                       <textItem>
                                          <dataSource>
                                             <reportExpression>AsOfTime()</reportExpression>
                                          </dataSource>
                                       </textItem>
                                    </contents>
                                    <style>
                                       <CSS value="vertical-align:top;text-align:right;width:25%"/>
                                    </style>
                                 </tableCell>
                              </tableCells>
                           </tableRow>
                        </tableRows>
                        <style>
                           <CSS value="border-collapse:collapse;width:100%"/>
                        </style>
                     </table>
                  </contents>
                  <style>
                     <CSS value="padding-top:10px"/>
                  </style>
               </pageFooter>
            </page>
         </reportPages>
      </layout>
   </layouts>
</report>

RubenvdLinden

I lost track of the topic, sorry.

Your HTML does work, however the url should come from a dataitem and I need to specify a different anchor text (e.g. 'Click here').

billylodz

use data Item in HTML Item

take URL from Properties of target report

'<a href="http://xxx/COGNOS8/cgi-bin/cognosisapi.dll?b_action=xts.run&m=portal/view-output.xts&ui.action=view&ui.object=defaultOutput(%2fcontent%2ffolder%5b%40name%3d%27Reports%27%5d%2ffolder%5b%40name%3d%27Europe%27%5d%2ffolder%5b%40name%3d%27Finance%27%5d%2ffolder%5b%40name%3d%27Business%20Call%20Reports%27%5d%2ffolder%5b%40name%3d%27Sales%20Volume%20Analysis%20(PBA%20View)%27%5d%2freportView%5b%40name%3d%27BC2%20SD%20-%20' + [Business Calls].[All Countries].[All Countries].[CountryCD].[CountryCD - Long Name] + '%20-%20Category%20-%20All%20Categories%20-%20' + [Month] + '%27%5d)&ui.name=BC2%20SD%20-%20' + [Business Calls].[All Countries].[All Countries].[CountryCD].[CountryCD - Long Name] + '%20-%20Category%20-%20All%20Categories%20-%20' + [Month] + '&ui.format=HTML&ui.header=false" target="_blank">' + [Business Calls].[All Countries].[All Countries].[CountryCD].[CountryCD - Long Name] + '</a>'