Solved

Cognos - Results of a Query object into an HTML object

Posted on 2011-02-18
10
1,595 Views
Last Modified: 2012-05-11
Is there any way in Cognos Report Builder 8.+
to use the results of a query object in an html object.

For example, say I have a query that returns 1 record containing
-Asset Name
-Property Name
-Property State
-Property City

I want to have an HTML object where I can use these results like
<html>
<body>
<h1>ASSET</h1><br />
<p><%=Asset_Name%></p>
<p><%=Property_Name%></p>
<p><%=etc%></p>

</body>
<html>
0
Comment
Question by:JustinW
  • 6
  • 4
10 Comments
 
LVL 8

Expert Comment

by:SNeupane
ID: 34926877
Select HTML item and in the properties under HTML Source, change Source type to 'Report Expression'.
Then you can use one of the data item in that HTML directly.
Just add separate HTML item for each query and format it to look like what you want.
In report expression, you can concatenate characters.
0
 
LVL 1

Author Comment

by:JustinW
ID: 34927296
thanks,

so if I want to do the following; how would I go about doing it?

<html>
   <body>
      <h1>
        [SQL1].[ASSET_MGR]
      </h1>
   </body>  
</html>
0
 
LVL 8

Accepted Solution

by:
SNeupane earned 500 total points
ID: 34927447
Okay, to make that work, follow the same instructiton I gave before and use single quotes to wrap HTML tags so that Cognos thinks it is a text.
I tested it in Cognos 8 and works fine.
Notice the single quote from '<html to h1>' and also from '</h1 to </html>'
'<html>
   <body>
      <h1>' + [SQL1].[ASSET_MGR]
+ '</h1>
   </body>  
</html>'
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 1

Author Comment

by:JustinW
ID: 34927553
Super dumb question;
the HTML goes in the Expression Definition?

Its not working for me
0
 
LVL 1

Author Comment

by:JustinW
ID: 34927587
Sorry, that's pretty vague;
It throws this error with, or without the HTML
RSV-VAL-0002 Invalid Expression [Query1].[ASSET_MGR]. CRX-API-0005...The variable named '[Query1].[ASSET_MGR]' is invalid
0
 
LVL 8

Expert Comment

by:SNeupane
ID: 34928056
That's a different error.
Select the page and associate the query with those data items checked.
It'll not give that error after that.
0
 
LVL 8

Expert Comment

by:SNeupane
ID: 34928109
In order to use a variable or data item directly on a page, you have to associate the query.
Click on the page, go to properties, select page.
Click on query and select the query that you are using on the HTML item.
Then check the data items used and click okay.

To clarify more check the attached image.
variable.JPG
0
 
LVL 8

Expert Comment

by:SNeupane
ID: 34928141
Not sure if you were able to follow.
The HTML item should have the property of 'HTML Source' --> 'Source Type' set to report expression.
Then you use the single quote method I gave.
Then apply the query in the page as above and you should be all set.
I've tested it and done it before. Works fine.
0
 
LVL 1

Author Closing Comment

by:JustinW
ID: 34928251
Perfect!
THanks a tonne!
0
 
LVL 8

Expert Comment

by:SNeupane
ID: 34928313
You are welcome.
:)
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Statement In an SAP BI BO Integration project when a BO universe is built on a BEx query, there can be an issue of unit & formatted value objects not getting generated in a BO universe for some key figures. This results in an issue whereb…
How to increase the row limit in Jasper Server.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question