viking79 Posted January 27, 2012 Share Posted January 27, 2012 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. ThanksCode:(($F{PARTTRACKINGID}== $F{TRACKINGTEXTTAGID})?"getValue($F{TRACKINGTEXTINFO})":"") Link to comment Share on other sites More sharing options...
augarte Posted January 27, 2012 Share Posted January 27, 2012 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 More sharing options...
viking79 Posted January 27, 2012 Author Share Posted January 27, 2012 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 More sharing options...
augarte Posted January 27, 2012 Share Posted January 27, 2012 And which is the type of your fields? This is very important when writing expressions Link to comment Share on other sites More sharing options...
viking79 Posted January 27, 2012 Author Share Posted January 27, 2012 Parttrackingid is intTrackingtextinfo is varcharSorry about that, probably should have mentioned that/tools/fckeditor/editor/images/smiley/msn/regular_smile.gifPost Edited by viking79 at 01/27/2012 15:38 Link to comment Share on other sites More sharing options...
augarte Posted January 27, 2012 Share Posted January 27, 2012 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 More sharing options...
viking79 Posted January 27, 2012 Author Share Posted January 27, 2012 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now