mtassinari Posted January 11, 2013 Share Posted January 11, 2013 Hi everybody,I'm having a problem when exporting a report which has a quite complex expression in it.This reports reads a field named "fase_lavorativa" from the database, this field contains a text which is composed of a sequence of names, possibly repeated, separated by the string "n-----n".I am now trying to print the content of that field with the original separator replaced by ", " and with all duplicates removed, and I have come up with this expression: new HashSet<String>(Arrays.asList($F{fase_lavorativa}.split("n-----n"))).toString().replaceAll("^\[", "").replaceAll("\]$", "") This should produce a string as I want it, however I get this error: net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 1. Syntax error on token "<", ( expected value = new HashSet(Arrays.asList(((java.lang.String)field_fase_lavorativa.getValue()).split("n-----n"))).toString().replaceAll("^\[", "").replaceAll("\]$", ""); //$JR_EXPR_ID=10$ ^ 2. Syntax error, insert ")" to complete Expression value = new HashSet(Arrays.asList(((java.lang.String)field_fase_lavorativa.getValue()).split("n-----n"))).toString().replaceAll("^\[", "").replaceAll("\]$", ""); //$JR_EXPR_ID=10$ ^ 3. Syntax error on token "<", ( expected value = new HashSet(Arrays.asList(((java.lang.String)field_fase_lavorativa.getOldValue()).split("n-----n"))).toString().replaceAll("^\[", "").replaceAll("\]$", ""); //$JR_EXPR_ID=10$ ^ 4. Syntax error, insert ")" to complete Expression value = new HashSet(Arrays.asList(((java.lang.String)field_fase_lavorativa.getOldValue()).split("n-----n"))).toString().replaceAll("^\[", "").replaceAll("\]$", ""); //$JR_EXPR_ID=10$ ^ 5. Syntax error on token "<", ( expected value = new HashSet(Arrays.asList(((java.lang.String)field_fase_lavorativa.getValue()).split("n-----n"))).toString().replaceAll("^\[", "").replaceAll("\]$", ""); //$JR_EXPR_ID=10$ ^ 6. Syntax error, insert ")" to complete Expression value = new HashSet(Arrays.asList(((java.lang.String)field_fase_lavorativa.getValue()).split("n-----n"))).toString().replaceAll("^\[", "").replaceAll("\]$", ""); //$JR_EXPR_ID=10$ ^ 6 errors However the iReport designer, which I used to create the report, does not display any syntax problem in the expression.Could you please help me? Link to comment Share on other sites More sharing options...
Solution mtassinari Posted January 11, 2013 Author Solution Share Posted January 11, 2013 After some tinkering, I've found that the problem was in the creation of an HashSet<String>, using a simple HashSet instead solved the problem. 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