I want to get the value of a field to show based on whether the values of two other fields match. I wrote a text expression I thought might work but no luck yet.
Any ideas?
Here is the expression as it stands riight now.
It's not erroring out, it just doesn't bring back the desired value.
Thanks
Code: |
(($F{PARTTRACKINGID}== $F{TRACKINGTEXTTAGID})?"getValue($F{TRACKINGTEXTINFO})":"")</td></tr></tbody></table> |
6 Answers:
Hi,
I think you don't need getValue function. To compare the fields both have to be the same type. If these are integer type try setting this:
(($F{PARTTRACKINGID} == $F{TRACKINGTEXTTAGID})? $F{TRACKINGTEXTINFO}: "")
Otherwise, if they are string type you have to do a small modification:
(($F{PARTTRACKINGID}.equals($F{TRACKINGTEXTTAGID}))? $F{TRACKINGTEXTINFO}: "")
Hope this helps.
Regards.
Post Edited by augarte at 01/27/2012 14:56
Hi, thanks for the response.
What I would like to do is if ParttrackingID is equal to 5, I need it to print the value of TrackingTextInfo in the box.
That's were I'm really hung up.
I have several different sections of the report that need fulled, and ParttrackingID value is what dictates what goes in each one but the actual value I want shown is in the trackingtextinfo, if that makes sense.
Any suggestions?
Thanks and take care
Don't worry :-)
I guess PARTTRACKINGID is 'Java.lang.Integer' cause 'int' is not in the available types. So in this case I think this should work:
(($F{PARTTRACKINGID}.intValue() == 5)? $F{TRACKINGTEXTINFO}: "")
If you want to compare it with TRACKINGTEXTTAGID you should change to:
(($F{PARTTRACKINGID].intValue() == $F{TRACKINGTEXTTAGID}.intValue()) ? $F{TRACKINGTEXTINFO} : "")
Note that the field your are editing the expression has to be 'Java.lang.String' type.
Hope this helps.
Regards.
Anyways, thanks again :)