Jump to content
We've recently updated our Privacy Statement, available here ×

jasper doesn't call a getFieldValue when I call a JasperFillManager.fillReport


neosanghu

Recommended Posts

Hello.

 

My reports has a title band and detail band.

Title band have a information of report.

Detail band have a list of detail information.

 

I want fill a title band and detail band using Map object and CustomDataSource object.

more detaily, I want fill a title band using a Map object.

and I want fill a detail band using a CustomDataSource.

But jasper doesn't call my getFieldValue method when jasper makes a *.jsprnt.

 

I tried 2 cases.

It works well.

first is only use a Map object without a custom data source object as bellow.

>> Map map = new HashMap();

>> map.put("field1", "value1");

>> JasperReport jasperReport = JasperCompileManager.compileReport("test.jxml");

>>JasperFillManager.fillReport(jasperReport, map, new JRDataSource());

 

second is only use a TableModelDataSource object.

>>List<?> list = getDataFromOracle("SELECT ...");

>>MyTableModelDataSource ds = new MyTableModelDataSource(list);

>>JasperFillManager.fillReport(jasperReport, new HashMap(), ds);

 

finally I tried test using Map object and CustomDataSource object.

but detail band is empty when I open a *.xlsx file.

I had debuged what map object have a REPORT_DATA_SOURCE or not.

result is it have a REPORT_DATA_SOURCE.

bellow is code.

>>Map map = new HashMap();

>>map.put("filed1", "value");

>>List<?> list = getDataFromOracle("SELECT name FROM...");

>>JasperFillManager.fillReport(jasperReport, map, new CustomDataSource(list));

 

I want check a my expression of text field by another people.

I used as bellow at first.

>><field name="name" class="java.lang.String"/>

>><detail><band height="15">

>><textField isStretchWithOverflow="true" isBlankWenNull="true">

>><textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>

>></textField>

but it doesn't work. so I changed as bellow but it has a same result.

>><textFieldExpression><![CDATA[$P{REPORT_DATA_SOURCE}.getFieldValue("name").toString()]]></textFieldExpression>

 

what do I edit on my jrxml.

p.s. on my case, jasper doesn't call both getFieldValue and next method.

 



Post Edited by neosanghu at 07/30/2012 04:31



Post Edited by neosanghu at 07/30/2012 04:51
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...