Jump to content
Changes to the Jaspersoft community edition download ×

Textfield pattern like "("+$P{myField}+")"

Recommended Posts

By: Laurent Raynal - lraynal

Textfield pattern like "("+$P{myField}+")"

2006-02-21 08:51


What's the most elegant syntax for Textfield to print a String value between parenthesis and just blank when the value is null ?


I don't want to write this Textfield expression all over the place:

( $P{nom} != null && $P{nom}.length() > 0 ? "(" + $P{nom} + ")" : null )


PS: I don't want to preprocess my parameters before feeding them to Jasper


PPS: "Blank when null" works great for Date and number fields with a pattern but I understand there is no such thing for plain String.


Thanks a lot and congratulations on this great tool.






By: Denny Valliant - xenden

RE: Textfield pattern like "("+$P{myField}+")

2006-02-21 09:22

I don't know the syntax off hand, but I bet you could set a boolean and then use that in your string printWhenExpression's expression.


I think. :-)

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...