Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7043155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:15:17+00:00 2026-05-28T02:15:17+00:00

I discovered today in iReport that I cannot set the initial value expression of

  • 0

I discovered today in iReport that I cannot set the initial value expression of a String[] using normally valid Java syntax, such as:

private String[] fruitNames = new String[] {"Apple", "Banana"};

Extrapolating this into an iReport variable would be something as simple as this (I would think):

Name: fruitNames

VariableClass: java.lang.String[]

Calculation: Nothing

Reset Type: Report

IncrementType: None

Initial Value Expression: new String[]{“Apple”, “Banana”}

Compiling my report template I get an error:

Compilation exceptions: com.jaspersoft.ireport.designer.compiler.ErrorsCollector@683896bd >net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions c>lass file: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: >calculator_Fruits_1326149102402_537017: 281: unexpected token: Apple @ line 281, column 55. >1 error

In the code editor for setting the initial value I notice that the parser underlines, in red, the curly braces {}. This makes sense because iReport interprets these braces as param, field, or variable identifiers. So I see where the conflict can exist, but does anyone know the proper syntax to use for initializing String[] in the Initial Value Expression field?

Note: I got around the issue by just setting the value in a Scriptlet, but I’m really curious to know the proper syntax, if it exists.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:15:17+00:00Added an answer on May 28, 2026 at 2:15 am

    You should be able to get what you need by setting your variable class to java.util.Collection. Then set the initial value like this:

    java.util.Arrays.asList( "Apple", "Banana" )
    

    Also, your error indicates that your report language is set to Groovy. That’s fine if it’s intentional, but perhaps it’s accidental. I find things are simplified by changing the report language to Java.

    I don’t normally set the variable class to an array like that. I set it to java.util.Collection as mentioned above. But I don’t know if there is any important difference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Today, I discovered that using Collections.synchronizedXXX doesn't play well with reflection. Here's a simple
So today I discovered that c# passes reference types by value by default. This
Today I discovered that my fresh installation of Apache HTTP Server is able to
Today I discovered something that makes me sad: objects of type System.Generic.Collections.List don't have
I discovered today that I can switch back to a branch even after I
So we went to implement something today, and discovered that there already is several
I discovered(*) today that, depending on the server, my TSQL commands were case-sensitive, meaning
I am not particularly new to C/C++ but today I discovered some things that
I was reviewing the logs for my companies servers today and I discovered that
Today I discovered that something I had assumed about VB.NET for many years was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.