Jump to content
Changes to the Jaspersoft community edition download ×

ireport without using database connection


2005 IR Help

Recommended Posts

By: Bikkina - saradabikkina

ireport without using database connection

2005-06-23 23:35

Hi,i require an ireport which has to take data dynamically and which does not use any data base connectivity.how can i do that?can any one please help me out with this.its very urgent

 

Thanking you

sarada

 

 

 

 

By: inmadgm - inmadgm

RE: ireport without using database connection

2005-06-24 02:04

Hello, I have the same problem.

I have the following code:

 

Object available_data[]={matri_stock,n_refer,proced,p_compra,

tip_iva,prev_rea,c_total,p_venta,f_compra,sed,f_matric,tot_vehic};

JList myList = new JList(available_data);

MyDataSource dataSource = new MyDataSource(myList);

 

JasperPrint reporte = JasperFillManager.fillReport("C:\Documents and Settings\Innova Telecom\Mis documentos\SRC\Propios\Inma\TStock.jasper", parameters,dataSource);

 

JasperViewer.viewReport(reporte,false);

 

The MyDataSource class:

 

package listados_tecsa;

import net.sf.jasperreports.engine.JRDataSource;

import net.sf.jasperreports.engine.JRException;

import net.sf.jasperreports.engine.JRField;

import java.util.Vector;

 

 

 

public class MyDataSource implements JRDataSource {

private Object[][] data; // data source structure

private int index = -1; // current record index

 

public MyDataSource(javax.swing.JList myList) {

 

int numero_colonne=myList.getModel().getSize();

Object obj=myList.getModel().getElementAt(0);

Vector ve=(Vector)obj;

int numero_righe=ve.size();

data = new Object[numero_righe][numero_colonne];

 

for(int x=0;x<numero_colonne;x++){//0 al 12

Object ob=myList.getModel().getElementAt(x);

Vector v=(Vector)ob;

for(int y=0;y<numero_righe;y++){

if(v.size()==7){

data[y][x] = v.elementAt(y);

}else{

data[y][x]="";

}

}

}

 

 

}

 

// called in net.sf.jasperreports.engine.fill package from JRBaseFiller.next() method

// to make certain further data exist

public boolean next() throws JRException {

index++;

 

return (index < data.length);

}

 

// called in net.sf.jasperreports.engine.fill package from JRBaseFiller.next() method

// to get the right field value by means of column name an current record index

public Object getFieldValue(JRField field) throws JRException {

Object value = null;

 

String fieldName = field.getName();

 

if ("MATR̓ULA".equals(fieldName)) {

value = data[index][0];

}

else if ("N? REF. ART.".equals(fieldName)) {

value = data[index][1];

}

else if ("PROCEDENCIA".equals(fieldName)) {

value = data[index][2];

}

else if ("PRECIO COMPRA".equals(fieldName)) {

value = data[index][3];

}

else if ("TIPO IVA".equals(fieldName)) {

value = data[index][4];

}

else if ("PREV. REACOND.".equals(fieldName)) {

value = data[index][5];

}

else if ("COSTO TOTAL".equals(fieldName)) {

value = data[index][6];

}

else if ("PRECIO VENTA".equals(fieldName)) {

value = data[index][7];

}

else if ("FECHA COMPRA".equals(fieldName)) {

value = data[index][8];

}

else if ("SEDE".equals(fieldName)) {

value = data[index][9];

}

else if ("FECHA 1? MATRIC.".equals(fieldName)) {

value = data[index][10];

}

else if ("N? TOTAL VEH̓ULO".equals(fieldName)) {

value = data[index][11];

}

 

 

 

 

return value;

}

 

} // end of class

 

how I must design the report in iReport? Custom Datasource?

how would be the parameter "Map parameters" that I must pass to the method fillReport?

 

Thanks!!

 

 

 

 

 

By: ksm - siromani

how to generate report from csv file

2005-06-24 02:24

hi

i am using ireports 0.4.0 for generating reports.upto now i used oracle data base. but now i need to generate report from csv file(text). i created file csv data source.but when i select the csv file in report query menu i am getting problem.when i click on read atribute button i am getting class not found exception.

so where i need to put the csv file.please tell me the detail procedure for generate report .

thanks & regards

ksm

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