If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Show an image as derived from a database (url shortcut)

Started by collierd, 07 Sep 2009 09:56:02 AM

Previous topic - Next topic

collierd

Hello

We are storing URL's to images in a SQL database (datatype - varchar(100))
How do I use these on a report?

I've tried a few things

If I just drop and image and change report expression to the URL surrounded by quotes it works
e.g. '..samples/images/image.gif'

Yet, if I create a query with the correct column in and call it image
Then try and use this as a report expression, it fails (doesn't run)
e.g. [Query1].[image]


I've also tried ('[Query1].[image]')
This runs but the image is blank


Am I missing something obvious?

Thanks for any help

Damian.

josepherwin

OK, there are 2 types of images. one is for Icon (header, footers, banners, etc) which is basically for displaying purposes, but there is also another one for reporting purposes (e.g. associated an image with a record in a database)

depending on the type of image, there is 2 different ways of making it to work.

The one that you've discovered below will basically work if you make the image as an icon.

However, if you want to display it in a list, you will need to:
1. Create a list table
2. From the Toolbox tab in insertable Object, drag Image to the list
3. Next in the property of the Image, you will then need to change the Source Type to be Data Item Value


david.stachon

...you are actually missing something easy (your approach is sound)

...if you want to use that column as a report expression, then the column needs to part of your list properties. (I assume you're getting a "variable not found error)

select the list > properties > check box on the column that has the image url

...josepherwin's approach works as well....and it's likely the way I would do it too.

blom0344

Quote from: josepherwin on 07 Sep 2009 06:45:43 PM
OK, there are 2 types of images. one is for Icon (header, footers, banners, etc) which is basically for displaying purposes, but there is also another one for reporting purposes (e.g. associated an image with a record in a database)

depending on the type of image, there is 2 different ways of making it to work.

The one that you've discovered below will basically work if you make the image as an icon.

However, if you want to display it in a list, you will need to:
1. Create a list table
2. From the Toolbox tab in insertable Object, drag Image to the list
3. Next in the property of the Image, you will then need to change the Source Type to be Data Item Value



A bit of a late reponse, but we have been dabbling with these issues too and for reference-sake I'll add the following:

The requirement was to have a certain image based on an ID belonging to a property and add the image to a pdf output>

html-item:


'<iframe src="http://someserver/somefolder/ImageHandler.ashx?id= '+ [Id1]  +' &size=SMALL" frameborder="0" scrolling="NO" width="100%" height="100%">You need a Frames Capable browser to view this content.</iframe>'


works for HTML output only.

image in list:


'http://someserver/somefolder/ImageHandler.ashx?id= '+ [Id1]  +' &size=SMALL'


Both expressions stored in a data-item in the query . The last approach , however also seems to work for PDF output

MFGF

If you just want to be able to drag the query item for your image URL into your report and have it display as an image, you can define this in Framework Manager - change the "Display Type" property of the query item from "Value" to "Picture" and republish the package.

MF.
Meep!

blom0344

Quote from: MFGF on 07 Jan 2010 03:39:40 AM
If you just want to be able to drag the query item for your image URL into your report and have it display as an image, you can define this in Framework Manager - change the "Display Type" property of the query item from "Value" to "Picture" and republish the package.

MF.

I'll test your suggestion. The actual URL is dynamic , in my case depending on the [Id1] value. Do you by chance have an idea if we can scale images within report studio?

MFGF

Quote from: blom0344 on 09 Jan 2010 03:00:34 PM
I'll test your suggestion. The actual URL is dynamic , in my case depending on the [Id1] value. Do you by chance have an idea if we can scale images within report studio?

Yes - just use the Size & Overflow property to define the absolute size of the image in the report.  If the image object is (for example) within a list column, you will need to unlock the structure to be able to select it for sizing - just sizing the list column itself will not give desired results in my experience.

Cheers!

MF.
Meep!

blom0344

Your suggestion seems to work, but only after setting the 'visible' property to an explicite 'yes'. That was the missing link, I kept getting empty lists without that setting (very weird..)   

koll2427

I know this is a VERY old post and I apologize up front if there is more recent information on displaying URL images in Cognos ReportNet reports.   I followed all the instructions in this post and got a report to render an image via a URL derived from a database.   So thank you for that info.   The problem is that only SOME of the jpeg images are rending in PDF and others are not.   All render in HTML, but only some render in PDF.   I can't figure out why some won't display when running in PDF format.   Any suggestions would be much appreciated.   Thank you!

MFGF

Quote from: koll2427 on 09 Oct 2018 02:50:32 PM
I know this is a VERY old post and I apologize up front if there is more recent information on displaying URL images in Cognos ReportNet reports.   I followed all the instructions in this post and got a report to render an image via a URL derived from a database.   So thank you for that info.   The problem is that only SOME of the jpeg images are rending in PDF and others are not.   All render in HTML, but only some render in PDF.   I can't figure out why some won't display when running in PDF format.   Any suggestions would be much appreciated.   Thank you!

I remember Cognos 8 being quite picky about displaying images at times. It's been a while, so my memory is quite hazy here, but I seem to recall relative URLs working consistently whereas absolute URLs being difficult to render in PDF. It might have been the web server rather than C8 at fault, though.

Can you give us an idea of the URL format you are using?

Cheers!

MF.
Meep!

CognosPaul

If it's working some times but not others, it might be due to the type of image in the database. Are they all jpgs or pngs? What happens if you take an image that fails to export, save it to a file system and call it directly?

koll2427

The database query is based on a person's ID to obtain the URL where the image is located.   I defined the URL field as an image in Framework Manager.   All images render in HTML via Cognos ReportNet, but the only jpg that works using PDF output format is a location outside our firewall.   All the URLs reference jpg files and each URL is pointing to different file servers, so the image itself is not in a database.   Could there be an issue with the file location URL containing spaces, or something like that?

koll2427


CognosPaul

This sounds like a security problem. Does the Cognos service account have permissions to view those images?

koll2427

I was able to get all the images to render in PDF format.   It was a server permission issue.   Thank you so much for your assistance on this.

sr345

Hi Everyone,

Sorry for dragging an old thread back to life. Below is a URL I'm placing into a Query Calculation. When I add it to a list, I just get the URL. Under is an example of the completed URL that shows an image of a barcode. Any insight on how I can insert the barcode into my report instead of the URL? Not sure what I'm missing.

Query Calculation:
'https://www.bcgen.com/demo/linear-dbgs.aspx?D=' + [Resource ID] + '&S=1'
*If I enter it without the single quotes it errors out.

Example:
https://www.bcgen.com/demo/linear-dbgs.aspx?D=P00020&S=1

MFGF

Quote from: sr345 on 20 May 2021 02:44:51 PM
Hi Everyone,

Sorry for dragging an old thread back to life. Below is a URL I'm placing into a Query Calculation. When I add it to a list, I just get the URL. Under is an example of the completed URL that shows an image of a barcode. Any insight on how I can insert the barcode into my report instead of the URL? Not sure what I'm missing.

Query Calculation:
'https://www.bcgen.com/demo/linear-dbgs.aspx?D=' + [Resource ID] + '&S=1'
*If I enter it without the single quotes it errors out.

Example:
https://www.bcgen.com/demo/linear-dbgs.aspx?D=P00020&S=1

Hi,

First, make sure you have your query calculation defined in your list query with an expression as you posted above:
'https://www.bcgen.com/demo/linear-dbgs.aspx?D=' + [Resource ID] + '&S=1'

If you want a clickable URL for this in your report, the trick is to find the Hyperlink object in the toolbox and drag this into your list as the list column. From the Properties pane, you can then use the query calculation as the URL source and also as the text source if you wish.

If you want to display the image directly in the list column in your report, find an Image object in the toolbox and drag this into your list as a list column. In the properties pane, find the URL Source section and set the Source Type property to Data Item Value, and then set the Data Item Value property to be your query calculation.

Cheers!

MF.
Meep!

sr345

Quote from: MFGF on 21 May 2021 07:31:21 AM
Hi,

First, make sure you have your query calculation defined in your list query with an expression as you posted above:
'https://www.bcgen.com/demo/linear-dbgs.aspx?D=' + [Resource ID] + '&S=1'

If you want a clickable URL for this in your report, the trick is to find the Hyperlink object in the toolbox and drag this into your list as the list column. From the Properties pane, you can then use the query calculation as the URL source and also as the text source if you wish.

If you want to display the image directly in the list column in your report, find an Image object in the toolbox and drag this into your list as a list column. In the properties pane, find the URL Source section and set the Source Type property to Data Item Value, and then set the Data Item Value property to be your query calculation.

Cheers!

MF.

Thank you for responding! This solution worked perfectly to display the image.