Home
Analytics
Using BLOB image in BIRT report !?!
Ceryl
Hello everyone,
Hopefully you can help me out.
I am quit new to building reports using Eclipse Birt.
At this moment I am creating a report which also has to display an image stored in the database (as a blob). I am using a scripted dataset (datasource).
I have searched the internet already, but can`t find a proper answer!
Can somebody provide me with an example of the Open en Fetch statement, only for the BLOB image.
And maybe explain in short how to add it to the report.
Thank you in advance!
Greetings,
Ceryl Geelen (Netherlands)
Find more posts tagged with
Comments
mwilliams
Hi Ceryl,
If you bring it in as a type blob, you should be able to drop an image element in your table where you want it and call the row["image"] as a dynamic image.
Hope this helps.
Ceryl
Hi Michael,
First of all thank you for your reply.
I have tried this already without a positive result.
I`m using BIRT in combination with Maximo Asset Management (7.1.1.5).
So I need to use a scripted datasource including scripted DataSet(s).
This means I have to specify an "Open" and a "Fedge" script in order to retrieve and map data from the database.
So the thing that I am looking for is the correct fedge command (Get.....) that is needed for bringing over the BLOB data (image in my case) to the DataSet.
I can get the "String" over already (all those characters), but I need BIRT to process it back to an image. It has to be handled as a BLOB.
Hopefully you can help me out,
Thanks again!
Greetz,
Ceryl Geelen
mwilliams
Ceryl,
Does going to the output columns section of your dataSet and changing the type to BLOB not work?
Ceryl
Michael,
I have tried the change the type to BLOB (Output Columns), but unfortunately without a positive result.
I think the "open" part of the scripted DataSet goes well, because I can retrieve the "string" data out of the BLOB.
The problem occurs in the "fetch" part, the way the data is passed through to the DataSet.
Using BIRT for Maximo Asset Management report brings along a different way of retrieving and fetching data.
The thing I`m looking for is the correct fetch command in order to handle the BLOB data correct.
row["status"] = maximoDataSet.getString("status");
But "getString" is not the correct "get" command. Do you know which one to use for BLOB data?
Tanks again!
Greeting,
mwilliams
Ceryl,
I would assume then that you should use getBlob() to get the blob data. You may have to include the package java.sql.Blob to use this. I don't have a way to test this, so I'll have to wait and hear back from you if you're able to get it working.
AndersH
Hi,
I'm also trying to use a BLOB as a image in my report, but not from a database. I'm using a scripted datasource with scripted datasets. The datasets are plain POJOs that I put in the appContext (my BIRT report is deployed in a webapp). The POJO has a method called: getBytes() which returns a byte[]
I have a table where I've droped a Image element, it's a dynamic image. The column in the dataset is of BLOB type. It all works fine except for one thing... The same image is generated in the report for each record in the table?! If I dump the bytes to a file on disc in the fetch script the different images are written to the different files
** fetch script **
...
var name = pojo.getName();
var image = pojo.getBytes();
FileOutputStream out = new FileOutputStream("/tmp/" + name + ".png");
out.write(image);
out.flush();
out.close();
row["name"] = name;
row["image"] = image;
...
My dataset contains 2 records - so this generates 2 files in my tmp dir, rec1_name.png and rec2_name.png, and when I open the png files they are 2 different images. But in the generated table in the report it is two different names but the same image is displayed for both records...?? What am I doing wrong?
Ceryl
Hello Michael,
Can you explain to me how to set up the "java.sql.Getblob" package?
Do I have to do it in the Fedge script?
Hope to hear from you soon!
Greetings,
Ceryl Geelen
mwilliams
Ceryl,<br />
<br />
It's probably going to be getBytes(), not getBlob(). Here's the info about the package I was talking about:<br />
<br />
<a class='bbc_url' href='
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Blob.html'>Blob
(Java 2 Platform SE v1.4.2)</a>
Virgil Dodson
Hi Ceryl, I am moving this thread to the Using BIRT with Maximo forum since there may be some specific "get..." method you need to call to grab the image from the database
magic_bern
hi Ceryl,
Did you finally manage to get that image? because i am eagerly waiting to find out how it is done as i have the same issue.
Cheers