Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Dynamic Image Sizing?
megabri
I'm trying to dynamically set the size of an image in a BIRT report I'm making. I query my database and if a specific field comes back true I want the image to be 4x6 if the field's value is false i want the image to be 6x4 instead. How can I dynamically set properties in BIRT?
Find more posts tagged with
Comments
kclark
I created a scripted dataset with alternating true/false for a resize field and then created a table. In the edit data binding expression builder I used the following script.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>if(dataSetRow["resize"] == true) {
reportContext.setPersistentGlobalVariable("size", "true");
}else{
reportContext.setPersistentGlobalVariable("size", "false");
}
dataSetRow["resize"]</pre>
<br />
Then in the onCreate() of the image I used the following to resize<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>if(reportContext.getPersistentGlobalVariable("size") == "true") {
this.height = ".5 in";
this.width = ".5 in";
}else{
// some other height and width
}
</pre>