cancel
Showing results for 
Search instead for 
Did you mean: 

exportResult

Former Member
0 Kudos

Hi Folks, I have the following code to Export into CSV file and it is all working fine, I just Need the last part where I can get the Content of the Media model and put it into CSV file, thanks for help

       FileInputStream stream = null;

     try
     {
         stream = new FileInputStream("C:/export.impex");
         int content;
         while ((content = stream.read()) != -1)
         {
             // convert to char and display it
             System.out.println((char) content);
         }
     }
     catch (final FileNotFoundException e2)
     {
         // YTODO Auto-generated catch block

         e2.getMessage();
     } // read your impex
            final ExportConfig exportConfig = new ExportConfig();
         exportConfig.setScript(new StreamBasedImpExResource(stream, "UTF-8"));
         final ExportResult exportResult = exportService.exportData(exportConfig);

         if (exportResult.isError())
         {
             throw new ImpExException("Error exporting CSV file");
         }
         final ImpExMediaModel mediaModel = exportResult.getExportedData();
         
         final CSVWriter writer = new CSVWriter(new File("C:\\outlook.csv"), "utf-8");

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos
                                                                                                                                                                                                        final ImpExMedia scriptmedia = ImpExManager.getInstance().createImpExMedia("test_mediaexportscript");
         scriptmedia.setFile(new File("C:/export.impex"));
         scriptmedia.setFieldSeparator(';');

         final ExportConfiguration config = new ExportConfiguration(scriptmedia, ImpExManager.getExportOnlyMode());
         final Exporter exporter = new Exporter(config);
         exporter.export();
Former Member
0 Kudos

I was able to solve it and Export success with the above code. using API only

Former Member
0 Kudos

the Content of export.impex file

"#% impex.setTargetFile( ""output.csv"" , true );" insert_update Buch;pk[unique=true];barcode;title "#% impex.exportItems( ""Buch"" , true);"

Answers (0)