Jump to content
JasperReports Library 7.0 is now available ×

Field/variable/parameter evaluation problem


2004 IR Help

Recommended Posts

By: finzic - finzic

Field/variable/parameter evaluation problem

2005-12-21 01:50

hi all,

I experience the following tough (for me) problem :

I have an invoice report.

In its pageHeader band I put a textfield (A)with this textfield expression:

expr. for textfield (A):

($F{INFO_RAGDEST}.equals("")

? ""

: $P{ragioneSociale1}

)

 

where INFO_RAGDEST is a field from the query and ragioneSociale1 is a parameter my app passes to the report.

 

In textfield (B) I have the following expression.

($F{INFO_RAGDEST}.equals("")

? $P{ragioneSociale1}

: $F{INFO_RAGDEST}

)

 

THE PROBLEM IS:

given the following values:

INFO_RAGDEST = "ABC DEST";

ragioneSociale1 = "ABC";

 

the textfields above behave correctly only in the FIRST PAGE of the repor, i.e.:

(A): "ABC"

(B): "ABC_DEST"

From the second page onward, it all goes nuts in this way:

(A): <nothing>

(B): "ABC"

 

Both textfields have 'evaluation time = Now' set in their properties.

 

How can I have them behave the same across all pages?

 

Thank you all in advance.

 

 

 

 

By: Johnny A - sykosity

RE: Field/variable/parameter evaluation probl

2005-12-21 15:43

I'm not certain, but you mention that the textfields are in the page header band, and that 'INFO_RAGDEST' is a field from the query, while 'ragioneSociale1' is a parameter passed from outside.

 

The page header band does not get repeated for every record in the database like how the detail band does, so this could be your problem, since it works on the first page but none of the others.

 

If that's the problem, how to fix that? You would need to lay out things a bit differently so that 'INFO_RAGDEST' is in the detail band.

 

I'm not entirely certain that those are your problems and solutions, but I hope it helps.

 

-John

 

 

 

 

By: finzic - finzic

RE: Field/variable/parameter evaluation probl

2005-12-21 23:55

John,

thank you so much for your advice. Actually, my problem was that my code performed some modifications on the INFO_RAGDEST field before passing the datasource to the report, but it only changed the _first row_ of the datasource. The INFO_RAGDEST field was obviuosly repeated on every row, but it was different than "" only in the first row. When the report scanned the datasource on the second, third, n-th page and started evaluating the INFO_RAGDEST field in the page-header, the source had already been scanned up to a certain row number, and INFO_RAGDEST for that row was empty.

 

I solved the problem by performing a _for_ loop that performs the INFO_RAGDEST update on _all_ datasource rows.

 

Thank you again,

Luca.

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