Category: | Bug report |
Priority: | Normal |
Status: | Feedback Requested |
Project: | Severity: | Minor |
Resolution: | Reopened |
|
Component: | Reproducibility: | Always |
Assigned to: |
I can specify evaluation time of a summary variable for a group to derive the desired contents for printing, but I cannot specify that print conditioning use the same criterion, to obtain the desired print characteristics.
Please add either an independent "Evaluation Time" for "Print When Expression", or at least a check box that it match the "Evaluation Time" for "Text Field Expression".
4 Comments:
I see your problem, but there are several ways to workaround it.
In particular, you should use a conditional style, or you can use a markup to color your text instead of using two overlapped elements and the print when expression.
anyway, if you really like the evaluation time for the print when expression, this is a JasperReports request for enhancement. Consider to submit your request here:
http://jasperforge.org/projects/jasperreports/tracker/myview
Thanks a lot, we appreciated the time you spent to submit your request.
Giulio
>> I see your problem, but there are several ways to workaround it.
>> In particular, you should use a conditional style, or you can use a markup to color your text instead of using two overlapped elements and the print when expression.
Thanks for the tip about conditional styles (I see it now in The Definitive Guide on page 79) -- I will use it -- but it has the same problem (I just tested it) in that the variable used in defining the conditional style is evaluated just after its initialization, not at the end of the group.
Since my version of the Guide is based on iReport 2.0, it doesn't make mention of Markups, but I suppose that a Markup would have the same issue?
>> ...this is a JasperReports request for enhancement. Consider to submit your request...
Thanks, I will do that, unless you can show me something that I've missed.
Regards,
René
I agree, conditional style does not work in your case. The idea of the markup is to produce a chunk of styled (or html) text.
Here is what you should do. Change the textfield to String and use an expression like:
( (<CONDITION expression>) ? "<font color="red">" : "" ) +
<VALUE expression>
When the condition expression is true, the <font color="red"> is prefixed, coloring the text of red.
Since the textfield is a String, you can no longer use the pattern to format your number. Here is how to workaround the problem:
new java.text.DecimalFormat("#,#0.00").format( <VALUE expression )
The textfield markup property must be set to HTML.
Giulio
Hello Giulio,
Using the text field markup property, and specifying font characteristics and field formatting in the Text Field Expression does what I want as a workaround.
Text Field Expression:
( $V{TotalOrderPrice}.doubleValue() < 0 ? "<font color="#FF0000">" : "") + ( new java.text.DecimalFormat(" ¤ #,##0.00").format( $V{TotalOrderPrice} ) )
Thanks!
René
By the way, I noticed that where I can successfully use a style, where evaluation is done "Now", the pattern specified at the style is ignored; I still have to specify the pattern at the element.