Jump to content
Changes to the Jaspersoft community edition download ×

Jasper Java Database


Kannan_S

Recommended Posts

i am new to jasper reports.

i have some how executed the sample jasper reports with ant tool as well as oracle jdeveloper's built-in ant tool.

now I have a problem. There is a message in database.

it has its own format with the details of a person encoded in it something like..

||John||&|124,2nd Street||

now the task is to decode the message and get the details of the person and to show it in jasper reports.

 

i know that i have to write a java program to decode it.

but how to show the details of the person in the jasper reports ?

 

its quite easy to just retrieve data from the database using the querystring tag in .jrxml. But this seems to be a little bit complex. Please help me

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi,

 

You have to write you custom JRDataSource implementation able to iterate through that formatted data that you have.

You could take a look at our build-in implementations of the JRDataSource interface and also at the supplied /demo/samples/datasource example inside the project distribution package.

 

I hope this helps.

Teodor

Link to comment
Share on other sites

hi teodor

its great to get a reply from the technical staff . thanks a lot.

 

while filling i am getting the following error

 

[java] java.lang.NoSuchMethodException: Unknown property 'ID'

 

Where ID is my field name and its of integer datatype.

 

i am adding the integer field as a string to an arraylist. this is the code which i made it in my customdatasource

Code:

public boolean next() throws JRException
{
index++;
return (index < arrList.size());
}

public Object getFieldValue(JRField field) throws JRException
{
Object value = null;

String fieldName = field.getName();

if ("ID".equals(fieldName))
{
value = arrList.get(index);
}
return value;
}

 

i have mentioned the field name in the jrxml file as ID.May i know where should i check to get the report..

Post edited by: Kannan_S, at: 2006/08/01 09:48

Link to comment
Share on other sites

hai Teodor,

this is my current error

1]

[java] java.lang.ClassCastException

[java] at TestRep_1154429063318_93061.evaluate(TestRep_1154429063318_93061:165)

[java] at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:172)

[java] at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:539)

[java] at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:507)

[java] at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:806)

[java] at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:357)

[java] at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:344)

[java] at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:277)

[java] at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:399)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1289)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:631)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:228)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128)

[java] at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:758)

[java] at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:685)

[java] at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:89)

[java] at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)

[java] at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:492)

[java] at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:448)

[java] at TestRep.main(TestRep.java:102)

 

[java] NESTED BY :

[java] java.lang.ClassCastException

[java] at TestRep_1154429063318_93061.evaluate(TestRep_1154429063318_93061:165)

[java] at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:172)

[java] at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:539)

[java] at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:507)

[java] at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:806)

[java] at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:357)

[java] at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:344)

[java] at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:277)

[java] at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:399)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1289)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:631)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:228)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128)

[java] at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:758)

[java] at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:685)

[java] at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:89)

[java] at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)

[java] at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:492)

[java] at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:448)

[java] at TestRep.main(TestRep.java:102)

 

[java] NESTED BY :

[java] net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :

[java] Source text : $F{ID}

[java] at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:183)

[java] at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:539)

[java] at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:507)

[java] at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:806)

[java] at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:357)

[java] at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:344)

[java] at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:277)

[java] at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:399)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1289)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:631)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:228)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128)

[java] at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:758)

[java] at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:685)

[java] at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:89)

[java] at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)

[java] at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:492)

[java] at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:448)

[java] at TestRep.main(TestRep.java:102)

[java] Caused by: java.lang.ClassCastException

[java] at TestRep_1154429063318_93061.evaluate(TestRep_1154429063318_93061:165)

[java] at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:172)

[java] ... 18 more

[java] Java Result: 1

Link to comment
Share on other sites

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