In my program I am sending SQL query Dynamic to my report (Jasper Reports) ,But the problem the sql query dynamic work just in main DataSet for report , don't work in sub DataSet for table or list in jasper Report:
Is there a way to make the sql query Dynamic this send from java working in sub DataSet for table or list ?
this my code that Contain the sql query Dynmic that send to my report (jasper reports ) it's working just in Main DataSet .
try {
String date1="2017-07-23";
String date2="2017-07-27";
Connection con=dbcontt.getconction();
String sql="SELECT `name_hazj`, `sex_hazj`, `age_hazj`, `id_card_hazj`, `date_hazj` FROM `sike_hajaz_list` WHERE `date_hazj` BETWEEN '"+date1+"' AND '"+date2+"' ORDER by date_hazj";
JasperDesign jd=JRXmlLoader.load("bin/report/hajz_between_2.jrxml");
JRDesignQuery newQuery=new JRDesignQuery();
newQuery.setText(sql);
jd.setQuery(newQuery);
JasperReport js;
js=JasperCompileManager.compileReport(jd);
JasperPrint jasperPrint=JasperFillManager.fillReport(js, null,con);
JasperViewer.viewReport(jasperPrint,false);
} catch (JRException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}