Jump to content

Column not found error


Recommended Posts

By: Wesley Ng - abrabra

Column not found error

2003-04-30 22:18

Hi, I am able to generate the report, but problem occured when I tried to add a new field to the subreport.

 

e.g. for my subreport previously I have a "Country" (String) filed, a "Count" field (Integer) and now I want to add a field name "Flag" (String).

After I modified my datasource, it keep prompting me an error as follow:

 

dori.jasper.engine.JRException: Unknown column name : Country

at dori.jasper.engine.data.JRTableModelDataSource.getFieldValue(JRTableM

odelDataSource.java:156)

at dori.jasper.engine.fill.JRBaseFiller.next(JRBaseFiller.java:711)

at dori.jasper.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.

java:158)

at dori.jasper.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:463)

at dori.jasper.engine.fill.JRFillSubreport.run(JRFillSubreport.java:384)

 

at java.lang.Thread.run(Thread.java:536)

13:08:16,056 ERROR [prisma] ReportManagerBean Unexpected exception while generat

e

dori.jasper.engine.JRException: Unknown column name : Country

at dori.jasper.engine.data.JRTableModelDataSource.getFieldValue(JRTableM

odelDataSource.java:156)

at dori.jasper.engine.fill.JRBaseFiller.next(JRBaseFiller.java:711)

at dori.jasper.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.

java:158)

at dori.jasper.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:463)

at dori.jasper.engine.fill.JRFillSubreport.run(JRFillSubreport.java:384)

 

and my datasource file contain something like this (perform well before I add the Flag column):

 

private String[] columnNames = {"Country","Count","Flag"};

private Object[][] data;

private int colCount = 3;

private int rowCount;

 

public String getColumnName(int columnIndex)

{

return this.columnNames[columnIndex];

}

 

public String getCountry(int columnIndex)

{

return this.data[0][columnIndex].toString();

}

 

 

public Integer getCount(int columnIndex)

{

return new Integer(this.data[1][columnIndex].toString());

}

 

public String getFlag(int columnIndex)

{

return this.data[2][columnIndex].toString();

}

 

public int getColumnCount()

{

return colCount;

}

public int getRowCount()

{

return this.data.length;

}

public Object getValueAt(int rowIndex, int columnIndex)

{

return this.data[rowIndex][columnIndex];

}

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