DavidT_UK Posted December 13, 2017 Share Posted December 13, 2017 Hello,I've got a report that when run outputs a number 1 (it's a string field) but I need it to actually display as 'INV' (the 1 means invoice in the application). I'm fairly new to Jasper Studio so I'm having trouble on what I suspect is a very easy variable.Can anyone help? I've tried looking for it but everything being posted is overly complicated and much more than i need.Thanks. Link to comment Share on other sites More sharing options...
Duggu09 Posted December 14, 2017 Share Posted December 14, 2017 HiIf your output '1' is from a field then you can use the Jasper if-else expression. Below is the exampleEx: $F{FieldName}.equals("1") ? "INV" : $F{FieldName} You can provide anything in else statement as per your requirement. Thanks! Link to comment Share on other sites More sharing options...
DavidT_UK Posted December 15, 2017 Author Share Posted December 15, 2017 Thanks Duggu, that is perfect! Much appreciated. Link to comment Share on other sites More sharing options...
sanbez Posted December 15, 2017 Share Posted December 15, 2017 Duggu09's answer is great.A small correction:UseEx: "1".equals($F{FieldName}) ? "INV" : $F{FieldName} to avoid a potentional NullPointerException Link to comment Share on other sites More sharing options...
DavidT_UK Posted December 18, 2017 Author Share Posted December 18, 2017 Thanks everyone, that's sorted the issues I was having and it's looking fine now :D 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