imams Posted May 16, 2008 Share Posted May 16, 2008 Hi, I exported the report data in the CSV format and then tried to open that. However, I find that there is column shift. This means the data is not displayed under proper coulmn names. Can this be avoided? Please help. Link to comment Share on other sites More sharing options...
lucianc Posted May 16, 2008 Share Posted May 16, 2008 If you haven't already, make sure that you read this FAQ. If your report complies with the recommendations and you use JR 2.0.0 - 2.0.5, the incorrect output might be caused by a bug that affects CSV exporting in these versions (and that was fixed after the 2.0.5 release). You could try to build JR from the SVN trunk, and see whether the issue is fixed. Regards,Lucian Link to comment Share on other sites More sharing options...
slaguduv Posted May 26, 2008 Share Posted May 26, 2008 Hi Lucian, I too face the same issue while exporting the reports to csv format. I gone through the FAQ you have mentioned and rearranged the elements of the report according to that. But still am facing the issue with lot of commas between the two values. I am attaching the .jrxml file and csv output of that report in zip format. Please suggest me a solution. [file name=samplereps.zip size=1990] Link to comment Share on other sites More sharing options...
lucianc Posted May 27, 2008 Share Posted May 27, 2008 slaguduv wrote:I am attaching the .jrxml file and csv output of that report in zip format. Please suggest me a solution. I don't understand how the JRXML that you've attached could produce (by its own) the CSV output. The CSV contains text/labels like "Health and Utilization Monitor" that are not present in the JRXML. Are you using this JRXML as a subreport? If so, please attach the master JRXML as well. Regards,Lucian Link to comment Share on other sites More sharing options...
slaguduv Posted May 27, 2008 Share Posted May 27, 2008 Hi Lucian, That header is from a jsp file. So,it won't be present in the jrxml file. Attached jrxml is the subreport only. Hope this gives the answer. Link to comment Share on other sites More sharing options...
lucianc Posted May 27, 2008 Share Posted May 27, 2008 I'm even more confused now. How does the header "from a jsp file" shows up in the JasperReports CSV export? Are you passing it as a parameter to the report? And if the JRMXL is the subreport only, could you post the master JRXML as well as I've asked in my previous message? Regards,Lucian Link to comment Share on other sites More sharing options...
slaguduv Posted May 28, 2008 Share Posted May 28, 2008 Hi Lucian, We are calling the reports dynamically from a jsp file which have been already generated and kept in a folder. I am attaching the Master.jrxml file which contains three subreports. In that one of the subreport only I have given already for your reference. Expecting your suggestion on this. Regards, slaguduv. [file name=Master.jrxml size=7280] Link to comment Share on other sites More sharing options...
lucianc Posted May 29, 2008 Share Posted May 29, 2008 Since you have multiple subreports, make sure you align elements (as described in the FAQ) across subreports. The FAQ only describes what needs to be done for a single report, but since subreport elements end up in the same filled report, you'll have to pay attention whether elements from different subreports are aligned in the master report. Also note that JR 2.0.0 to 2.0.5 releases suffer from a bug that affects CSV exporting in certain cases. If you use such a JR version, you could try to upgrade to 3.0.0 and see whether that makes any difference. Regards,Lucian Link to comment Share on other sites More sharing options...
slaguduv Posted May 29, 2008 Share Posted May 29, 2008 Hi Lucian, I'm not getting this point "have to pay attention whether elements from different subreports are aligned in the master report". In the master report, we are calling the subreports and in that only it contains the elements. So, how to see that elements from subreport are aligned in the master report ? Could you please explain more on these which will help in debugging the issue. For your information , I have upgraded to the jasper 3.0.0 version. But still I could see no change in the reports. Thanks,Slaguduv. Link to comment Share on other sites More sharing options...
lucianc Posted May 29, 2008 Share Posted May 29, 2008 When you have subreports in a master report, the generated/filled document contains elements from the subreports along with elements from the master report. This document is then exported to CSV and other formats, so if you want to have a properly formatted CSV export you will need to make sure that all the elements in the filled document (including the ones coming from different subreports) are properly aligned. So, for instance, if you have an element in a subreport at x=20, and an element from another subreport at x=30 (and the subreport elements in the master report have the same position on the x axis), the two elements will not be exported on the same column in CSV because they will not be aligned at the same x position in the generated/filled document. Regards,Lucian Link to comment Share on other sites More sharing options...
slaguduv Posted May 29, 2008 Share Posted May 29, 2008 Hi Lucian, My question is in the same subreport itself, I could see lot of commas in between two elements. eg: Generation Time:,,,,"Thu, May 29 2008, 11:20 IST",,,,,,,,,,,Start Time:,,,,"Wed, May 28 2008, 11:19 IST",,,,,,,,,,,End Time:,,,,"Thu, May 29 2008, 11:19 IST",,,,,,,,,,, In the above e.g. , elements are all present in the same subreport only. You can check that subreport which I have attached initially. Link to comment Share on other sites More sharing options...
lucianc Posted May 29, 2008 Share Posted May 29, 2008 Elements coming from a specific subreport are not exported separately, but along with the rest of the elements in the filled report. Elements coming from other subreports can introduce breaks in fille report layout, and this can result in CSV columns. Subreports are relevant at report fill time only. When a filled report is exported to CSV or any other format, it makes no difference whether some elements came from a subreport or not. The layout of the filled report (containing elements from the master report and all subreport) is the only thing that matters at export time. Regards,Lucian Link to comment Share on other sites More sharing options...
slaguduv Posted June 3, 2008 Share Posted June 3, 2008 Hi Lucian, Thanks for the information, will check the other subreports as you said. regards,slaguduv. 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