Solved

Cognos - Results of a Query object into an HTML object

Posted on 2011-02-18
10
1,586 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
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 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS SQL 2005 Srink database in chunks 4 57
Need help with a query 6 72
How to place a condition in a filter criteria in t-sql (#2)? 10 46
Query to return total 6 18
Hi, In my previous Article  (http://www.experts-exchange.com/Database/Reporting/A_15199-Introduction-to-Microstrategy.html)I discussed some basic understanding of Microstrategy that how we can get in Intro of Microstrategy (MSTR). Now it's tim…
I recently went through setting up a JasperReports Server using the AWS EC2 instance, and this article will cover some basic administration tasks I had to perform.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

813 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

14 Experts available now in Live!

Get 1:1 Help Now