Jump to content
We've recently updated our Privacy Statement, available here ×

evaluation time & style


claudiobosticco

Recommended Posts

I have a text field with evalutaion time=auto because it's a sum printed before the fields which contributes to the total value.

I need to print the total in red if > 0 and green if < 0.

normally I've used a conditional style to accomplish this, but the style's conditional expression evaluation seems to be evaluated "now", when the sum is zero.

is it correct? Any workaround for this?

 

Thanks

Claudio

Link to comment
Share on other sites

  • Replies 11
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...
  • 4 months later...

From what I can tell from iReport a scriptlet can only access data objects i.e fields, variables and parameters; not the view object i.e TextField.

If I'm wrong can you give me an example of changing the font colour in a scriptlet.

Link to comment
Share on other sites

rogerjose81
Wrote:

Of course, I mean to access the scriptlet from the conditional style. In the scriptlet you will manage the sum as you want.

There is no point is accessing the data before eval as the information has not been processed to determine the value, or after eval as It is not going to chagne the way it looks because the conditional sytle or printWhen expression has ready been evaluated.

Again if I'm wrong can you give me an example of changing the font colour in a scriptlet.

Link to comment
Share on other sites

I did not referred to change the font color in the scriptlet; it was about use the scriptlet just to know when to change the font.

 

In any case, I would prefer to see code in this case. If you want create a tiny report to show your problem and post the code here.



Post Edited by Roger Padilla at 03/11/09 21:09
Link to comment
Share on other sites

OK here is a small example with a master and sub report. The subreport passes back a value to the master. The master using a conditional style sets the foreground red if the value is negative (at least it should).

Notice the return value in the column header is not set red with a negative number, but the return value in the column footer is.

To run the example first change the classpath in run_test.sh to your lib files then run

./run_test.sh -100

or

./run_test.sh 100

 

I hope the example explains it better than I can.

Link to comment
Share on other sites

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...