COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: abcuser on 05 Oct 2015 03:38:04 AM

Title: How to display PNG image for each of the productID in crosstab?
Post by: abcuser on 05 Oct 2015 03:38:04 AM
Hi,
using Cognos BI 10.2.1 accessing Cognos TM1 10.1.1 data.

End-user requirement: Instead of displaying ProductID end-user would like to see and PNG image of this product. ProductID is just something that does not tell anything to the end-user, because he/she must see an image of the product to exactly know which product this is.

To very simplify the problem. I have a cube with two dimensions Product and Measure.
Measure has only single member: Quantity
Product has the following hierarchy: Product --> Product Group --> ProductID --> Product-PNG-image
One ProductID has only one Product-PNG-image (to simplify this sample I have just added another level in hierarchy).

Is there any way to display PNG-image of the product in Cognos Report Studio?


So far I have done this:
1. I created a Cognos TM1 cube and last level Product-PNG-image I have inserted the base64 representation of the PNG image as a member name.
See the following web page how to create base64 representation of the PNG image:
http://www.techerator.com/2011/12/how-to-embed-images-directly-into-your-html/
2. In Cognos Report Studio I have created crosstab report and added this base64 representation of the PNG image into Rows and Quantity measure as Columns.
3. Run report. I expected to see an PNG-image, but just text is displayed.

Work-around:
4. Add HTML Item.
5. Paste he base64 representation of the PNG image.
6. Run a report and PNG-image is displayed.

Is there a way to tell Report Studio to execute "Product-PNG-image" member inside HTML Item object?

See attachment. In first column I added "Product-PNG-image" in second column I added the same member name text as HTML Item object.
Thanks
Title: Re: How to display PNG image for each of the productID in crosstab?
Post by: bdbits on 05 Oct 2015 06:12:08 PM
HTML items have a property called "Source Type" which defaults to text, i.e. interpret it as HTML. If you change the source type to "Report Expression", you can then incorporate the content of data items like your Product-PNG-image into the HTML item.

So I think you would just change the source type to "Report Expression", and use your base64 calculated data item as the expression.
Title: Re: How to display PNG image for each of the productID in crosstab?
Post by: abcuser on 06 Oct 2015 01:41:24 AM
bdbits, thanks a lot for a tip. Instead of "Source Type" | "Report Expression" HTML Item property (it didn't work or I just didn't write correct expression) I have selected "Source Type" | "Data Item Value" and then in "Source Type" | "Data Item Value" property I have selected "Product-PNG-image" level. And product PNG images are displayed in Cognos Viewer. Problem solved.

Just wondering, how could I solve the same problem with "Report Expression"?
Title: Re: How to display PNG image for each of the productID in crosstab?
Post by: bdbits on 06 Oct 2015 09:03:43 AM
Hmm, ok to be honest I forgot you can just set it to a data item. But, I would have thought putting the data item in the expression, all by itself, would have accomplished the same thing. Odd that it did not. If I had embedded images in a database I would experiment. Alas, I do not, so I have gone about as far as I can go for now.

Thanks for posting back that it worked. No doubt someone will someday struggle with the same problem, and oftentimes these threads kind of drop off with no certainty on resolution.