Jump to content
Changes to the Jaspersoft community edition download ×

need help(parameter not able to pick string array)


Recommended Posts

Hi Friends,

u may find me too impatient but I can't wait for too long.


actually I tried to put a string array against a single key in hashmap.

now wat I think is Parameter field named "homephone"

is not able to populate the string array values agaist this single key.


I tried to check whether against that key string array values are there or not.

My code is printing those values against that key.


But now Problemm is Ireport is not filling up those string values against a that key in my Parameter field defined .


I defined a field named $P{homephone},drag this field in details section so that runtime values from database can be filled in.


here is my code where i tried to pick homephonenos of all the persons whose name is "amber".

Most important thing is in database

homePhone field is of type char[10]


so I declred my parameter homephone as of type java.lang.String


and in java code I tried to make a arraylist then converted that arraylist into string array.

and then called the HASHMAP's put(key,value) method

see the code below.

I have slightly modified the code so don't check for prepared statemnets.



Map hmap=new HashMap();

String cb1 = req.getParameter("homeinfo");



PreparedStatement stmt = jdbcConnection.prepareStatement("select firstName, homePhone from person where firstName = 'amber'");


ResultSet rs = stmt.executeQuery();

ArrayList names = new ArrayList();

while (rs.next()) {




Object ia[] = names.toArray();

int len=ia.length;

String[] s1=new String[len];

for(int i=0;i<len-1;i++)


s1= ia.toString();





//problem is here only I think so




but when i tried this I am getting all the values against homephone key

String[] strings = (String []) hphones.get("homephone");


out.println("length of string array is"+strings.length);

for(int i=0;i<strings.length;i++)


//strings= ia.toString();



out.println("value of string "+i +"is"+strings);



but when this servlet code tries to fill the values in parameter fields defined it is showing error like

Could not create the report Incompatible [Ljava.lang.String; value assigned to parameter homephone in the ctisreport1 dataset. Incompatible [Ljava.lang.String; value assigned to parameter homephone in the ctisreport1 dataset.


so for reference I am attaching jrxml code also.


I wish One must have understand my problem.

Hope to get the soln very soon

[file name=ctisreport1-03818669ee2bcad10ef67e95550ff804.jrxml size=22811]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/ctisreport1-03818669ee2bcad10ef67e95550ff804.jrxml[/file]

Post edited by: neetikamittal, at: 2006/09/06 06:17

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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...