0 Replies Latest reply: May 20, 2008 3:17 AM by 843844 RSS

    Export to CSV not working properly

    843844
      Hi folks,

      I have some problem while exporting the records to csv format.

      We are creating the exported file on the fly.

      My problem is while selecting some 9k records and exporting the file is downloaded and

      its contains only the headers part. The selected records is not included in the file content.

      below is my code:
      File userDataFile = new File("ReportExportedFile" + (Constants.EDCORE_DATE_MONTH_FORMAT_DOC_NAME.format(new Date()))+".csv");
      out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(userDataFile),"UNICODE"));
      out.write(getResourceMessage("prompt.id")+"\t");
      out.write(getResourceMessage("prompt.name")+"\t");
      out.write(getResourceMessage("prompt.ref.period")+"\t");
      out.write(getResourceMessage("prompt.flow")+"\n");
      // this is the headers 
      // writing the record to file on the fly
      if(retList != null && retList.size() != 0){
               Iterator iter = retList.iterator();
               while(iter.hasNext()){
                    Dto = (DTO)iter.next();
                    for(int i=0; i<declIDList.size(); i++){
                              out.write((Dto.getId()!=null?decDto.getRefPeriod():"")+"\t");
                              out.write((Dto.getName()!=null?decDto.getRefPeriod():"")+"\t");
                         out.write((Dto.getRefPeriod()!=null?decDto.getRefPeriod():"")+"\t");
                         out.write((Dto.getFlow()!=null?decDto.getFlow():"")+"\n");
                    }
               }
      }
      
      // this is not exact code its same as mine
      its working some times, some times is not working..

      please advice..

      any comments is very use full for me..

      Thanks in advance...