Variable Issue

0
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
frank.py's picture
Joined: May 25 2016 - 12:32pm
Last seen: 3 years 2 months ago

3 Answers:

1

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"

hozawa's picture
56332
Joined: Apr 24 2010 - 4:31pm
Last seen: 7 months 2 weeks ago
0

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

frank.py's picture
Joined: May 25 2016 - 12:32pm
Last seen: 3 years 2 months ago
0

Sorry, I was able to use Evaluation Time property and set it to group I wanted and it works fine. Thanks!

frank.py's picture
Joined: May 25 2016 - 12:32pm
Last seen: 3 years 2 months ago
Feedback