Postgres bytea columns in Jasper

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Postgres bytea columns in Jasper

Postby wvitpr » Fri Dec 13, 2019 6:05 am

Hi Guys,
I'm sure there are others with this issue.
I am trying to pass a postgres bytea column containing a logo to a Jasper report as a parameter. And having trouble :-(.. I have searched the internet and there are lots of different solutions to the problem, some quite complex. But I'm wondering what is the best way using Servoy, I believe there's a need to convert the image column before sending it to Jasper, maybe.. ?
From my testing if I use SQL in Jasper directly, the image displays fine by simply setting the field class to java.io.InputStream, but as I'm using Servoy foundsets this is not very practical. Any help here would be wonderful





Sent from my ASUS_Z01KD using Tapatalk
Regards,
Phillip Routley

Worldview IT
Sydney, Australia
User avatar
wvitpr
 
Posts: 219
Joined: Tue Apr 24, 2007 1:38 am

Re: Postgres bytea columns in Jasper

Postby wvitpr » Sat Dec 14, 2019 4:41 am

Found the Problem posting here for others..

/** @type {java.io.InputStream} */
Var _image = mymediacolumn
_logo = new Packages.java.io.ByteArrayInputStream(_image);

var _params = {RPT_LOGO:_logo}

Just make sure RPT_LOGO is you jasper parameter name and set the class for your parameter in jasper to "java.io.InputStream"
Regards,
Phillip Routley

Worldview IT
Sydney, Australia
User avatar
wvitpr
 
Posts: 219
Joined: Tue Apr 24, 2007 1:38 am


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 15 guests

cron