Jump to content
We've recently updated our Privacy Statement, available here ×

CsvDataSource Charts and SubReports


JMoralesGER

Recommended Posts

Hi everybody,

 

I have read the last year Posts and found, that my problem has an Answer, but it was never described.

 

Problem: I call a Chart and a SubReport from a main Report and I need to use three different CSV-Files, one for each of them.

 

Solution: I must give "iReport" the right DataSource Expressions for each.

 

Those Expressions are:

1) (net.sf.jasperreports.engine.data.JRCsvDataSource)$P{<Parameter Name>})

2) it.businesslogic.ireport.util.Misc.getConnection("<Connection Name>")

3) new JRCsvDataSource(new File($P{SUBREPORT_DIR} + "dataFile.csv"))

 

Please, let me know "which one where".

 

Many thanks,

 

Jorge

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Hi again,

 

I suppose, my question was not understood. I clear it!

 

I use iReport, not being a Java-Programmer. I need only to know, how to solve the following Problem:

 

1) I create a subReport (i.e. subReport.jrxml), containing only a Table (i.e. using the pageHeader and detail Bands), coming from a CsvDataSource (i.e. $P{SUBREPORT_DIR} + "tables.csv").

 

2) I use iReport to run it, making the connection (i.e. "csvTables") to that CsvDataSource. The "get fields from datasource" gives the right output and (i.e. with the active connection) the Table ist seen correctly onto the JRViewer. Till now, everything is running!

 

3) I create a mainReport (i.e. mainReport.jrxml, evrything on the same subdirectory) und I want to link the subReport, having another active connection (i.e. also to a csvDataSource, to be used on the mainReport). I put the subReport-call onto the summary Band and I set the "use an existing report" to the right "subReport.jrxml"-File. I click "Next", then I do not know any more, what should I type on the "Use a JRDataSource"-Field. That is the beginning of my Problem. Now, what should I do here and on the next Steps, to run this mainReport and subReport together?

 

4) I need also to create a Pie-Chart on the "title"-Band of the mainReport, using another CsvDataSource (i.e. csvChart.csv). How should I define the subDataSet and other Parameters, and so on?

 

Please understand, I have read all the Posts related with this Subject and I have not found any concrete procedure for these purposes.

 

I hoppe, I receive Help on this and I thank you for your effort to understand this question.

 

Many thanks in advance,

 

Jorge

Link to comment
Share on other sites

Hi again,

 

I suppose, my question was not understood. I clear it!

 

I use iReport, not being a Java-Programmer. I need only to know, how to solve the following Problem:

 

1) I create a subReport (i.e. subReport.jrxml), containing only a Table (i.e. using the pageHeader and detail Bands), coming from a CsvDataSource (i.e. $P{SUBREPORT_DIR} + "tables.csv").

 

2) I use iReport to run it, making the connection (i.e. "csvTables") to that CsvDataSource. The "get fields from datasource" gives the right output and (i.e. with the active connection) the Table ist seen correctly onto the JRViewer. Till now, everything is running!

 

3) I create a mainReport (i.e. mainReport.jrxml, evrything on the same subdirectory) und I want to link the subReport, having another active connection (i.e. also to a csvDataSource, to be used on the mainReport). I put the subReport-call onto the summary Band and I set the "use an existing report" to the right "subReport.jrxml"-File. I click "Next", then I do not know any more, what should I type on the "Use a JRDataSource"-Field. That is the beginning of my Problem. Now, what should I do here and on the next Steps, to run this mainReport and subReport together?

 

4) I need also to create a Pie-Chart on the "title"-Band of the mainReport, using another CsvDataSource (i.e. csvChart.csv). How should I define the subDataSet and other Parameters, and so on?

 

Please understand, I have read all the Posts related with this Subject and I have not found any concrete procedure for these purposes.

 

I hoppe, I receive Help on this and I thank you for your effort to understand this question.

 

Many thanks in advance,

 

Jorge

Link to comment
Share on other sites

Hi Jiulio,

 

please,let me close this Post by myself:

 

1) I do not know why the last one was repeated twice, as I click "submit" only one time.

 

2) I have found a still opened Feature Request (artf1526), which give me the response to my Questions.

 

3) I hoppe, somebody develops the solution for iReport, as soon as possible.

 

4) That solution would be sure used from lot of persons, who never received an answer.

 

5) If somebody could give us an intermediate solution for "no Java-Programmers", i.e. the code for the master- and sub-Reports (without using iReport to compile and run), would be very helpful for all of us.

 

6) The Subject "Subreport and Chart, using subDataset, with different DataSource than the Master" seems to be very important.

 

Many thanks in advance,

 

Jorge

Link to comment
Share on other sites

Hi Jorge,

 

I am pretty much in the same fix here. This is what I am doing:

 

1) Create a report, which will ultimately be my subreport, with a csv datasource as input.

2) Test it. It works fine with values displayed.

3) Create a blank main report with no connection or datasource.

4) Add a new subreport to this main file. While adding, say 'Select existing report' and point to subreport.jasper, which was created in Step 1.

5) The problem comes in the next step, when I have to choose the source from where data should be filled for the subreport. I gave new JRCsvDataSource(new File($P{SUBREPORT_DIR} + "dataFile.csv")) as the JRDataSource expression.

6) I run the report and nothing comes up.

7) Even worse, if I open my subreport from the main report (by right click on subreport object) and try to run it, it says 'no data'. That is strange because in Step 2 it did work.

 

What am I doing wrong? I can see a lot of demos and answers out there for creating subreports from database queries but none for csv files.

Link to comment
Share on other sites

  • 9 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...