Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
display dynamic image
amul
Hi all
i am new to this forum and hereis my issue.
I am using BIRT reporting tool.I would like to display the image dynamically at runtime.I am using scripted data source.
I have seen the example in the forum but it was not with scripted data source.
Could you please suggest me how to proceed.
regards
amul
Find more posts tagged with
Comments
mwilliams
Hi amul,
How does your image data look when it comes in? Can you provide a report with a scripted dataSource containing the image data like you're wanting to display that I can run? Thanks.
amul
thanks for the reply.
I dont have any such image related data coming thru Data source.
I have placed the images in resources folder seperately
regards
amul
mwilliams
amul,
How do you know what image you want to show? Does anything in your dataSet indicate which image to display?
amul
mwilliams
Thanks for the reply.
I have static images in my resources folder.based on true or false i need to display those images.
Do i need to write some script in the event "onRender".If so could you pls giv me some example.
regards
amul
mwilliams
amul,
So, your dataSet looks something like the following then?
image | show
image1.jpg | true
image2.jpg | false
image3.jpg | false
image4.jpg | true
.... | ....
I'd like to have some sort of idea of what you have in your dataSet before I try to make an example for you, so I know it's at least similar to your situation. Thanks.
amul
mwilliams
thanks for the reply.
This my scenario.
I have my DataSource country_ds
my dataset : stateoutput
with output coloumns : name, age,occupation,address, zip,state, and country.
I have all the values computed in the backend using java.
while rendering the report based on the country value i need to display the respective flag(image) all the images i have in my resources folder.
hope u understood my scenario.
regards
amul
mwilliams
Amul,
Give this report a try. Save all of these to your resource folder and run the report design. Let me know if this is what you're looking for.
This report was designed in BIRT 2.3.2.2.
amul
hi williams
thanks alot for the valuable example.
actually i am not at work from past two days.
so i will check on monday and let u know.
regards
amul
mwilliams
Amul,
No problem, just let me know.
amul
hi williams,
thank you for the patience.
When I double click on the image i get the following error
row["country"] + ".jpg" is not found. let me know the fault.
The follwing is another issue regarding the visibility of the element.
can i use the the visibility fucntionality of the element for specific groups.I did the following.let me know if this is correct.
if(row["country"] == "germany")
{
return true;
} else {
return false;
}
i did this for pdf ouput.
hope you r not confused by my issues.
thanks in advance
mwilliams
Amul,
Did you save the images to your resource folder as 'USA.jpg', 'France.jpg', and 'Germany.jpg'? This is necessary for this example to work.
amul
hi williams
yes i have saved all the jpg's in the same folder
regards
amul
mwilliams
Amul,
I downloaded the example and images to my workspace in another version and it ran just fine as is. I don't know what issue you're having not being able to find the image files. As long as they're in your resource file and named correctly, they should be found.
amul
hi williams
i could run your application and sorry for the previous one.
i downloaded the version u were using and then i was fine.
I could also use your procedure but i wanted in other way round.
I am getting all the data in a java class.so i want to set the image(irresepective of the file name) in that class itself instead in the report which seems like hardcoding the image file.
the names of the file can be g.jpg, u.jpg and f.jpg.
thanks for ur patience.
mwilliams
Amul,
I guess I'm back to not understanding totally what you're trying to do. If you're wanting to assign the image file to your rows in your scripted dataSet, you'll have to be able to associate which image goes with which row. If you can do this, just create a new field in your dataSet called "groupImage" or something like that that assigns your image files to your rows. Put all of your image files in your resource folder. Then, just like in my report design I posted, put an image element in the group header, choose the "resource folder" option and choose the table binding for the "groupImage" field.
amul
hi willaims
does the script goes this way:
if(row[country] == "germany") {
groupImage = "germany.jpg"
}
regards
amul
mwilliams
Amul,
You would go to the computed column section of the dataSet editor, click new, name the column groupImage, make it type string. If all your image names are the same as the country, your code could simply be:
row["country"] + ".jpg";
If your file names aren't exactly the same like this, you'll have to do something like:
if (row["country"] == "germany"){
"grmny.jpg";
}
else if (row["country"] == "USA"){
"US.jpg"
}
etc....
amul
hi williams
sorry for late reply.
atlast i could find the solution.Thx a lot for ur valuable replies.I did the follwing way:
I just dragged the image from the pallette.
I wrote the script In onRender option
if(row["country"] == "Germany") {
this.imageName = "ger.jpg";
}
.
.
.
.
.
.
.
and that follows..
i got the output expected.
Thanks alot
regards
amul
mwilliams
Amul,
Great! No problem. Glad to help.