car_lost Posted December 20, 2007 Share Posted December 20, 2007 I am relatively new to jasper reports and have not been able to find any posts that have directly asked/answered this question. I have a column in my report that renders a link by reference. Code:<textField pattern="" isBlankWhenNull="true" hyperlinkType="Reference"> <reportElement stretchType="RelativeToTallestObject" x="0" y="0" width="52" height="35" forecolor="#ff" backcolor="#d8dff5"/> <textElement textAlignment="Right"> <font isUnderline="true"/> </textElement> <textFieldExpression class="java.lang.String">. . . and expression . . . .</textFieldExpression> <hyperlinkReferenceExpression> . . . an expression . . . </hyperlinkReferenceExpression></textField> I now need to render the link in only certain conditions. The condition for rendering the link is based on the fields used to render the rest of the row. In the cases where the link is not rendered, I need to render the basic textField described above. I have seen a few posts that refer to using conditional styles as a means to show/hide certain elements. Should i just define two textFields that exist in the same space (e.g. their <reportElement/>'s are identical) and apply conditional styles to each one? If so, is their anything special about the conditional styles I should apply - is there a special style similar to "display:none" that I should be looking for? Carlos Link to comment Share on other sites More sharing options...
lucianc Posted December 20, 2007 Share Posted December 20, 2007 Try to make the reference expression evaluate to null when you don't want a link:Code:<hyperlinkReferenceExpression> $F{hasLink}.equals("true"«») ? ..link.. : null</hyperlinkReferenceExpression> HTH,Lucian 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