CSV format

Hey guys, I'd like to be able to use data from a CSV file to draw some pretty graphs, whats going to be the best way to get the data into Java? I'd like it to be stored in some sort of data structure whilst the program is being run. Since its all come from a database at some point or another, is their some way of chucking it into a ResultSet? Or am I better off using a String [ ][ ] array? I want to make it is a easy as possible to add or remove entries to the Data Set and if i'm not mistaken, array's are notoriously bad at this. Does this leave me with a Vector with each element consisting of a Vector of values?? Whats the best way to progress? I only have a week to crack this and I don't want to start down a path that's going to lead to a dead end! Damn this craze for extreme programming! Any ideas or pointers in the right direction would be greatly appreciated.
Cheers,
Tom

>
Would it be worth my while creating a DataSet
class that implements the Set interface? and
populate it with a custom DataItem which
contains the field name and its value? Or is that just
reinventing the wheel?
Cheers,
TomYes I assumed that you might have single header and data........you are correct indeed, that map will only hold unique keys values..but what you can do is have a key which maps to a vector or a list.....so effectively what you are doing is mapping a single key to multiple values (which are stored in vector or list).....may be you might finding implementing DataSet an easier solution and if this helps your understanding and future maintenance then you should use this approach..

Similar Messages

  • Runtime error in KEFC Transaction while uploading CSV format file

    Hi Experts,
    This is regarding Runtime Error while executing the KEFC transaction in R3D.
    It is working successfully while uploading the file in Text format. But there is run time error while uploading in CSV format.
    It showing "The transfer was terminated.However,content errors occured" .
    Please provide the solution.
    Thanks in advance.
    Regards,
    Priya.

    Hi,
    To upload a CSV file it is used FM:
    CALL FUNCTION 'TEXT_CONVERT_CSV_TO_SAP'
    EXPORTING
    i_field_seperator = ';'
    I_LINE_HEADER =
    i_tab_raw_data = lt_file
    i_filename = p_filename
    TABLES
    i_tab_converted_data = p_table
    EXCEPTIONS
    conversion_failed = 1
    OTHERS = 2
    Please check what separetor this fm and your file are using. It should be the same.
    Regards,
    Fernando

  • Unable to save the data in a .CSV format

    Hi All,
    I am trying to pull some data with the help of the sql query from the database and then trying to save this string of data in csv file by using the following code as shown below.The problem iam facing here is that while the file Save as window opens stating to be saved as .CSV format but when i try to save it ,it doesnt givme a csv option ,only html option appears.Can any one help me on this..,,,,,,,,,,,,?
    <%@include file="jtfincl.jsp" %>
    <%@page session="false" %>
    <%@page import="java.io.PrintWriter"%>
    <%@page import="oracle.apps.ibe.util.RequestCtx"%>
    <%@page import="oracle.apps.iri.iribe.postsales.IrIbeOrderSearch"%>
    <%@page import="oracle.apps.ibe.util.*" %>
    <%@page import="java.io.IOException" %>
    <%
    pageContext.setAttribute("_securePage", "true", PageContext.REQUEST_SCOPE);
    pageContext.setAttribute("_guestNotAllowed", "true", PageContext.REQUEST_SCOPE);
    pageContext.setAttribute("_unapprovedNotAllowed", "true", PageContext.REQUEST_SCOPE);
    RequestCtx rCtx = RequestCtx.start(request, response);
    int status = Session.checkContextValues(request, response);
    if(RequestCtx.userIsAnonymous()) {
    signin(out, pageContext, request, response, false);
    return;
    // Set the response type which in this case will be a .csv file
    response.setContentType("application/csv");
    response.setHeader("Content-disposition","attachment;filename=SearchResults.csv");
    String queryStartDate = request.getParameter("queryStartDate");
    String queryEndDate = request.getParameter("queryEndDate");
    String queryField = request.getParameter("queryField");
    String queryOperator = request.getParameter("queryOperator");
    String queryValue = request.getParameter("queryValue");
    String queryOrderByField = request.getParameter("queryOrderByField");
    String showOpenOrdersOnly = request.getParameter("showOpenOrdersOnly");
    IrIbeOrderSearch orderSearch = new IrIbeOrderSearch(
    queryStartDate,
    queryEndDate,
    queryField,
    queryOperator,
    queryValue,
    queryOrderByField,
    showOpenOrdersOnly
    orderSearch.initialise();
    java.util.ArrayList results = orderSearch.getItemTrackerSearchResults();
         out.println("The result array size is======="+results.size()) ;
    // Output the results as the page resonse as a csv file
         try
    write(results, response.getWriter());
         catch(exception e)
         out.println("The stack trace is======="+e.printStackTrace()) ;
         if(IBE_logEnabled) IBEUtil.log("iribeCOtdOrdSearchExport.jsp","Inside the exception"+e.toString);
    %>
    <%!
    * This method will take a ResultSet and JspWriter object and print out the details of the ResultSet as a
    * comma seperated value file.
    * @param results
    * @param writer
    public static void write(java.util.ArrayList results, PrintWriter writer) {
    if(results == null || results.size() == 0) {
    writer.print("No Data Available");
    return;
    String [] data = null;
    String output = "";
              if(IBE_logEnabled) IBEUtil.log("iribeCOtdOrdSearchExport.jsp","Inside the write method");
    for(int i = 0; i < results.size(); i++) {
    data = (String []) results.get(i);
    output = "";
    for(int j = 0; j < data.length; j++) {
    // If its not the last column
    if(j != data.length - 1) {
    output += formatField(data[j]) + ",";
    // If it is the last column
    } else {
    output += formatField(data[j]);
    writer.println(output);
    writer.flush();
    * Format a string value so that it becomes a valid field in a .csv file. This involves making sure that any null
    * data is treated as an empty string, that any quotes are padded and if the file contains any commas that the
    * field is surrounded by quotes.
    * @param value
    private static String formatField(String value) {
    String output = null;
    // Check for null values
    if(value == null) {
    output = "";
    } else {
    output = value;
    // Pad any existing quotes
    output = output.replaceAll("\"", "\"\"");
    // If there is a space or commas then add surrounding quotes
    if(output.startsWith(" ") || output.endsWith(" ") || output.indexOf(",") != -1) {
    output = "\"" + output + "\"";
    return output;
    %>
    <%!
    void signin(
    JspWriter out,
    PageContext pageContext,
    HttpServletRequest request,
    HttpServletResponse response,
    boolean reauth
    ) throws IOException, SQLException, FrameworkException {
    String query = IBEUtil.passQueryString(request, null).toString();
    String uri = request.getRequestURI();
    String targetJsp = uri.substring(uri.lastIndexOf("/") + 1);
    String ref = null;
    if ("true".equals(pageContext.getAttribute("_securePage", PageContext.REQUEST_SCOPE))) {
    ref = RequestCtx.getSecureFormAction(targetJsp);
    } else {
    ref = RequestCtx.getNonSecureFormAction(targetJsp);
    if(!query.equals("")) {
    ref = oracle.apps.jtf.util.Utils.encode(ref + "?" + query);
    String redirect = RequestCtx.getSecureURL("ibeCAcpSSOLogin.jsp", "ref=" + ref + (reauth ? "&reauth=t" : ""));
    // don't add the ref if the session expired and restarted
    RequestCtx rCtx = RequestCtx.getRequestCtx();
    if(rCtx.startRequestException!=null) {
    redirect = RequestCtx.getSecureURL("ibeCAcpSSOLogin.jsp", "ibe_se=t"+(reauth ? "&reauth=t" : ""));
    RequestCtx.end(request);
    response.sendRedirect(redirect);
    regds
    manish
    %>

    This would occur if you were using IE and the requested URL doesn't contain the filename part. The real web browsers would pick up the filename from the response header flawlessly.
    Having said that, this kind of logic doesn't belong in a JSP. Use Java classes (Servlet, Bean, DAO). Further on, JSP/Servlet related questions should be posted in the JSP/Servlet forum.

  • I'm trying to find out how to export my apple contacts to the Salesforce software and they need to be in a csv format and I don't know if this is possible and how to do it if it is?

    I'm trying to find out how to export my apple contacts to the Salesforce software and they need to be in a csv format and I don't know if this is possible and how to do it if it is?

    I think there are third-party programs which will do that, but you can also do it with Automator:
    See the links in my post, here: https://discussions.apple.com/message/22390873#22390873
    The file or clipboard contents will be in Tab Separated vars, so you'll have to open with a spreadsheet program and save as Comma Separated Vars format.

  • EXPORT to text or CSV format from a form

    Dear all,
    Could you please help me to export the data from my form to a text file or to a csv format. I am very new to forms.
    i need to export the data from the oracle form to a text file or CSV file format.
    I had created form named as form1.
    In form1 i have a block named as block1. In this block i have 4fields as field1, field2, field3, field4. using a tabe1 which has the same 4fields.
    This form is in tabular form.
    Example:
    In the form i have data like as below and i got this data from table1. I used a execute query to get the data from the table into this form.
    field1 field2 field3 field4
    raj 1234 abc 510
    dil 777 hi 787
    Now my requirement is i need to export this data into a file, when i click on a button(Export) it has to browse for a folder on my desktop and i have to name the filename to save the data.
    Please help me.
    Thanks in advance.

    This should be almost same as in your previous task for import data.
    Try this:
    DECLARE
       v_file_name   VARCHAR2 (100);
       v_file        client_text_io.file_type;  
       v_delimiter VARCHAR2(1) := ',';
    BEGIN
       v_file_name := webutil_file.file_save_dialog;
       v_file := client_text_io.fopen (v_file_name, 'w');
       GO_BLOCK ('block1');  
       FIRST_RECORD;
       LOOP
            client_text_io.PUT_LINE(v_file, :block1.field1||v_delimiter||:BLOCK1.field2||v_delimiter||:BLOCK1.field3||v_delimiter||:BLOCK1.field4);
        IF :SYSTEM.LAST_RECORD = 'TRUE' THEN
             EXIT;
        END IF;     
        NEXT_RECORD;
       END LOOP;
       client_text_io.fclose (v_file);
    END;

  • How to change the default structure when exporting data in CSV format?

    Hello,
    can some one tell us how to change the default structure in CRM when exporting lists in CSV format (with Option "Always use unformatted list format (CSV) for download" ? Because we want to add a new structure for our own -is it possible ?
    If it is possible where can we find these structure ? In the blueprint customizing ?
    Thank you very much,
    Christian

    There is a workaround to move from 1.5 version to the older 1.4 version. But this could be specific to the browser setting the JRE version.
    Excerpts from sun docs:
    However, a user can still run older versions. To do so, launch the Java Plug-in Control Panel for the older version, then (re)select the browser in the Browser tab.
    Example:
    Assume you are running on Microsoft Windows with Microsoft Internet Explorer, have first installed version 1.4.2, then version 5.0, and you want to run 1.4.2.
    Go to the j2re1.4.2\bin directory where JRE 1.4.2 was installed. On a Windows default installation, this would be here: C:\Program Files\Java\j2re1.4.2\bin
    Double-click the jpicpl32.exe file located there. It will launch the control panel for 1.4.2.
    Select the Browser tab. Microsoft Internet Explorer might still appear to be set (checked). However, when 5.0 was installed, the registration of the 1.4.2 JRE with Internet Explorer was overwritten by the 5.0 JRE.
    If Microsoft Internet Explorer is shown as checked, uncheck it and click Apply. You will see a confirmation dialog stating that browser settings have changed.
    Check Microsoft Internet Explorer and click Apply. You should see a confirmation dialog.
    Restart the browser. It should now use the 1.4.2 JRE for conventional APPLET tags.
    Details are here
    http://java.sun.com/j2se/1.5.0/docs/guide/deployment/deployment-guide/jcp.html
    My system (Windows XP) has the version 1.5_09 set as the default. However i just installed JRE 1.5_06 and would like to revert back to _06 as the default JRE..
    Will update if i find more information

  • Need help in writing data to a flat file in .csv format

    Hi All,
    could you please show with a sample example to write data in .csv format using UTL_file.
    The result of the refcursor i want to write to a file in .csv format.
    How can i achieve this.
    Thx

    Hi,
    There are two ways to acheive this.
    First and which I prefer is creating a SQL script which will generate csv file at the specified location in CSV format. And then this SQL script can be called from your cron job similar to how you call stored procedure. Following is pseudo code that can be used -
    set linesize 500
    set echo off
    set feedback off
    set prompt off
    set pagesize 0
    spool <name of the csv file>.csv
    <Your select statement>;
    spool offPut select statement delimiting columns you want to use with ','. E.g. following query should create a CSV file named as abc.csv with one record and 2 columns delimited by comma. First column is ENO and second column is ENAME.
    set linesize 500
    set echo off
    set feedback off
    set prompt off
    set pagesize 0
    spool abc.csv
    select ENO || ',' || ENAME from employee;
    spool offSecond, you can write a PLSQL procedure and then call this procedure from cron job. There is a generic procedure shared by BluShadow some time back which is a very good example for this. Please refer to following link for this solution -
    REF Cursor creating CSV files
    I will suggest to use first method above if possible since it will be faster and less complicated in my opinion. Second method is recommended for scenarios where select statement is created dynamically and cannot be written during development.
    Hope this solves your purpose.
    Cheers,
    Anirudha

  • Search report - error-no data found when printing to csv format

    Hi all,
    I have a search report,
    I have 4 select list and two text field and two date field to search for the result.
    I have even put the computation for the select list items in
    on load - before header ie setting the items to default value.
    Still when i try to print it in the csv format , and try to open the excel, it is saying "no data found" error
    Please, Could any one give me a solution to solve this bug?
    Note: Ordinary report is getting printted in the csv format.
    Thanks in advance
    bye
    Srikavi

    Hi Denes and Scott,
    sorry, only when i select the values for all the 4 select list
    csv is working. default values are not restored in the session.
    How to restore the values in the session state after pressing the search button.
    i have set the default values for the select list and the query is working fine
    but when i see the session from the toolbar the default values are not present.
    but when i see the debug from the toolbar the values are set properly.
    @Denes
    In your example the session is showing the values of the select list and check box
    The same way i did, but in "session" values are not seen so again no data found is seen when printing csv .
    Bye
    Srikavi

  • Problem in exporting report in CSV format

    Hi All,
    I am using Crystal Reports. Following are details about it:
    CR Developer
    Product 8.5.0.217
    *_Problem that I am facing:__*_
    I can create report in .rpt format, it is working fine here. But while trying to export this report in CSV format, it gives report that doesn't contain any information.
    Is it because I am missing something or it is a known issue?
    Thanks and Regards,
    Anand

    Hi,
    I too am facing the same problem.
    The report was made in 8.5. I have exported the report & opened it in Crystal report 12.
    I can export to PDF, RTF, DOC & Tab separated Test.
    However when I export this report in .csv (legacy mode) I just get the header & when I export it in .csv (Standard) I get a blanck .csv file.
    I have  checked 'Isolate Report/Page sections' and 'Isolate Group sections'. Still no data in the report.
    refreshed it too.
    I contains sub reports, but not in the page header & footer (I think) & it does not seem to have cross tabs & OLAP grids.
    Any help is appreciated.
    Links to Screenshots:
    Main Report:
    http://picasaweb.google.com/lh/photo/yM9sBexKt5jW9soqaMmHjw?feat=directlink
    One of the Sub-Report:
    http://picasaweb.google.com/lh/photo/0ofa5sABakvZ-nFZp-JSMw?feat=directlink

  • Issue while downloading file in .CSV format

    Hi,
    I need to download the file in .CSV format.
    I hade used FM SAP_CONVERT_TO_CSV_FORMAT  and then used GUI_Download.
    Now when I am opening file which is downloaded, it gives all the data in a single column. If there are 5 fields in my table, the generated file gives the data of all the 5 fields in a single column.
    Could you please help?

    Hi try wi th the following code.
    TYPE-POOLS : truxs.
    DATA: t_file TYPE STANDARD TABLE OF type_file.
    data:t_conv_data TYPE truxs_t_text_data.
    CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
      EXPORTING
        i_field_seperator          = ', '
      TABLES
        i_tab_sap_data             = t_file
    CHANGING
       i_tab_converted_data       = t_conv_data
    EXCEPTIONS
       conversion_failed          = 1
       OTHERS                     = 2.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                = 'C:\TESTCSV.CSV'
        filetype                = 'ASC'
        write_field_separator   = '  '
      TABLES
        data_tab                = t_file
       fieldnames              = names
      EXCEPTIONS
        file_write_error        = 1
        no_batch                = 2
        gui_refuse_filetransfer = 3
        invalid_type            = 4
        no_authority            = 5
        unknown_error           = 6
        header_not_allowed      = 7
        separator_not_allowed   = 8
        filesize_not_allowed    = 9
        header_too_long         = 10
        dp_error_create         = 11
        dp_error_send           = 12
        dp_error_write          = 13
        unknown_dp_error        = 14
        access_denied           = 15
        dp_out_of_memory        = 16
        disk_full               = 17
        dp_timeout              = 18
        file_not_found          = 19
        dataprovider_exception  = 20
        control_flush_error     = 21
        OTHERS                  = 22.

  • How to run a report from oracle 10g form in .csv format

    dear all,
    how to run a report from oracle 10g form in .csv format? i've already run in pdf & excel format.
    i'm using
    SET_REPORT_OBJECT_PROPERTY (ro_report_id, report_desformat, 'PDF'); --for pdf
    SET_REPORT_OBJECT_PROPERTY (ro_report_id, report_desformat, 'SPREADSHEET'); ---for excel
    Please Help..

    i have already tried.
    but the report show in htm or html format. that file will not save into csv. please help.

  • Exporting report as PDF and CSV formats same time with out executing DB query twice

    Post Author: cpriyanka
    CA Forum: Exporting
    I am using Crystal Report 9.0 version and Java.
    I am getting "PrintOutputController" from "ReportClientDocument"
    And then by calling export(ReportExportFormat.PDF) generating PDF format report.
    Now I need to generate both PDF and CSV format files same time. How can it be done?
    My understanding is when we call "export" it does the DB query execution and other functionality.
    In that case, if I call "export" two times with two different formats, then DB query will be executed twice and that takes lot of time.
    To avoid, is there a way I can all some API so DB query executed once, but I can export report in to multiple formats?
    I appreciate your help.
    Thanks.

    Post Author: cjmorris1201
    CA Forum: Exporting
    Hello,
    Are you using the "pull" or "push" method for your crystal reports?  If you are using the "pull" method (the report itself executes the sql) then I believe there is no way around having the query execute twice since it is fired off each time you open and export the report.
    If you use the "push" method, however, then you can just create the recordset/dataset and then set the datasouce once for the report.
    Here's a broad overview of push and pull though the Crystal Report Viewer is used.  The viewer may or may not be applicable in your case:
    http://aspalliance.com/265_Crystal_Report_for_Visual_Studio_NET#Page5
    Regards, Carl

  • How to save WEBI report in CSV format on file system

    Hi
    I am trying to save a WEBI report from BO server in CSV format through java / BO SDK. Iam able to save report in html , pdf and xls format. Please provide a code snippet if available.
    I know for pdf and xls we directly use doc, binary view and for html there is HTMLVIEW. But iam not able to save it using CSV OutputFormatType
    thanks

    Hi,
    Just in case, I think that Shawn wanted to send the following link showing the different formats:
    http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/en/RE_SDK/resdk_dg_doc/doc/resdk_java_CustoWebI_dg/ewucw_053.html#1037054
    Cheers

  • Report in CSV format

    In an Apex report SQL query, i had written a statement for the column as
    '<div style="width: 260px;">'|| PARTY_NAME || '</div>' as PARTY_NAME to avoid wrapping of the column text.
    Now, when i download the report in csv format, i get the output in PARTY_NAME column as follows:
    <div style="width: 260px;">SELF</div> instead if SELFPlease suggest the solution.
    Yogesh

    Hi,
    Remove HTML from select.
    Add this to page HTML header
    <style>
    #apexir_PARTY_NAME{width:260px!important}
    </style>Br,Jari
    Edited by: jarola on Jan 21, 2010 9:32 AM
    Code corrected

  • How can I export the report to Excel or CSV format in Rational(Java)?

    <p>Dear all,</p><p>Now I develop CR report integrate with Web application, I use Ratioanl(RAD) to develop. And I want to export the report to Excel/CSV format, but always failed.</p><p>If I force it export CSV file in the system, when I use MS office to open this CSV file, the file content is bad.</p><p>Could any one tell me how to achieve this?</p><p> Many thanks!</p><p>Steven</p>

    <p>CR4E is bundled with RAD 7...actually to be clear it is a version of CR4E Professional. Users of RAD 7 will also get a dev/test license of CR Server as well as number of additional features to support developing applications against their BusinessObjects Enterprise or Crystal Reports Server systems. For more information regarding the RAD 7 launch you can read the press release here:</p><p><strong><a href="http://biz.yahoo.com/bw/061205/20061205005363.html?.v=1">http://biz.yahoo.com/bw/061205/20061205005363.html?.v=1</a> </strong> </p><p>I am hoping to do a webinar in January highlighting a number of the new features available with the IBM Rational Application Developer integration.</p><p>As for RAD 6 support, unfortunately the CR4E toolkit does require Eclipse 3.2 support so it will not work with RAD 6. </p><p>Regards,<br />Sean Johnson (CR4E Product Manager) <br /><br /> <strong><a href="http://www.eclipseplugincentral.com/Web_Links-index-req-ratelink-lid-639.html">Rate this plugin @ Eclipse Plugin Central</a></strong>          </p>

  • How can I export the universe  to CSV format in Rational      (java)

    How can I export the universe to CSV format in Rational ,please give me one demo .thanks!!

    There's no direct access to an Universe from Java - Universes do have an SDK, but it's COM-based.
    If what you want is to retrieve data from the Universe, what you can do is create a Web Intelligence document reporting off that Universe, create a Query with the data you want from the Universe, then use the ReportEngine (REBean) SDK to retrieve the ResultSet from the Query - note that there's no CSV export option, so you'd have to walk through the ResultSet and write to an CSV yourself.
    Sincerely,
    Ted Ueda

Maybe you are looking for