Jump to content
Changes to the Jaspersoft community edition download ×

Error when evaluating complex expression


mtassinari
Go to solution Solved by mtassinari,

Recommended Posts

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

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...