Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how do i join two different tables in a jasper report

843844Aug 15 2008 — edited Aug 15 2008
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 12 2008
Added on Aug 15 2008
0 comments
825 views