Link to different locations depending on environment

1

Hi,

I'm trying to create a hyperlink that takes me to a different link depending on which server my report is running on and was wondering if someone could help.

The scenario:

  • We have a development server and a live server.
  • I want a link in the report to go to a corresponding link in the development environment if that's where the report is running.
  • If the report is running in the live environment then I want the link to go somewhere else.
  • The link is not another jaspersoft report, it's a spring web application, so I can't use the report execution hyperlink option.
  • I don't want to have to make any changes to the report between the 2 environments, just a straight export.

Both enviroments use different databases so I've tried doing it this way:

$P{REPORT_CONNECTION}.getMetaData().getURL().contains("live-db") ? "http://livelink.com" : "http://devlink.com"

This approach works for my browser but doesn't seem to work for another persons browser (always taking them to the dev link). I haven't fully investigated why.

Does anyone know of a better way to do achieve this?

Setup:

Jasperserver Pro 4.7

iReport 4.7

Thanks,

James

jgraham0325's picture
Joined: Nov 8 2012 - 4:33am
Last seen: 5 years 5 months ago

Just an update on this. 

Using the above method works fine, until the user tries to use the filters in the table component. As soon as a filter is used, the REPORT_CONNECTION object becomes null.

If anyone has any other ideas, please let me know.

 

Thanks,

James

jgraham0325 - 5 years 5 months ago

0 Answers:

No answers yet
Feedback
randomness