tom_45 Posted October 14, 2018 Share Posted October 14, 2018 Hi, I have an excel file that contains a few columns with article descriptions like short_title_NL,short_title_EN, short_title_DEI want to generate a report in the language that a user has chosen via a prompted parameter.e.g. the user types in NL for the variable Language, and the chosen column to display in the report would be the description in dutch, so the field short_title_NL would have to be printed.I've tried to create a text field like this:$F{"short_title_" + P{Language}} in the hope that it would evaluate to $F{short_title_NL}But I get the error 'Field not found: "short_title_" + P{Language --- net.sf.jasperreports.engine.design.JRDesignExpression Can someone point me in the right direction? Please bear in mind that this is an excel file.Thanks,Tom Link to comment Share on other sites More sharing options...
hozawa Posted October 14, 2018 Share Posted October 14, 2018 That won't work. You'll need to make it into 2 separate parameters and combine them in the sql clause to retrieve the data.If the field is static, you may want to investigate on using resource bundle.http://zetcode.com/articles/jasperresourcebundle/ Link to comment Share on other sites More sharing options...
tom_45 Posted October 15, 2018 Author Share Posted October 15, 2018 Hi, Thanks I don't know if this would work with excel (can't use sql).But I got the same result using this in the expression editor: ( $P{taal}.equals("NL") ? $F{short_title-nl_BE} + " " + ($F{baseline-nl_BE}!=null?$F{baseline-nl_BE}:"") :( $P{taal}.equals("FR") ? $F{short_title-fr_FR} + " " + ($F{baseline-fr_FR}!=null?$F{baseline-fr_FR}:"") :( $P{taal}.equals("DE") ? $F{short_title-de_DE} + " " + ($F{baseline-de_DE}!=null?$F{baseline-de_DE}:"") : $F{short_title-en_US} + " " + ($F{baseline-en_US}!=null?$F{baseline-en_US}:"")))) 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