brossow Posted June 1, 2016 Share Posted June 1, 2016 I am working on a report (using iReport Designer v.5.6.0) where I need to read the value of a key from a properties file (i.e. a resource) and replace certain strings within it with actual field values. For example, if the following string is the resource value:Thank you for your request for a QUOTE_TYPE quote for a new whirlygig.I need to replace QUOTE_TYPE with the actual value of the field $F{Quote_Type}, so for example the output would be like this:Thank you for your request for a budgetary quote for a new whirlygig.I have tried the folllowing (and variations thereof) in the text field expression, but it only returns null:$R{cover.letter.body.html}.replace("QUOTE_TYPE", $F{Quote_Type})If I remove the '.replace....' portion of the expression, the string is read in and displays as expected, so it's not a matter of me messing up the resource. If I replace the field $F{Quote_Type} with "TEST" it replaces the text in question appropriately, but I need to show the field value. Suggestions? Am I missing something obvious? Ultimately there are a couple more strings in the same resource that I'll also need to replace, but I want to get one working first. Clearly this is not my area of expertise. Thanks in advance! Link to comment Share on other sites More sharing options...
Solution brossow Posted June 1, 2016 Author Solution Share Posted June 1, 2016 *sigh* As my luck usually goes, after giving up and posting the question, I've solved my own problem. The particular data I was testing against wasn't populating the Quote_Type field correctly. Once the field was populated, the .replace function works exactly as expected. Never mind.... 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