Link to home
Start Free TrialLog in
Avatar of JustinW
JustinWFlag for United States of America

asked on

Cognos - Results of a Query object into an HTML object

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>
Avatar of SNeupane
SNeupane
Flag of United States of America image

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.
Avatar of JustinW

ASKER

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>
ASKER CERTIFIED SOLUTION
Avatar of SNeupane
SNeupane
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JustinW

ASKER

Super dumb question;
the HTML goes in the Expression Definition?

Its not working for me
Avatar of JustinW

ASKER

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
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.
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
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.
Avatar of JustinW

ASKER

Perfect!
THanks a tonne!
You are welcome.
:)