Getting empty list when using data source expression: new net.sf.jasperreports.engine.data.JsonDataSource(new java.io.File("/tmp/sample.json"))

0
Hi all 
 
Nothing gets printed in list wlement when  expression is used: new net.sf.jasperreports.engine.data.JsonDataSource(new java.io.File("/tmp/sample.json"))
When I print $P{REPORT_DATA_SOURCE} (parameter from sub dataset) it shows that there is an object net.sf.jasperreports.engine.data.JsonDataSource@1fa6b77.
 
But everything prints fine when I change expression to $P{REPORT_DATA_SOURCE} and set up json file data source (same sample file) at iReport level.
 
Library on classpath:
 
/iReport-5.6.0/ireport/modules/ext/hsqldb-1.8.0-10.jar
/iReport-5.6.0/ireport/modules/ext/jasperreports-extensions-3.5.3.jar
/iReport-5.6.0/ireport/modules/ext/jasperreports-core-renderer.jar
/iReport-5.6.0/ireport/modules/ext/jasperreports-5.6.0.jar
 
Dataset definition:
 
<subDataset name="dataset1" uuid="aeb951f0-8555-40e6-a739-51e803412c7f">
<queryString language="json">
<![CDATA[Northwind.Customers]]>
</queryString>
<field name="Phone" class="java.lang.String"/>
<field name="City" class="java.lang.String"/>
</subDataset>
 
Here is whole band:
 
<columnHeader>
<band height="123" splitType="Stretch">
<componentElement>
<reportElement x="0" y="23" width="555" height="64" isPrintWhenDetailOverflows="true" uuid="9615d3e4-35d1-44bd-ba9c-846de8e5825b"/>
<datasetRun subDataset="dataset1" uuid="f886f023-adf2-4eb9-be9f-adeb9eecb40a">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JsonDataSource(new java.io.File("/tmp/sample.json"))]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="64" width="555">
<textField>
<reportElement x="0" y="0" width="100" height="20" uuid="845a256e-3caf-4d47-b02e-67e676601e3b"/>
<textFieldExpression><![CDATA[$F{Phone}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="121" y="0" width="100" height="20" uuid="bf22dfa3-d1dc-4d51-9841-a8cb035a9f9b"/>
<textFieldExpression><![CDATA[$F{City}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="95" y="36" width="291" height="20" uuid="7c84a810-02dc-4fc2-b164-49985ba9ac54"/>
<textFieldExpression><![CDATA[""+$P{REPORT_DATA_SOURCE}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
</band>
</columnHeader>
 
 
sample file looks like this:
koszycki.wojciech's picture
Joined: Jun 6 2014 - 12:48am
Last seen: 4 years 1 month ago

0 Answers:

No answers yet
Feedback
randomness