[#8186] - Hyperlink When Expression Doesn't Seem to Have Any Effect

Bug report
Project: Severity:
Unable to Reproduce
Component: Reproducibility:
Assigned to:

It is necessary, in certain circumstances, for a hyperlink to be deactivated on a report element. We've tried using the Hyperlink When Expression, but it has no effect on whether the link works or not. As a workaround, we just add some conditional statements to the Hyperlink Reference Expression, but this doesn't remove the user cue for the link (i.e. the cursor still changes to a pointer).

If this is not the intended purpose of this field, then what is it for? And would it be possible to add a feature that does what we describe above?

If it is the intended purpose, we'd like to see it fixed. We also want to make sure that the user cue is disabled as well as the link (curse remains as arrow/text and does not become a pointer finger). Or is there something special we need to do to use it?


jlyons's picture
Joined: Jul 30 2015 - 10:43am
Last seen: 1 month 5 days ago



The problem should have been fixed in 6.2.1 at https://sourceforge.net/p/jasperreports/code/ci/0781020d1ed3

Could you confirm that you are using 6.2.1? If so, please describe a detailed test case to reproduce the problem.



It's not working with 6.3.0. The problem is JasperReports is using Boolean instead of boolean. I think I've submitted how to fix this issue somewhere.
The simple solution is just to change one line in engine/fill/JRFillTextField.java as below.
if (getHyperlinkWhenExpression() == null || (hyperlinkWhen != null && hyperlinkWhen))

I think it's actually better to do replace class Boolean with primitive boolean.That is, change (Boolean) in following to make it work with (boolean)
hyperlinkWhen = (Boolean) evaluateExpression(getHyperlinkWhenExpression(), evaluation);

  • Assigned:nobody» lucianc

You're right @hozawa, the hyperlinkWhen test is faulty. I checked in a fix at https://sourceforge.net/p/jasperreports/code/ci/649150ca4dc073255d41eb12...

I can't say whether this was the problem that Jeff was facing, a detailed test case is required.

Thank you,

  • Resolution:Open» Fixed

This seems to be working now. Thanks!

  • Status:New» Resolved
  • Priority:Low» Normal
  • Resolution:Fixed» Reopened
  • Status:Resolved» Assigned

As of 6.4.2, this is still not working.


@jlongoria please include a test case to reproduce the problem you're experiencing.


The text field's hyperlinkWhen expression has the expression 'true == false', which is should evaluate to false.

When published to JasperReports Server, the hyperlink remains active and clickable.

Binary Data hyperlink_test.jrxml1.66 KB

I ran the report you attached in JRS 6.4.2 and there was no hyperlink on the text element. Can you describe in detail how you run the report in JRS 6.4.2?

  • Status:Assigned» Feedback Requested
  • Resolution:Reopened» Unable to Reproduce
  • Status:Feedback Requested» Closed

I ran the attached report on Jaspersoft Studio 6.5.1 and hyperlink was inactive with 'true == false' and active with 'true == true' so there's no problem with JasperReports library.