?
Solved

Cognos - Results of a Query object into an HTML object

Posted on 2011-02-18
10
Medium Priority
?
1,645 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 2000 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

839 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