r00 Posted May 26, 2021 Share Posted May 26, 2021 Hello, I have reports set up to show data based on LoggedInUsername. I would like to include the conpamies image as well. The image needs to change based on the LoggedInUsername. How can I achieve this? I though maybe I could upload images to the Server in the Image folder and then pass in a Paramater that way but it is not working for me. example /images/$P{LoggedInUsername} Link to comment Share on other sites More sharing options...
darth_fader Posted May 27, 2021 Share Posted May 27, 2021 I'm assuming you're referring to the person actively logged into jasper server, and that there is a directory (or image name, or some text string) for each of those unique users/companies located on jasper server. If so, you're on the right path you can do this. When you define the path location to the image in the report, you need to tack on the image file extension. So if the user is Joe_User, and the file is located in jasper server as /images/Joe_User.png, you'd want to define the image url in the report like "/images/"+$P{LoggedInUsername}+".png"I don't know how many users/companies etc you need to support, but this approach won't scale well. If you need a scalable solution, if you can derive the company name from the report query, then you can specify the image location using a variable rather than a parameter. This is a fairly common problem with multiple possible solutions. So you can do it exactly as you describe, but that solution won't scale well - if that matters.Here's a list of common user attributes available 'out of the box' for logged in users, you can also create your own custom user attributes. https://community.jaspersoft.com/wiki/built-parameters-logged-user Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now