i am currently creating a report which will get data from two different tables. But the problem is that i couldnt get that working. When i do just one table it works fine but not two.
below i have included code for two tables.
Map fillParams = new HashMap();
try {
String sSaveSQL = getSessionBean1().getPoheaderRowSet1().getCommand();
RowKey ask = tableRowGroup1.getRowKey();
poheaderDataProvider.setCursorRow(ask);
getSessionBean1().getPoheaderRowSet1().setCommand("SELECT poheader.`createdby` AS poheader_createdby, " +
" poheader.`approvedby` AS poheader_approvedby, "+
" poheader.`dateofcreation` AS poheader_dateofcreation "+
" FROM `poheader` poheader where poheader.`id`="+poheaderDataProvider.getValue("id")+
" ORDER BY poheader.`id`");
getSessionBean1().getPoheaderRowSet1().setCommand("SELECT users.`username` AS users_username, " +
" users.`password` AS users_password "+
" FROM `users` users where users.`id`=2"+
" ORDER BY users.`id`");
getSessionBean1().getPoheaderRowSet1().execute();
getApplicationBean1().jasperReport("test", "application/pdf",
getSessionBean1().getPoheaderRowSet1(), fillParams);
getSessionBean1().getPoheaderRowSet1().setCommand(sSaveSQL);
} catch (Exception e) {
txtRESULT.setText("Exception generating report: " + e);
}
can some one tell me how i could use two different tables together.
Thank you in advance