2001 JI Open Discussion Posted August 29, 2006 Share Posted August 29, 2006 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:38i'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{ index++; 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. Bye. By: Giulio Toffoli - gt78 RE: multi value parameter 2003-03-14 11:23Jasperreports 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. Giulio 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