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...
kolja.ehlersiconplc.com Posted August 12, 2008 Author Share Posted August 12, 2008 sorry about the double post. please delete one of the threads. I guess I clicked twice on save Link to comment Share on other sites More sharing options...
kolja.ehlersiconplc.com Posted August 12, 2008 Author Share Posted August 12, 2008 meanwhile I have looked at some of the sample scripts and found out that in the webapp demo a function hello() is called from the jrxml file:((scriptlets.WebappScriptlet)$P{REPORT_SCRIPTLET}).hello()If this works for me the writer of the report could write out the functions getAttribute() and getValue()... in iReport and place them at the appropriate position and during reportfill those functions get actually called. Am I understanding this correctly? Thanks Link to comment Share on other sites More sharing options...
svenn Posted August 12, 2008 Share Posted August 12, 2008 I'm not clear on what your asking? If it's can you pass parameters values to the Oracle query in your report than the answer is yes.use $P{your value} or $P!{literal string} Link to comment Share on other sites More sharing options...
kolja.ehlersiconplc.com Posted August 13, 2008 Author Share Posted August 13, 2008 sorry if I was not making myself clear. Let me try again:I want to integrate reporting in our java application. Some of the report data will come from java functions (getAttribute(), getValue(), ...) which are not accessible in iReport when writing the report. When finally triggering to export the report in our java application, the report can access these functions.So I would like to know how I handle these functions in iReport. In other words: what do I tell the person who writes the reports to place where he normally calls the function getAttribute(String attr_id) to retrieve data. Maybe scriptlets are what I need? Thanks again Link to comment Share on other sites More sharing options...
kolja.ehlersiconplc.com Posted August 13, 2008 Author Share Posted August 13, 2008 I looked at scriptlets and I dont think this is what I need. I need to access my java obect "RECORD" in the reports. I guess the easiest way is to use "RECORD.getValue(par1, par2, par3..);" in ireport just like I do in my java app. But is this possible and how do I instantiate the object RECORD.I am clueless on where to search for a solution. I guess I have to look for a custom datasource but I cant find anything. Please helpThanks Link to comment Share on other sites More sharing options...
kolja.ehlersiconplc.com Posted August 13, 2008 Author Share Posted August 13, 2008 I am sorry for all the spamming but I am really having trouble to explain my problem. I would like to try it again. I want to use my Java Object “Record” as a datasource. But Record again is tied to an oracle database so there is nothing like structured data in this object. All samples and demos I have looked at access the Objects attributes itself for the data like in here:public class CustomBean{private String city = null;private Integer id = null;private String name = null;private String street = null;…In the report city and name and street is used as a data source but in my case the Object itself does not hold the data. It again gathers the data from the oracle database through various functions like: getAttribute(par1,para2…) and getValue(par1,para2…). I really hope this clarifies the problem. I need to actually dummy call these functions getAttribute(String attr_id) from iReport and then the fillReport process actually calls the “Record” Object functions to place in the real data. Has this been done before or is there any chance I can do this using JasperReports?Thanks Link to comment Share on other sites More sharing options...
kolja.ehlersiconplc.com Posted August 13, 2008 Author Share Posted August 13, 2008 Again I got a little bit futher but still problems remain. I am using JavaBeans as a datasource now. If I have a field called "test123" in my report the function getfield123() is called. This is half way to what I need. Like I explained before I need to call the function getValue(par1, par2) so is there any chance I can pass parameters to the get method? Thanks 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