Overview
One common requirement for reports is to display images
store inside the database. When adding these tables and columns from database to
Cognos Framework Manager Model, the image column are represent as ‘BLOBs’
inside the model and package.
When BLOB fields are use in Cognos Report Studio from the
published package, none data is displayed.
Cognos does not support reporting ‘BLOB’ data types!
The Idea
The idea to work around this issue is to add a asp page that
will get record information from the Cognos report, retrieve the image file
from the database and return to Cognos as html displaying the actual image to
be use a URL information in a image object in Cognos Report Studio.
Considerations / Impacts / Challenges
Security: Security will have some limitation
with this approach, however, security could be apply in many different ways
according to each environment and requirements.
Observations
Diagram:
ASP Page Code (sample)
<% @language=VBScript %>
<%
Dim ONES
Set ONES = Server.CreateObject("ADODB.Connection")
ONES.ConnectionTimeout = 15
ONES.CommandTimeout = 30
ONES.Open "Provider=SQLNCLI; Server=WINS-DATABASE\WINS2012; Database=name; Uid=user; Pwd=password;"
Dim rs
Set rs= ONES.execute("select imagecolumn from imagetable where id='" & Request.QueryString( "attach_id" ) & "'" )
If rs.eof=false then
Response.ContentType = rs(1)
<!--Response.Flush -->
Response.Buffer = True
Response.BinaryWrite rs(0)
Response.End
End If
rs.close
ONES.close
Set ONES=nothing
%>
ASP Page Location
Any location in the network that can be
reach by the Cognos Report
Image Object in Report Studio: Change the URL property for
the object to point to the asp page location
Nice posting..
ReplyDeleteThanks for given information. this is very useful for me.
IBM Cognos