Jump to content

Variable Issue


frank.py

Recommended Posts

I’m having trouble with this variable to display the values of my field properly. It is placed in a group header band in a text field that references the variable.

 

Variable expression: $F{type}==("type1")?"Manager":"Employee"

 

The problem is that the expression returns null in the first group, and then just Employee for the rest of the groups, even if the value should be Manager. As a test, if place the Variable down in the details section, that fixes the null problem, but then the ones tat should indicate Manger indicate Employee.

 

My band structure is as follows:

 

Title

Page Header

Column Header

My first group (hidden)

My second group header

My second group again header –my variable is placed here.

My third group (hidden)

Details section

And so on……

 

Help appreciated.

 

Thanks,

Frank

 

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Should usee ".equals()" rather than "==". You're probably getting null in the first group because you haven't provided default value and the variable is calculated after value of the field is calculated.

$F{type}.equals("type1")?"Manager":"Employee"

Link to comment
Share on other sites

Hello Hozawa, thanks I see the values being diplayed properly in the details section now with your syntax example, but when I move the variable field to the group header just above the details section, it doesn't work. You mentioned the defaults for the first group, but not sure I will always want to "hard-code" a default for the first iteratiion of group (if that is what you meant).

Also, when placed in the group header, Manger is displayed as Employee. So, Im thinking I need to learn how to use the evaluation time options avilable, but not sure the correct combination.

Any help appreciated.

Thanks,

Frank

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