kolja.ehlersiconplc.com Posted August 12, 2008 Share Posted August 12, 2008 Hi everybody,I am a JasperReports beginner and we are trying to find a suitable solutionto integrate Business Intelligence (reporting) to our own software. I amhaving some trouble on how to interact with the actual data coming from aoracle database as well as from a java object “Record” (getAttribute(...),getValue(...)). Maybe you can comment if the desired scenario is possibleusing jasperreports.Person A writes a report with probably ireport. In ireport he/she can accessthe oracle database and write the report with the actual data BUT he/shecannot access the java object. Since the java object is not accessible is itpossible to just place dummy parameters which are filled in later?If this works, the person who wrote the report then compiles the reports anddeploys it to a tomcat instance. After triggering to read/export the reportin our application the parameters will be filled in with the actual datafrom the database and the java object and the reports is shown.I guess this is the desired sequence:Person writes report and saves jrxmlcompileReport compiles the jrxml to .jasper.jasper is deployed on our production serverif the report is started in our web application fillReport is called andthen the desired export function is calledIf this scenario is possible do you have any comments? I still would have tofind a way from the parameters representing the java functions from the javaobject record and place all data in a hash map, right?Thanks a lotRegardske Link to comment Share on other sites More sharing options...
amodg Posted August 14, 2008 Share Posted August 14, 2008 Hello,You can use a class called JRCVSDataSource in order to use a java object as a data.Here,we can create the list of the java objects(say,Data Object) & pass this in the constructor of the above class.The variable names present in java object are matched with that of field names.Hope this helps. Link to comment Share on other sites More sharing options...
kolja.ehlersiconplc.com Posted August 14, 2008 Author Share Posted August 14, 2008 I have solved this problem now by using a _THIS reference to my javabean. Now I can call any function in that bean with any kind of parameter. This is how I am referencing it:""+((myBean)$F{_THIS}).getValue("mykey")I am not sure why iReport needs <""+> in the very front, but without it does not work. _THIS is from type object. Does objects need ""+ maybe I dont know?thanks Link to comment Share on other sites More sharing options...
amodg Posted August 19, 2008 Share Posted August 19, 2008 ok, its good to hear that you got that working.You may need to look at the jrxml file that is being generated.You will find that there will be a element assoicated with the each field like this....(1)<field name="FIELD_NAME" class="java.lang.String"/>& then you will need to check the type of data(2) coming out of your bean.There might be a mismatch of class type between (1) and (2).So, you were forced to use " " this in order to match the class ("String" in your case) types.Thanks Link to comment Share on other sites More sharing options...
kolja.ehlersiconplc.com Posted August 19, 2008 Author Share Posted August 19, 2008 Great, thanks amod g I had en error there, my function returned an object and the value was linked to a String field, so its all working perfeclty now. Thanks again Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now