Maximo List Archive

This is an archive of the Maximo Yahoo Community. The content of this pages may be a sometimes obsolete so please check post dates.
Thanks to the community owner Christopher Wanko for providing the content.

add record image to BIRT report

From: therron (2018-01-15 23:36)

Hi all,

Anyone know if it is possible to add a recordimage to a BIRT report? Honestly, I haven't tried real hard (yet, but I'm about to after I finish typing this), but it seems like the Fetch statement's get method might be weird.

(I tried googling it, not much luck there.)

Travis Herron

From: therron (2018-01-15 23:48)

Never mind, got it. That was surprisingly not-that-hard!

Travis Herron

From: therron (2018-01-16 00:29)

Can I never mind my never mind?

I'm trying to get my custom WOPRINT.rptdesign to have the record image for the location and/or the asset. But despite having a proper LEFT JOIN in my scripted data set to go from workorder to locations and another LEFT JOIN from locations to imglib; and LEFT JOINs from workorder to asset and then from asset to imglib, the Preview throws a null pointer error if either one of those fields are NULL (e.g., if workorder.assetnum is null, then it will fail; if workorder.location is null, it will fail; but if both workorder.assetnum and workorder.location are not NULL, it works).


Travis Herron

From: therron (2018-01-16 00:55)

Never mind, again.

ISNULL statement in the SQL/scripted data set and a visibility rule on the design element, and it seems to be working how I wanted it to work.

Travis Herron

From: maximal (2018-01-16 16:03)

So what was your solution? What's it look like?

From: therron (2018-01-17 16:33)

1) In the OPEN part/scripted data source, call for imglib.image (with alias if asking for more than one, as I did). For example, if trying to get the recordimage for workorder.location (just a sampling here, surely you'd call for more fields and more tables; in this example, this would be in the mainDataSet of woprint.rptdesign):

SELECT workorder.wonum, workorder.location, workorder.description, locations.description as locdesc, ISNULL(imglib.image, '') AS locimage
FROM workorder
LEFT JOIN locations on workorder.location = locations.location and workorder.siteid = locations.siteid
LEFT JOIN imglib on locations.locationsid = image.refobjectid and image.refobject = 'LOCATIONS' "

Despite using a LEFT JOIN, I was still getting a null pointer exception if the recordimage didn't exist, so I used that ISNULL statement to always get something, either the recordimage or an empty string.

2) Add it to your FETCH, like this:

row["locimage"] = maximoDataSet.getBlob("locimage");

3) Add a binding to it for your data set. Right-click on the data set, Edit, click on Output Columns, click the Add button, give it a Column Name (here, locimage) and Data Type is BLOB. If adding an image to a subreport, remember to refresh the table's bindings.

4) From the Palette menu, drag an Image into your Layout. Configure it as a Dynamic Image, getting its value from (in this example) row["locimage"].

5) You probably want to set a size limit on it. Click on the Advanced settings for the Image element and set a Height and Width. The first time I tried I didn't do that, and the image was HUGE.

6) Now I put a visibility rule on it as an added bonus. Without it, if there's no recordimage, you should just get that thumbnail placeholder icon. I'd just rather have pure nothingness. So, visibility rule:

Hide Element is checked
All outputs (is what I wanted anyway)
Expression (for this example): row["location"] == null

That's it! All tests so far have worked. Just make sure to consult what you did in Database Configuration to create the Relationship from <OBJECT> to IMGLIB when you go to write the SQL for your scripted data source. I put in WOPRINT the record image for the Location and the Asset, and in the Planned Materials subreport I put the Item recordimage. Considering doing the same for POLines and PRLines on POPRINT and PRPRINT. Maybe even the recordimage of the Reported By person for the work order, but that might be over the top.

Travis Herron

From: maximal (2018-01-17 17:08)

This is a great tutorial, and I think the readers will really appreciate it. I know I did.
Thanks again.