HELP ME! Creating a table from a data file

Hi
I'm writing an application for data visualization. The user can press the "open file" button and a FileChooser window will come up where the user can select any data file. I would like to take that data file and display it as a table with rows and columns. The user needs to be able to select the coliumns to create a graph. I have tried many ways to create a table, but nothing seems to work! Can anyone help me?! I just want to read from the data file and create a spreadsheet type table... I won't know how many rows and columns I'll need in advance, so the table needs to be dynamic!
If you have ANY tips, I'd REALLY appreciated.....

I won't know how many rows and columns I'll need in advance, so the table needs to be dynamic!You may use a List (ArrayList, LinkedList or Vector) for that.
Lists allow you (dynamically) add elements.

Similar Messages

  • NEED HELP... Creating dynamic table from data file...

    Hi
    I'm writing an application for data visualization. The user can press the "open file" button and a FileChooser window will come up where the user can select any data file. I would like to take that data file and display it as a table with rows and columns. The user needs to be able to select the coliumns to create a graph. I have tried many ways to create a table, but nothing seems to work! Can anyone help me?! I just want to read from the data file and create a spreadsheet type table... I won't know how many rows and columns I'll need in advance, so the table needs to be dynamic!
    If you have ANY tips, I'd REALLY appreciated.....

    Thank you for your help. I tried to use some of the code in the examples... I'm really new at this, so I'm not sure how to set it up. I added the code, but when I open a file, nothing happens. Here's the code I have so far...
    package awt;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.text.*;
    import javax.swing.border.*;
    import javax.swing.table.*;
    * @author
    public class Main {
    public static void main(String[] args) {
    JFrame frame = new ScatterPlotApp();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.show();
    class ScatterPlotApp extends JFrame implements ActionListener{
    private JButton openButton, exitButton, scatButton, refreshButton;
    private JMenuBar menuBar;
    private JMenuItem openItem, exitItem;
    private JFileChooser chooser;
    private JMenu fileMenu;
    private JTextPane pane;
    private JTable table;
    private DefaultTableModel model;
    private JScrollPane scrollPane;
    private Container contentPane;
    /** Creates a new instance of ScatterPlotApp */
    public ScatterPlotApp() {
    setTitle("Data Visualizer");
    Toolkit tk = Toolkit.getDefaultToolkit();
    Dimension d = tk.getScreenSize();
    int width = 867;
    int height = 800;
    setBounds((d.width - width)/2, (d.height - height)/2, width, height);
    contentPane = getContentPane();
    JPanel panel = new JPanel();
    //pane = new JTextPane();
    panel.setLayout(new FlowLayout(FlowLayout.CENTER));
    contentPane.add(panel, BorderLayout.SOUTH);
    //contentPane.add(pane, BorderLayout.NORTH);
    scatButton = new JButton("Create ScatterPlot");
    scatButton.addActionListener(this);
    openButton= new JButton ("Open File");
    openButton.addActionListener(this);
    exitButton = new JButton ("Exit");
    exitButton.addActionListener(this);
    refreshButton = new JButton ("Reload Data");
    refreshButton.addActionListener(this);
    panel.add(openButton);
    panel.add(scatButton);
    panel.add(refreshButton);
    panel.add(exitButton);
    fileMenu = new JMenu("File");
    openItem = fileMenu.add(new JMenuItem ("Open", 'O'));
    openItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, Event.CTRL_MASK));
    openItem.addActionListener(this);
    exitItem = fileMenu.add(new JMenuItem ("Exit", 'X'));
    exitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.CTRL_MASK));
    exitItem.addActionListener(this);
    JMenuBar menuBar = new JMenuBar();
    fileMenu.setMnemonic('F');
    menuBar.add(fileMenu);
    setJMenuBar(menuBar);
    public void actionPerformed(ActionEvent e){
    Vector columnNames = new Vector();
         Vector data = new Vector();
    try{
    Object source = e.getSource();
    if (source == openButton || e.getActionCommand().equals("Open")){
    chooser = new JFileChooser(".");
    int status =chooser.showOpenDialog(this);
    if (status ==JFileChooser.APPROVE_OPTION)
    File file = chooser.getSelectedFile();
    FileInputStream fin = new FileInputStream(file);
    BufferedReader br = new BufferedReader(new InputStreamReader(fin));
    String line;
    //StringBuffer bf = new StringBuffer();
    StringTokenizer st1 = new StringTokenizer(br.readLine(), ";");
                   while( st1.hasMoreTokens() )
                        columnNames.addElement(st1.nextToken());
                   // extract data
                   while ((line = br.readLine()) != null)
                        StringTokenizer st2 = new StringTokenizer(line, ";");
                        Vector row = new Vector();
                        while(st2.hasMoreTokens())
                             row.addElement(st2.nextToken());
                        data.addElement( row );
                   br.close();
    model = new DefaultTableModel(data, columnNames);
              table = new JTable(model);
    scrollPane = new JScrollPane( table );
    getContentPane().add( scrollPane, BorderLayout.NORTH );
    while((line=br.readLine())!=null)
    bf.append(line+"\n");
    pane.setText(bf.toString());
    //pane.setText(bf.toString());
    else if (source == scatButton){
    else if (source == exitButton || e.getActionCommand().equals("Exit")){
    System.exit(0);
    else if (source == refreshButton){
    catch (Exception ex){
    ex.printStackTrace();
    }

  • Create a table and upload data in MS ACCESS from SAP ABAP programming?

    Hi All,
    How to create a table in MS ACCESS database and Upload SAP database table data into MS ACCESS table using ABAP programming?
    Explain: My client requirement is " If he/she runs a ABAP Program, that will create a table and upload data into MS ACCESS Database table in background. "
    Could you please give the solution or code? I know the program RIACCESS and I went through the SAP Note 583698.
    Is this only solution for this?  Or Any other possibilities?
    Please give me solution.
    Thanks in advance.

    Hi,
    It is not possible to create tables in a non SAP schema from inside SAP.
    The SAP-Oracle license also does not allow you to create the table (see note 581312):
    the following actions, among other things, are therefore forbidden at database level:
    Creating database users
    Creating database segments
    Querying/changing/creating data in the database
    Using ODBC or other SAP external access methods
    Please refer following link,
    [Ckick Here|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do]
    You can also do it by LSMW,
    If you are using Access 97, you can download directly into an access
    database from SAP. See program RIACCESS for details. You have to establish
    an RFC destination PS_ACCESS_1 and 2.
    There are then a couple of function modules. Go to SE37 and put in
    msaccess and hit PF4.
    The following is from the readme file: sapgui/ps/readme.sap
    For the MS-Access interface SAP delivers 4 files:
    WDPSASTR.EXE This is an RFC server program that is called by SAP R/3
    (PS module). This program creates a MS Access database. The structure
    information of the tables is transferred from R/3. In addition to
    these tables a table named DDIC is created. This table contains the
    structure information and should in no case be modified or deleted.
    WDPSATAB.EXE This is an RFC server program that is called by SAP R/3
    after WDPSASTR. This program filles the tables of the database with data.
    There must not be made any changes of the structure of
    the tables between the calls of WDPSASTR and WDPSATAB.
    WDPSAZET.EXE This is an RFC client program that triggers work/time
    confirmations in the PS module of SAP R/3 (like transaction CN27 Collectiv
    confirm).
    WDPSAMAT.EXE This is an RFC client program that triggers material
    confirmations in the PS module of SAP R/3 (like transaction MB1A - Goods
    Please also refer following links,
    [Click here|Upload data from MS Access tables, to SAP tables.;
    Before using the program "RIACCESS", you need to install the PS utilities, which are part of SAPGUI install CD.
    It is available in the "SAPGUIPS directory".
    Then do the followings :
    1. Select transaction code SALE -> Systems in network-> Define RFC Destination.
    2. You will need two RFC destinations (TCP/IP connections for the front-end workstation).
    Setup the two RFC destinations PS_ACCESS_1 and PS_ACCESS_2 and you'll have to get them to point to
    wdpsastr.exe and wdpsatab.exe respectively.
    3. Then execute RIACCESS and choose PS_ACCESS_1 to generate access tables.
    The system must also be able to access the RFC-DLL files (librfc2.dll, librfc3.dll, librfc4.dll, librfc5.dll, librfc6.dll, vrfc.dll).
    Please note that Access only supports tables with up to 255 fields.

  • How to create a table from an existing table with new column

    Hi !
    Please help me.
    I want to create a table from an existing table with data and add two new column to the new table.
    What will be the syntax?

    craete table new_table as select a.*, 'somevalue' new_col1, 'somevalue'
    new_col2 from old_table a;Also there is a pitfall - newly created table will accept column type and precision from the select statement, so further you can be needed to modify columns
    if you want to have VARCHAR2 instead of CHAR for example:
    SQL> create table new_dept as select dept.*, 'New data' new_col from dept;
    Table created.
    SQL> desc new_dept
    Name                                      Null?    Type
    DEPTNO                                             NUMBER(2)
    DNAME                                              VARCHAR2(14)
    LOC                                                VARCHAR2(13)
    NEW_COL                                            CHAR(8)
    SQL> alter table new_dept modify (new_col varchar2(8));
    Table altered.
    SQL> desc new_dept
    Name                                      Null?    Type
    DEPTNO                                             NUMBER(2)
    DNAME                                              VARCHAR2(14)
    LOC                                                VARCHAR2(13)
    NEW_COL                                            VARCHAR2(8)Rgds.
    Didn't see michael's post - it reflects the fix for this problem using CAST.
    Message was edited by:
    dnikiforov

  • Creating external table - from a file with multiple field separators

    I need to create an external table from a flat file containing multiple field separators (",", ";" and "|").
    Is there any way to specifiy this in the CREATE TABLE (external) statement?
    FIELDS TERMINATED BY "," -- Somehow list more than just comma here?
    We receive the file from a vendor every week. I am trying to set up a process for some non-technical users, and I want to keep this process transparent to them and not require them to load the data into Oracle.
    I'd appreciate your help!

    scott@ORA92> CREATE OR REPLACE DIRECTORY my_dir AS 'c:\oracle'
      2  /
    Directory created.
    scott@ORA92> CREATE TABLE external_table
      2    (COL1 NUMBER,
      3       COL2 VARCHAR2(6),
      4       COL3 VARCHAR2(6),
      5       COL4 VARCHAR2(6),
      6       COL5 VARCHAR2(6))
      7  ORGANIZATION external
      8    (TYPE oracle_loader
      9       DEFAULT DIRECTORY my_dir
    10    ACCESS PARAMETERS
    11    (FIELDS
    12         (COL1 CHAR(255)
    13            TERMINATED BY "|",
    14          COL2 CHAR(255)
    15            TERMINATED BY ",",
    16          COL3 CHAR(255)
    17            TERMINATED BY ";",
    18          COL4 CHAR(255)
    19            TERMINATED BY ",",
    20          COL5 CHAR(255)
    21            TERMINATED BY ","))
    22    location ('flat_file.txt'))
    23  /
    Table created.
    scott@ORA92> select * from external_table
      2  /
          COL1 COL2   COL3   COL4   COL5
             1 Field1 Field2 Field3 Field4
             2 Field1 Field2 Field3 Field4
    scott@ORA92>

  • Sql/Plsql code to export data into a temporary table from a text file

    Dear all,
    I need to create a temporary table getting data from a text file. I am very new to data loading could you please help me how to read the text file in to a temporary table.
    i have text file like as below:
    order items : books Purchasing
    start date:
    8-11-09
    Notes: Books are selling from aug10 to aug 25
    Action performed
    Time
    Verified By
    sold out from shop, sold out date:_________
    1.
    physics _______ book sold to ravi
    2.
    social _______ book this is a good book
    sold to kiran
    aug10th
    ronald
    3.
    maths book to sal
    4.
    english book__________ this was a newbook
    to raj
    jak
    return to shop, return date:____________
    1.
    maths book return by:_____________ Verify book
    aug11th
    john
    2.
    story book by:_________ checked
    aug14th
    Now i need to create a temporary table and insert the data into the table from this text file.
    Now i need to create a temporary table named as books_order with 5columns(order,Status,Action_Performed,Time,Verified_By) like as below:
    Order     status     Action_Performed     Time     Verified_By
    books Purchasing     sold     physics _______ book sold to ravi     _______     _________
    books Purchasing     sold     social _______ book this is a good book sold to kiran aug10th     ronald
    books Purchasing sold     maths book to sal     _____     __________
    books Purchasing     sold     english book__________ this was a newbook to raj __________     jak
    books Purchasing return     maths book return by:_____________ Verify book aug11th     john
    books Purchasing     return     story book by:_________ checked aug14th     _________
    Thanks in advance.

    Isn't school work marvelous?
    Create an external table.
    http://www.morganslibrary.org/reference/externaltab.html
    Getting the data into a temporary table may make sense in SQL Server ... but not in Oracle.

  • Create oracle table from sql server

    Dear Gurus,
    I need to create some tables from sql server 2008 to a oracle 11g database. Some tables contain vbinary datatype. Now my queries are
    1. How can I do that?
    2. If DB link is a solution then would you please provide me a step by step process to do so?
    3. Is there any issue with datatype?
    SQL Server db is on windows 2008 R2
    Oracle is in RHEL 5.5
    Will appreciate ur help.

    well suppose i generate flat files from sql server and load in oracle by sqlloader then will there be any issue with vbinary datatype? what should be the equivalent data type in oracle table?

  • How to get internal table from SAP Data Provider C#

    Hello.
    ABAP:
       DATA: lt_t001 TYPE TABLE OF t001.
       DATA: url(1000) TYPE c.
      SELECT * INTO TABLE lt_t001 FROM t001.
      CALL FUNCTION 'DP_CREATE_URL'
        EXPORTING
          type                 = 'APPLICATION'
          subtype           = 'X-R3TABLE'
        TABLES
          data                 = lt_t001
        CHANGING
          url                    = url
        EXCEPTIONS
          OTHERS           = 4.
    C#:
    using SAPDataProvider;
    using SAPTableFactoryCtrl;
    public void SetDataFromUrl(string url)
                SAPDataProviderClass p = new SAPDataProviderClass();
                p.SetDataFromURL("APPLICATION", "X-R3TABLE", url);
                ISapDPR3Table tbl = p.GetDataAsR3Table("APPLICATION", "X-R3TABLE");
                SAPTableFactoryClass tf = new SAPTableFactoryClass();
                Table tb = (Table)tf.NewTable();
                tb.ISAPrfcITab = tbl.DataTable; // Exception !!!!!!
    How to get internal table from SAP Data Provider ?

    Hi Sergey,
    I'm trying to do the same, have you found a solution to solved it?
    thanks for your help.
    Regards.
    Jonathan

  • Using execute immediate creating a table from another

    hi friend i wanted to create a table from a select statement in a pl sql procedure. i am using execute immediate but getting problems with it pls can anyone help me.
    here is the query i am using
    EXECUTE IMMEDIATE 'CREATE TABLE table_name AS  (SELECT * FROM  a_view   WHERE column_name LIKE '%some_string%');
    i need to know if this can be done and if yes how. pls help me its bit urgent too. the schema name is same and the privileges are available to create tables too.

    Your syntax is wrong.
    If you would use a syntax higlighted editor, it would show.
    Yout try to execute a string where another string is embedded. Please use two times single quote or use the 'q' function:
    This one is correct:
    EXECUTE IMMEDIATE 'CREATE TABLE table_name AS (SELECT * FROM  a_view WHERE column_name LIKE ''%some_string%'')';
    or this one:
    EXECUTE IMMEDIATE q'|CREATE TABLE table_name AS (SELECT * FROM  a_view WHERE column_name LIKE '%some_string%')|';
    good luck

  • Union tables from multiply data srouces in OBIEE

    Hi Pros,
    Recenetly I am doing a POC about union the same structure table from multiply data sources through OBIEE, uptill now I still can't make that out, I have tried below ways :
    Precondition: I have configured those two tables under one physical folder with two connection pool
    1. When do the union in physical level, can not implement since either can not create a view union two tables or using SQL.
    2. When do the union in Logical level, can not implement also
    I know that this kind of data integration should be done before we import into OBIEE model, but there is some policy that we can't integrate, so I just wondering whether OBIEE has this functionlity that can union data from different data source. Please advise.
    thanks

    Hi Srinivas
    After a second thought, I am wondering what you mean in the post, but the situation is that there are two tables in different data sources, Table-A and Table-B in the Physical layer, they are not yet integrated into one table(let's say Table-C), you mean add a data source indictor column into a table in BMM layer, I want to know how can we integrate data (UNION), because from my perspective, if TABLE-A have bleow column ID,NAME,ADDRESS, while the TABLE-B have the same, the difference is the data bwtween them, even we create a logicl table in BMM, drag those those columns, we only get ID,NAME,ADDRESS,ID#,NAME#,ADDRESS#, but the table structure is different.
    The problem is how to create a logic table like TABLE-D (ID,NAME,ADDRESS) which have the data both from TABLE-A and TABLE-B in Physical Layer. While no need to filter by prompt about the data sources. We need to show the data altoghter.
    Please advise if I missing you point.
    thanks
    Edited by: Henry He on Dec 28, 2010 3:21 PM

  • Create one tables from 2 different tables

    Hi,
    How I can create one table from 2 different tables. Source tables have data and I want to include it in new table.
    I try this:
    create table NEW_ONE
    select * from OLD_ONE
    union
    select * from OLD_ONE2;
    But it didn't work correctly :/

    I don't have any error. This syntax create table NEW_ONE, but this table have columns only from OLD_ONE table :/ There aren't any column from OLD_ONE2 :/ Any suggestions?
    I don't forget about "as" in my query, only in this post.
    Edited by: tutus on Sep 8, 2008 6:36 AM

  • How to Create adf table from java bean

    Hi,
    How to Create adf table from java class (Not from ADF BC).
    Thanks
    Satya

    @vlsn -- you have to follow what shay said.
    Do the following in Model layer ::
    create a table property java class with your columns setters and getters like :
    *public class gridProps {*
    private int sno;
    private String orderNum;
    *public void setSno(int sno) {*
    this.sno = sno;
    *public int getSno() {*
    return sno;
    *public void setOrderNum(String orderNum) {*
    this.orderNum = orderNum;
    *public String getOrderNum() {*
    return orderNum;
    Create another table java class which will populate the values to your column values and return the collection :
    *public class gridPopulate {*
    private  List<gridProps> gridValues ;
    *public List<gridProps> setToGrid(ArrayList<ArrayList> valuesToSet) {*
    *if (valuesToSet == null) {*
    return gridValues;
    gridValues = new ArrayList<gridProps>();
    if(btnValue.equals("completeBtn"))
    return gridValues;
    for(ArrayList<String> tempArr:valuesToSet)
    gridProps gp = new gridProps();
    gp.setSno(Integer.valueOf(tempArr.get(0)));
    gp.setOrderNum(tempArr.get(1));
    return gridValues;
    Right click gridPopulate class and create this as data control.This class will be seen in Data control list.Under this data control,Drag the grid property collection(created earlier) to your page.Then execute your binding(gridPopulate) according to your logic.
    Thanks.(My jdev version 11.1.1.5.0)

  • Create Oracle tables from DTD

    Hi,
    are there any tools to create oracle tables from dtd's

    None to my knowledge. DTD's don't provide any data type information or length information on the data, so at best such a tool could create you tons of VARCHAR2(4000) columns.

  • Create a table from another table

    I have Windows XP with 10g 10.2.0.1.0
    I need to create a table from another table to re-arrange the table column order and add the following statement at the end of creation.
    PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
    TABLESPACE "TAB_DATA"
    Below iis my SQL statement, but it doesn't work. Please help.
    create table my_table as (select t1, t5, t2, t3, t4 from orig_table
    PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
    TABLESPACE "TAB_DATA"
    *);*

    Kee Kee wrote:
    I have Windows XP with 10g 10.2.0.1.0
    I need to create a table from another table to re-arrange the table column order Why? Column order has no meaning. The individual SELECT statement specifies the column order that particular statement wants, which may be different from the needs of some other SELECT statement.
    and add the following statement at the end of creation.
    PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
    TABLESPACE "TAB_DATA"
    Below iis my SQL statement, but it doesn't work. Please help.
    create table my_table as (select t1, t5, t2, t3, t4 from orig_table
    PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
    TABLESPACE "TAB_DATA"

  • How to avoid duplicate data while inserting from sample.dat file to table

    Hi Guys,
    We have issue with duplicate data in flat file while loading data from sample.dat file to table. How to avoid duplicate data in control file.
    Can any one help me on this.
    Thanks in advance!
    Regards,
    LKR

    No, a control file will not remove duplicate data.
    You would be better to use an external table and then remove duplicate data using SQL as you query the data to insert it to your destination table.

Maybe you are looking for

  • Issue with Overall Result - Help

    Hello, I have a query with two restricted keyfigures (0amount used) as actual and forecast. While drilldown by fiscal period, the overall result shows totals for actual and plan separately. Business point of view, they want to have total of both (act

  • Pdf form crashes browser

    i created a pdf form in adobe live cycle designer and when i  click the link to the pdf on my website, the browser crashes. I then have to ctrl+alt+delete to end task and then a window pops up saying "xml parsing error: unclosed token (error code 5),

  • Print icon has dissappered. I can't print from Firefox anymore. How to get print icon back?

    Previously I had print icon in Firefox. Then one day Firefox asked to be updated and after update had completed print icon was not there anymore. Also bookmarks look different. == This happened == Every time Firefox opened == I updated Firefox

  • Repair Flickr tool in iPhoto 09

    Awhile back, I was getting frustrated with the Flickr upload tool in iPhoto 09 and deleted it by following the advice of someone in the forums. I think I deleted a .plist file or something like that, but honestly, I can't remember. Right now, there i

  • Nokia N70 + OS X 10.4.8

    Hi Having a Nokia N70, trying to connect with my MacBook Pro, it doesn't show the folders of the phone... while with other Nokia's I get the folders. Is this a tipical N70 thing? Thanks for any answer Bart