jasperNewb21 Posted January 15, 2013 Share Posted January 15, 2013 Up until now, I've been using a database connection to populate the data in my reports, which has worked well. Now I am struggling to get it working with a different type of input.Ultimately, my goal is to have a Java process which generates an array of values, which it then passes to Jasper to generate a chart in an XLS file. For example, I may pass in {[0,0],[1,1],[2,2],[3,3]} if I wanted Jasper to generate a straight line. Each time my Java process runs, the input data will be different, however the structure of the data will be the same. I am looking into how I can pass in the data using JSON, however I am not tied to that solution. What is the best way to acheive my goal? JSON? XML? A custom Java class?As a first step, I've tried to get the Northwind.Customers example to work. I created a new report in iReport that reads the northwind.json file and that works okay. However, when I try to call it from Java, no data populates. What am I doing wrong?JasperDesign jasperDesign = JRXmlLoader.load("path\to\designFile"); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); JsonDataSource jsonDataSource = new JsonDataSource(new File("path\to\northwind.json"));JasperPrint jasperPrintNew = JasperFillManager.fillReport(jasperReport, h2, jsonDataSource);Thank you Link to comment Share on other sites More sharing options...
rsteier Posted February 28, 2013 Share Posted February 28, 2013 Hi, did you ever find a solution to this? I am looking for one myself. Thanks! Link to comment Share on other sites More sharing options...
sindhu.sankaran Posted August 27, 2013 Share Posted August 27, 2013 Hi, I have a similar requirement. I am getting a JSON string from UI and I want to convert and use this as JSONDataSource. Can amyone please guide how this can be done? Link to comment Share on other sites More sharing options...
lipiden8 Posted May 29, 2014 Share Posted May 29, 2014 Hi I am a new bee to Jasper report. I have a similar requirement. I want to pass dynamic json to jasperreport, from a java class. Please provide any direction how this can be done? 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