I am trying to create a pdf using jasper soft studio 7.0.1 and java code which is using jasper report library 7.0.1. I want to use JsonQL data source but i am getting error in my java code.
JsonQLDataSource cannot be resolved to a type
It works when i use jasper report library versions below 7.0.0. Can someone suggest me the fix or any other way?
java code showing error
import net.sf.jasperreports.engine.data.JsonQLDataSource;
..
..
JsonQLDataSource datasource = new JsonQLDataSource(new FileInputStream(file));
...
In JasperReports 7.0, the JsonQLDataSource
class has been extracted to a separate jar called jasperreports-json. You'll need to add that jar as a dependency to your project.
The class has also been moved to a different package, you'll now need to use
import net.sf.jasperreports.json.data.JsonQLDataSource;
And
<dataSourceExpression><![CDATA[((net.sf.jasperreports.json.data.JsonQLDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("appJson.spouse")]]></dataSourceExpression>
Note that in the JRXML you can also use the SUB_DATA_SOURCE
builtin function:
<dataSourceExpression><![CDATA[SUB_DATA_SOURCE("appJson.spouse")]]></dataSourceExpression>