Jump to content
We've recently updated our Privacy Statement, available here ×

text expression question..


viking79

Recommended Posts

 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})":"")
Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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
Link to comment
Share on other sites

 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

 

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

Hey thanks for all your help, still not getting the info we need, but I think is has to do with how we are trying to join the tables, rather than the text expression. I think once we figure that out, I can use some of the ideas you had to get the text boxes to fill out.

 

Anyways, thanks again :)

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