Jump to content
Changes to the Jaspersoft community edition download ×

getting another fields value

Recommended Posts

By: Hathfuri - hathfuri

getting another fields value

2005-01-20 10:40

Hello everyone,


I'm am fairly new to Jasper and iReports, but with other reporting tools have found it common and easy to reference a field on the report from another field. Could someone give me the map/method and which value should be used as the key to do this?


ie. field #1 = "Page 1 of " (page_count eva - now)

field #2 = "35" (page_count eva - group or report)


field #3 = field #1 + field #2's values = "Page 1 of 35"


Thanks for your time.



By: David Lim - aberrant80

RE: getting another fields value

2005-01-24 01:58

You could use variables I think.



By: Hathfuri - hathfuri

RE: getting another fields value

2005-01-24 05:46

Variables don't allow you to specify an evaluation time. If I put one of the above expressions in a variable, that variable would still need to be put in a Field so I could tell Jasper what evaluation time I would like, i.e. report or now for the total page and current page values respectively.


I'm looking for a way that I could essentially make a total pages field with report evaluation time, then reference that field from my current page field with now evaluation. The variable, Page_Number is only the total page number if I have a field that says to evaluation it at report time.


If anyone can help, it'd be appreciated.



By: Craig O'Shannessy - shanness

RE: getting another fields value

2005-01-24 06:34

I assume you've looked at the "Page i of n" trick on the website?




Here is some working code


<reportElement x="185" y="10" width="80" height="15"/>

<textElement textAlignment="Right"/>

<textFieldExpression class="java.lang.String">

"Page " + String.valueOf($V{PAGE_NUMBER}) + " of"



<textField evaluationTime="Report">

<reportElement x="265" y="10" width="100" height="15"/>

<textElement textAlignment="Left"/>

<textFieldExpression class="java.lang.String">

" " + String.valueOf($V{PAGE_NUMBER}) + " (" + String.valueOf($V{REPORT_COUNT}) + " Products)"






By: Hathfuri - hathfuri

RE: getting another fields value

2005-01-26 14:43

I want both values in one field, not in two. The reason I want them in one field is so I can right justify that field and have the field grow to the left as it needs, yet keep the values together. Thanks for the comment though.

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