Solved

Cognos - Results of a Query object into an HTML object

Posted on 2011-02-18
10
1,563 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
 
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now