tunguyen Posted November 23, 2009 Share Posted November 23, 2009 Hi,I have a report that has a company logo. In iReport design, the logo points to a URL (e.g., new java.net.URL("http://google.com/logo")), but once that report is loaded into JasperServer, I want to use the logo loaded on that JasperServer instance (e.g., "repo:/path/file/logo.png") My question is how do I make a switch statement so that if the report runs in local iReport, it uses the URL and when it runs on JasperServer, it uses the repo: syntax. I can use something in this format for the logo image: "isServer ? use-Repo-string : use-URL-string" Does anyone know what the variable is that I can use to tell whether it is running on the server?Thanks,-Tu Nguyen Link to comment Share on other sites More sharing options...
ctkrm Posted November 23, 2009 Share Posted November 23, 2009 I'm not sure there's a variable that does what you're asking, but it's easy enough to implement yourself. Make a boolean parameter, we'll call it isServer. In iReport, set its default value expression to "new Boolean(false)" and uncheck "use as a prompt" Then use the "$P{isServer}.booleanValue() ? repo-location : url-location". On the server, depending on how you run the report, add the isServer parameter to the parameter map before running the report ie map.add("isServer", new Boolean(true)) . Post Edited by ctkrm at 11/23/2009 20:27 Link to comment Share on other sites More sharing options...
rw-network Posted November 24, 2009 Share Posted November 24, 2009 Since I run our reports on two different OSs, I was able to use a Java property as a variable to check against. In my case it is iReprot vs JasperReports. I would think that the same concept would work with JasperServer.Code:( System.getProperty("os.name").equals("OS/400") ? "/reports/templates/images/RWLogo1_noTag.png" : "H:\\Jasper\\Logos\\RWLogo1_noTag.png" ) 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