Jump to content
Changes to the Jaspersoft community edition download ×

multi value parameter

Recommended Posts

By: Betuca Buril - betuca

multi value parameter

2003-03-13 13:20


Hello people!


I was trying to use Jasper with Ireport and i ve got some questions. When i use a database connection with a SQL select it works realy fine. I used a field on the IReport toll ($F{field_name}). In another java class i needed to use a list of parameters, but i cant make it work. Does anyone knows how can i put on the report an Array( collection, list, ...) on a parameter?


Thanks for your help.



By: juan david vergara perez - jvergara

RE: multi value parameter

2003-03-14 06:38

i've got a question for you.


do you need to have at the same time the ResultSet(database connection, sql String, etc) and the colection , listo array etc... ???


if the answer is not, you can implements the JRDataSoruce based on the array, list or collection.

I have an example of implementation based on an array


public class VectorDataSource implements JRDataSource{

private Vector data;

private int index;


public VectorDataSource(Vector data){

this.data = data;

this.index = -1;



public boolean next() throws JRException{


return (index < data.size());



public Object getFieldValue(JRField jrfield) throws JRException{

return data.elementAt(index);




if the answer is "yes". I don't know what to do.





By: Giulio Toffoli - gt78

RE: multi value parameter

2003-03-14 11:23

Jasperreports don't take as input a ResultSet (that is ever the result of a sql query), but a more general abstract class called JRDataSource (I don't remember if it is an interface or an abstract class, but for us nothing changes...). One of the most common JRDataSource used is the JRResultSetDatasource... but you can write your custom JRDataSource (an example is the class of juan david vergara perez), a datasource that is produced by an object array.



Link to comment
Share on other sites

  • Replies 0
  • 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...