I need to read data from a text file and display it in a datagrid.how can this be done..please help

hey ppl
i have a datagrid in my form.i need to read input(fields..sort of a database) from a text file and display its contents in the datagrid.
how can this  be done.. and also after every few seconds reading event should be re executed.. and that the contents of the datagrid will keep changing as per the changes in the file...
please help as this is urgent and important.. if possible please provide me with an example code as i am completely new to flex... 
thanks.....  

It's not possible to read from a file without using classes from the core API*. You'll have to get clarification from your instructor as to which classes are and are not allowed.
[http://java.sun.com/docs/books/tutorial/essential/io/]
*Unless you write a bunch of JNI code to replicate what the java.io classes are doing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Need to read data from a text file

    I need to read data from a text file and create my own hash table out of it. I'm not allowed to use the built in Java class, so how would I go implementing my own reading method and hash table class?

    It's not possible to read from a file without using classes from the core API*. You'll have to get clarification from your instructor as to which classes are and are not allowed.
    [http://java.sun.com/docs/books/tutorial/essential/io/]
    *Unless you write a bunch of JNI code to replicate what the java.io classes are doing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Hi i am new to labview. i want to extract data from a text file and display it on the front panel. how do i proceed??

    Hi i am new to labview
    I want to extract data from a text file and display it on the front panel.
    How do i proceed??
    I have attached a file for your brief idea...
    Attachments:
    extract.jpg ‏3797 KB

    RoopeshV wrote:
    Hi,
    The below code shows how to read from txt file and display in the perticular fields.
    Why have you used waveform?
    Regards,
    Roopesh
    There are so many things wrong with this VI, I'm not even sure where to start.
    Hard-coding paths that point to your user folder on the block diagram. What if somebody else tries to run it? They'll get an error. What if somebody tries to run this on Windows 7? They'll get an error. What if somebody tries to run this on a Mac or Linux? They'll get an error.
    Not using Read From Spreadsheet File.
    Use of local variables to populate an array.
    Cannot insert values into an empty array.
    What if there's a line missing from the text file? Now your data will not line up. Your case structure does handle this.
    Also, how does this answer the poster's question?

  • Shell scripts to read data from a text file and to load it into a table

    Hi All,
    I have a text file consisting of rows and columns as follows,
    GEF001 000093625 MKL002510 000001 000000 000000 000000 000000 000000 000001
    GEF001 000093625 MKL003604 000001 000000 000000 000000 000000 000000 000001
    GEF001 000093625 MKL005675 000001 000000 000000 000000 000000 000000 000001 My requirement is that, i should read the first 3 columns of this file using a shell script and then i have to insert the data into a table consisting of 3 rows in oracle .
    the whole application is deployed in unix and that text file comes from mainframe. am working in the unix side of the application and i cant access the data directly from the mainframe. so am required to write a script which reads the data from text file which is placed in certain location and i have to load it to oracle database.
    so I can't use SQL * loader.
    Please help me something with this...
    Thanks in advance.

    1. Create a dictionary object in Oracle and assign it to the folder where your file resides
    2. Write a little procedure which opens the file in the newly created directory object using ULT_FILE and inside the FOR LOOP and do INSERTs to table you want
    3. Create a shell script and call that procedure
    You can use the post in my Blog for such issues
    [Using Oracle UTL_FILE, UTL_SMTP packages and Linux Shell Scripting and Cron utility together|http://kamranagayev.wordpress.com/2009/02/23/using-oracle-utl_file-utl_smtp-packages-and-linux-shell-scripting-and-cron-utility-together-2/]
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com

  • Read data from a text file, one line at a time.

    I need to read data from a text file, and display each line in a String Indicator on Front Panel. It displays each line, but I get Error 4, End Of Line, unless I enter an extra line of data in the file that I don't need. I tried Read From Text File.vi, made by Nat Instr, and it gave the same error.

    The Read from Text File.vi reads data from a text file line by line until the user stops the VI manually with the Stop button on the front panel, or until an error (such as "Error 4, End of file") occurs. If an error occurs, the Simple Error Handler.vi pops up a dialog that tells you which error occurred.
    The Read from Text File.vi uses a while loop, but if you knew how many lines you wanted to read, you could replace the while loop with a for loop set to read that many lines from the file.
    If you need something more dynamic because the number of lines in your files vary, then you could change the code of the Read from Text File.vi to the expect "Error 4, End of file" and handle it appropriately. This would require unbundling the error cluster that comes fro
    m the Read File function with the Unbundle By Name function, so that you can expose the individual error "status" and error "code" values stored in the cluster. If the value of the error "code" is 4, then you can change the error "status" from true to false, and you can rebundle the cluster with the Bundle by Name function. Setting the error "status" to false instructs the Simple Error Handler to ignore the error. Otherwise, pass the original error cluster to the Simple Error Handler.vi, so that you can see what the error is.
    Of course, if you're not interested in what the errors are, you could just remove the Simple Error Handler.vi, but then you wouldn't see any error messages.
    Best of Luck,
    Dieter
    Dieter Schweiss
    Applications Engineer
    National Instruments

  • Reading from a text file and displaying the contents with in a frame

    Hi All,
    I am trying to read some data from a text file and display it on a AWT Frame. The contents of the text file are as follows:
    pcode1,pname1,price1,sname1,
    pcode2,pname2,price2,sname1,
    I am writing a method to read the contents from a text file and store them into a string by using FileInputStream and InputStreamReader.
    Now I am dividing the string(which has the contents of the text file) into tokens using the StringTokenizer class. The method is as show below
    void ReadTextFile()
                        FileInputStream fis=new FileInputStream(new File("nieman.txt"));
                         InputStreamReader isr=new InputStreamReader(fis);
                         char[] buf=new char[1024];
                         isr.read(buf,0,1024);
                         fstr=new String(buf);
                         String Tokenizer st=new StringTokenizer(fstr,",");
                         while(st.hasMoreTokens())
                                          pcode1=st.nextToken();
                               pname1=st.nextToken();
              price1=st.nextToken();
                              sname1=st.nextToken();
         } //close of while loop
                    } //close of methodHere goes my problem: I am unable to display the values of pcode1,pname1,price1,sname1 when I am trying to access them from outside the ReadTextFile method as they are storing "null" values . I want to create a persistent string variable so that I can access the contents of the string variable from anywhere with in the java file. Please provide your comments for this problem as early as possible.
    Thanks in advance.

    If pcode1,pname1,price1,sname1 are global variables, which I assume they are, then simply put the word static in front of them. That way, any class in your file can access those values by simply using this notation:
    MyClassName.pcode1;
    MyClassName.pname1;
    MyClassName.price1;
    MyClassName.sname1

  • How do you read data from a text file into a JTextArea?

    I'm working on a blogging program and I need to add data from a text file named messages.txt into a JTextArea named messages. How do I go about doing this?

    Student_Coder wrote:
    1) Read the file messages.txt into a String
    2) Initialize messages with the String as the textSwing text components are designed to use Unix-style linefeeds (\n) as line separators. If the text file happens to use a different style, like DOS's carriage-return+linefeed (\r\n), it needs to be converted. The read() method does that, and it saves the info about the line separator style in the Document so the write() method can re-convert it.
    lethalwire wrote:
    They have 2 different ways of importing documents in this link:
    http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html
    Neither of those methods applies to JTextAreas.

  • Need to read data from pipe separated file using POJO?

    Hi,
    I need to read data from pipe separated file using POJO.
    There is config.properties file which consists of the
    data mapping.
    Can you help me with sample code or help?
    Regards
    Regards
    Taton
    Edited by: Taton on Mar 7, 2009 4:41 PM

    It's not possible to read from a file without using classes from the core API*. You'll have to get clarification from your instructor as to which classes are and are not allowed.
    [http://java.sun.com/docs/books/tutorial/essential/io/]
    *Unless you write a bunch of JNI code to replicate what the java.io classes are doing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • I have a VI and an attched .txt data file. Now I want to read the data from the .txt file and display it as an array in the front panel. But the result is not right. Any help?

    I have a VI and an attched .txt data file. Now I want to read the data from the .txt file and display it as an array in the front panel. But the result is not right. Any help?
    Attachments:
    try2.txt ‏2 KB
    read_array.vi ‏21 KB

    The problem is in the delimiters in your text file. By default, Read From Spreadsheet File.vi expects a tab delimited file. You can specify a delimiter (like a space), but Read From Spreadsheet File.vi has a problem with repeated delimiters: if you specify a single space as a delimiter and Read From Spreadsheet File.vi finds two spaces back-to-back, it stops reading that line. Your file (as I got it from your earlier post) is delimited by 4 spaces.
    Here are some of your choices to fix your problem.
    1. Change the source file to a tab delimited file. Your VI will then run as is.
    2. Change the source file to be delimited by a single space (rather than 4), then wire a string constant containing one space to the delimiter input of Read From Spreadsheet File.vi.
    3. Wire a string constant containing 4 spaces to the delimiter input of Read From Spreadsheet File.vi. Then your text file will run as is.
    Depending on where your text file comes from (see more comments below), I'd vote for choice 1: a tab delimited text file. It's the most common text output of spreadsheet programs.
    Comments for choices 1 and 2: Where does the text file come from? Is it automatically generated or manually generated? Will it be generated multiple times or just once? If it's manually generated or generated just once, you can use any text editor to change 4 spaces to a tab or to a single space. Note: if you want to change it to a tab delimited file, you can't enter a tab directly into a box in the search & replace dialog of many programs like notepad, but you can do a cut and paste. Before you start your search and replace (just in the text window of the editor), press tab. A tab character will be entered. Press Shift-LeftArrow (not Backspace) to highlight the tab character. Press Ctrl-X to cut the tab character. Start your search and replace (Ctrl-H in notepad in Windows 2000). Click into the Find What box. Enter four spaces. Click into the Replace With box. Press Ctrl-V to paste the tab character. And another thing: older versions of notepad don't have search and replace. Use any editor or word processor that does.

  • HT201272 Need to sync apps from my friends iphone to my ipad using itunes. How can be that done?Please advise.

    Need to sync apps from my friends iphone to my ipad using itunes. How can be that done?Please advise.

    Well first you need to sync your iPhone 4 with your Mac/PC so that it will transfer all your music, apps, podcasts, etc. Then sync your iPod Touch and the media you selected during the sync should be there on your iPhone. If you have difficulty in transferring media from iPhone to your computer, try softwares like TransCopy. They will help in transferring data from your iphone to your computer. Dont forget to check that all the transferred data is in the iTunes media folder so that the iTunes can locate the files. Link to Transcopy software :
    http://www.copytrans.net/copytrans.php

  • Reading Data From A Text File via AppleScript

    Here is my question. I have a text file I need to read data from....this is what the text file looks like opened in text editor:
    "SLUG
    , 06/16/06, APPLE COMPUTER INC , 69x8.50, jondnotin
    now what I need to do is get the 69 and the 8.50 as seperate variables...now every file that is going to be read is setup the same with different information but the data type is the same and in the same order. So what syntax do I need to read this file and set thoes two numbers to variables? Thanks!
    PowerMac G5, iBook G4, Intel MacMini, PowerMac G3 B&W, iMac DV Blueberry   Mac OS X (10.4.7)  

    Hello
    You where right for the file structure.
    I think that it is a complementary reason to locate the data whithout assuming that it sit in paragraph x or y.
    The trailing script get rid of that and allow to grab values from a file containing more than a single entry.
    --[SCRIPT]
    set leChemin to "Macintosh HD:Users:yvankoenig:Desktop:_testfile.txt"
    set {val1, val2} to my decipher(read file leChemin, "APPLE COMPUTER INC , ")
    display dialog "" & val1 & return & val2
    -- -+-+-+-+-+-+-+-
    on decipher(t, d)
    set {oTID, AppleScript's text item delimiters, texte} to {AppleScript's text item delimiters, d, t}
    set {texte, AppleScript's text item delimiters} to {text item 2 of texte, ","}
    set {texte, AppleScript's text item delimiters} to {text item 1 of texte, "x"}
    set {v1, v2, AppleScript's text item delimiters} to {text item 1 of texte, text item 2 of texte, oTID}
    return {v1, v2}
    end decipher
    -- -+-+-+-+-+-+-+-
    --[/SCRIPT]
    Yvan KOENIG (from FRANCE vendredi 8 septembre 2006 20:38:46)

  • Retrieve data from a text file and insert in table

    hi,
    i am writing an application which when executes would creates a user table and populates it with the data i.e. username and passwords taking it from a text file.
    i would like to know if anybody can help as to how can i retreive the user name and password for every insert statement that will be fired to populate the user table.
    thanks in advance for the help

    for csv try a little search:
    http://search.java.sun.com/Search/java?col=javafrm&qp=%2Bforum%3A31&qt=csv+import
    search for ini files:
    http://search.java.sun.com/Search/java?qt=ini+file&col=javafrm&rf=0&qp=%2Bforum%3A31
    hope this helps
    tobias

  • Reading data from a text file but can't use the data outside of the function.

    I am trying to load a variable from data in a text file.
    I can read the text file fine but the variable data seems
    only to be available with in the function that reads it.
    I need to use the variable data outside of the function.
    Does anyone have any suggestions to work around this issue?
    This is the actionscript code i'm using.
    var pathVars= new LoadVars();
    pathVars.onLoad=function(ok) {
    if(ok)
    trace("Loading");
    path_var=pathVars.path;
    trace("This is within the function "+path_var);
    pathVar0="This is within the function... "+path_var;
    Yet the path_var is available here fine.
    pathVars.load("mypath.txt");
    This is where the path_var becomes undefined
    trace("This is outside the function... "+path_var);
    pathVar1="This is outside the function... "+path_var;
    This
    is a download link for the FLA zip file
    This
    is a demo of the script loading the text file

    The external traces are being executed before the file is
    loaded.

  • Reading data from a text file into PAS - Dimension member names truncated

    Hi,
    I created a procedure to dump variables and data into a text file to load into another model. I used a semicolon as a field seperator.
    The data, measures and dimension members are dumped properly into a text file and no dimension member names are truncated .
    However when I read the data into  a measure, and I issue a peek command, dimension meber names are read in truncated
    and remain full names in the text file. Any reason for this? What do I need to do to prevent this from happening?
    THanks.
    Lungile

    Hi Lungile,
    The problem that you're likely having is that you haven't created a file description for the file from which you're reading.  When loading data into Application Server from a text file, you would normally go through three steps:
    1. Enter the ACCESS EXTERNAL subsystem
    2. Specify the name of the file to be read
    3. Specify the format of the file field names, types, widths, and positions.
    If you go into the Application Server help, select "Application Server Help", then "Application Server at the command level", then "Variables and reading in data", and then "Reading an external file", you will have the process of the steps you need to follow outlined for you, including links to the help topic for each command you need to issue.
    So what I think you need to do is use the DESCRIPTION command to specify the names of your fields, their type, and also their width, in order to ensure no truncation of data on the load.
    The same DESCRIPTION statement is required if you want to use your text file as the source of a dimension.
    Hope this helps,
    Robert

  • Reading data from a text file

    Okay so basically i need to read some text from a file, and display it in a JTextArea. My problem is that when i read the data and display it, its all in one big long line. e.g:
    in text file:
    Hi
    Hi
    Hi
    Hi
    in textarea:
    HiHiHiHi
    I was wondering if it is possible to use some kind of a method that determines when reading the file if its at the end of a line or not, then create a new line.
    this is part of my code:
    chooser is a JFileChoose object.
                             File theFile = new    File(chooser.getSelectedFile().getPath());
                             FileReader reader = new FileReader(theFile);
                             BufferedReader buffer = new BufferedReader(reader);
                             String ss;
                             String aa = "";
                             while((ss = buffer.readLine()) !=null) {
                                  aa = aa + ss;
                             text.setText(aa);
                             reader.close();
    //Rest of program continues here

    Hii , I think this will help you ,,,
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    import java.util.*;
       class Test5   extends JFrame
            JPanel mainPane;
            JButton doTestBtn = new JButton("Press");
            JTextArea show = new JTextArea(6,6);
            JFileChooser choose = new  JFileChooser();
            public Test5()
                 GridLayout gl = new GridLayout(1, 2);
                 gl.setHgap(10);
                 gl.setVgap(10); 
                 mainPane = new JPanel();
                 JPanel  side1 = new  JPanel();
                 JPanel  side2 = new  JPanel();
                 mainPane.add(side1);
                 mainPane.add(side2);
                 side1.add(doTestBtn);
                 side1.add(show);
                 doTestBtn.addActionListener(new ActionListener()
                     public void actionPerformed(ActionEvent e)
                          doTestBtnAction();
            private void doTestBtnAction()
                try
                   int tt =  choose.showOpenDialog(Test5.this);
                   if(tt == JFileChooser.APPROVE_OPTION )
                      File file = choose.getSelectedFile();
                      FileReader reader = new FileReader(file);
                      BufferedReader buffer = new BufferedReader(reader);
                          String ss;
                          String aa = "";
                          while((ss = buffer.readLine()) !=null)
                                  aa = aa + ss;
                      show.append(aa);
                      reader.close();
               }catch(IOException ex)
            private void createGUI()
                getContentPane().add(mainPane);
                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                setSize(200,100);
                pack();
                setVisible(true);
           private static void createAndShowGUI()
              Test5 rn = new Test5();
               rn.createGUI();
           public static void main(String[] args)
            javax.swing.SwingUtilities.invokeLater(new Runnable()
                public void run()
                    createAndShowGUI();
       }Thanks ,
    sb

Maybe you are looking for

  • How to call an external application from the current one

    Hi Guys, Im not sure if/how this is possible. For example: I have two projects : Project1 and Project 2. When I click on a button in Project2, Project1 needs to be launced. That is, the Main class of Project1 needs to be triggered. How do I do this?

  • Problem with Usage Dependencies

    Hello, we have a Web Dynpro Application (Migrating from 6.40 to 7.00) which uses Collaboration API: kmc.util.core_api.jar, coll.shared.roomobject_api.jar, coll.shared.types_api.jar and coll.shared.extension_api.jar. I found in SLD the SC  KMC COLLABO

  • PLEASE DONT TELL ME..........

    I just bought a brand new desktop. I have been busting my brain trying to figure out how to get the songs on my iTunes library from the old computer to the new one. Please don't tell me that once you register to one computer, you have to keep it for

  • How to create Web service proxy in Eclipse?

    Hi, I want to create web service proxy in Eclipse. Can someone tell me what all plug ins are needed for it and what is the detail procedure for the same? Thanks in advance.

  • I had a ipod nano 5th geberation and used to set the timer for 30 min to fall asleep with the radio.

    I used to have a Ipod nano 5th gen. and used the radio to fall asleep. I would set it for 30 minutes and it would shut off after 30 min. I bought a new ipod nano 7th gen I can't find this feature. Could someone help me?