How to open and read data from text file in PL/SQL

We have a project ,need to open a file containing entries of data
,then process those data records one by one to update the
database.This operation shoulbe be done in the database
enviroment. Is there any hint about the file operation in
PL/SQL? How to open the file and get one record ,maybe one line,
and parse and get the data field ?
thanks
defang

There was also a question on this over at AskTom
(asktom.oracle.com) about a week ago complete with sample code.
The pointer to the sample code is here:
<A HREF="http://asktom.oracle.com/pls/ask/f?
p=4950:8:::::F4950_P8_DISPLAYID:464420312302
TARGET=_blank>http://asktom.oracle.com/pls/ask/f?
p=4950:8:::::F4950_P8_DISPLAYID:464420312302</A>
Admittedly it's about Win95, but the principles should apply.
Yours faithfully, Graham Reeds.
[email protected] | http://omnieng.co.uk/

Similar Messages

  • Read data from text file and displaying on Webdynpro

    Hi all,
    I need some help. I have a text file with set of  name, phonenumbers . I want to know how to display the data using Webdynpro. Could some one help me. help is appreciated and I promise to award points for right answer.
    Thank you
    Maruti

    Hi Maruti,
    just open the file and loop on the rows, here an example::
    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.IOException;
    FileReader f =  new FileReader("c:
    FileName.ext");
    while ((s = in.readLine()) != null)
    //Here you can put the line into a WD context structure, i.e:
    wdContext.currentContoEconomicoFormElement().setField(s);
    }catch (Exception e) {.....}
    in.close();
    f.close();
    For any others questions, please, let me know.
    Vito

  • Read data from text file one by one using for loop

    Dear Forum
    I want to read data of single colum of text file inside the for loop one by one(for each iteration value must be replaced by another value of text file).This value is used by a formula inside for loop. also after completion of iterations the values must be plotted on xy graph. How to do it.? please help me.
    profravi

    It's not very efficient to read a file line by line. Much simpler to read it all at once and then auto-index the results inside a for loop. The image below shows a generic solution to your problem. This assumes that the data in the file is in a single column.
    I would also recomend checking ou the learning LabVIEW resources here.
    I would aslos suggest that since this type of question is not specific to either NI-Elvis or the LabVIEW SE, you should post similar questions to the LabVIEW board. If you have problems, attaching a sample of the text file would help.
    Message Edited by Dennis Knutson on 10-18-2007 09:11 AM
    Attachments:
    XY Graph From File.PNG ‏4 KB

  • Student in distress: Read data from text file to fill a JTable

    I'm already late 2 weeks for my project and I still can't figure this out :(
    The project is made of 3 classes; the main one is Viewer.java; it creates the interface, Menu.java that manages the menu and the methods related to it and finally JTableData.java that extends JTable ( This is the part that I don't really understand)
    In the class MENU.JAVA I wrote the method jMenuOpen_actionPerformed(...) for the button OUVRIR (Open) that let's me select the file to read, then puts the content in a 2D table. Here' s my problem: I have to somehow update the content of the table created in VIEWER.JAVA with the content read from the file (cvs file delimited by ";") using a JTableData object (?)
    //THIS IS THE FIRST CLASS VIEWER.JAVA THAT CONTAINS THE MAIN METHOD
    //AND CREATES THE INTERFACE
    package viewer;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Viewer extends JFrame {
      public Menu menu = null;
      GridLayout gridLayout1 = new GridLayout();
      JTabbedPane jTabbedPane = new JTabbedPane();             
      JTableData jTableInfo = new JTableData(30, 7);
      public Viewer() {
              addWindowListener(new WindowAdapter()
              {               public void windowClosing(WindowEvent e)
                        dispose();
                        System.exit(0);
            try 
                jbInit();
                this.setSize(1000, 700);
                this.setVisible(true);
            catch(Exception e)
                e.printStackTrace();
      public static void main(String[] args) {
          Viewer viewer = new Viewer();
      private void jbInit() throws Exception {
        menu = new Menu(this);
        gridLayout1.setColumns(1);
        this.setTitle("Viewer");
        this.getContentPane().setLayout(gridLayout1);
        jTableInfo.setMaximumSize(new Dimension(0, 64));
        jTableInfo.setPreferredSize(new Dimension(0, 64));
        //TO DO Partie de droite
        JTabbedPane webViewerTabs = new JTabbedPane();
        //972 3299
        //java.net.URL URL1 = new java.net.URL("http://www.nba.com");
        //java.net.URL URL2 = new java.net.URL("http://www.insidehoops.com");
        //java.net.URL URL3 = new java.net.URL("http://www.cnn.com");
        JEditorPane webViewer01 = new JEditorPane();
        webViewer01.setEditable(false);
        //webViewer01.setPage(URL1);
        JEditorPane webViewer02 = new JEditorPane();
        webViewer02.setEditable(false);
        //webViewer02.setPage(URL2);
        JEditorPane webViewer03 = new JEditorPane();
        webViewer03.setEditable(false);
        //webViewer03.setPage(URL3);
        webViewerTabs.addTab("Site01", webViewer01);
        webViewerTabs.addTab("Site02", webViewer02);
        webViewerTabs.addTab("Site03", webViewer03);
        jTabbedPane.add(webViewerTabs);
            //End TO DO   
        this.getContentPane().add(jTableInfo);
        this.getContentPane().add(jTabbedPane);
        this.setJMenuBar(menu);  
    //This is the MENU.JAVA CLASS WHERE I OPEN THE FILE, READ THE
    //CONTENT AND WHERE I SHOULD SEND THE DATA TO THE TABLE.
    //Title:        Menu
    //Author:       Luc Duong
    package viewer;
    import javax.swing.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    public class Menu extends JMenuBar {
      JMenu jMenu1 = new JMenu();
      JMenuItem jMenuNew = new JMenuItem();
      JMenuItem jMenuOpen = new JMenuItem();
      JMenuItem jMenuSave = new JMenuItem();
      JMenuItem jMenuExit = new JMenuItem();
      JMenuItem jMenuApropos = new JMenuItem();
      JFileChooser fileChooser = new JFileChooser();
      Viewer viewer = null;
      boolean isFileChanged = false;
      private File fileName;
      static String data [][] = new String[7][9];
      public int lineCount;
      public Menu(Viewer viewer) {
        try  {
          jbInit();
          this.viewer = viewer;
          this.add(jMenu1);
        catch(Exception e) {
          e.printStackTrace();
      private void jbInit() throws Exception {
        jMenu1.setText("Fichier");
        jMenuNew.setText("Nouveau");
        jMenuNew.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jMenuNew_actionPerformed(e);
        jMenuOpen.setText("Ouvrir");
        jMenuOpen.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jMenuOpen_actionPerformed(e);
        jMenuSave.setText("Sauvegarder");
        jMenuSave.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jMenuSave_actionPerformed(e);
        jMenuExit.setText("Quitter");
        jMenuExit.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jMenuExit_actionPerformed(e);
        jMenuApropos.setText("A propos");
        jMenuApropos.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            jMenuApropos_actionPerformed(e);
        jMenu1.add(jMenuNew);
        jMenu1.add(jMenuOpen);
        jMenu1.add(jMenuSave);
        jMenu1.add(jMenuExit);       
        jMenu1.add(jMenuApropos);   
      void jMenuNew_actionPerformed(ActionEvent e) {
      //THIS IS THE METHOD I'M WORKING ON RIGHT NOW
      void jMenuOpen_actionPerformed(ActionEvent e) {
          fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
          int result = fileChooser.showOpenDialog(this);
          if (result == JFileChooser.CANCEL_OPTION) return;
          if (result == JFileChooser.APPROVE_OPTION)
              //[email protected]
              File chosenFile = fileChooser.getSelectedFile();
              String path = chosenFile.getPath();
              String nom = chosenFile.getName();
              boolean exist = chosenFile.exists();
              try
                FileReader fr = new FileReader(chosenFile);
                BufferedReader reader = new BufferedReader(fr);
                System.out.println("Opening File Successful!" + chosenFile.getName());
                //String  qui contient la ligne courante
                String currentLine = new String();
                StringTokenizer currentLineTokens = new StringTokenizer("");
                int row = 0;
                int column = 0;
                while( (currentLine = reader.readLine() ) != null)
                    currentLineTokens = new StringTokenizer(currentLine,";");
                    System.out.println("Now reading line index: " + row);
                    while(currentLineTokens.hasMoreTokens())
                        data[row][column] = currentLineTokens.nextToken();
                        System.out.println(column + "\t" + data[row][column]);
                        if(column>=8) column=-1;
                        column++;
                    row++;
                lineCount = row-1;
                System.out.println("\nNombre total de lignes: " + lineCount);
            catch(Exception ex)
                System.out.println("Test: " + ex.getMessage());
                JOptionPane.showMessageDialog(this, "Erreur d'ouverture du fichier", "Erreur d'ouverture du fichier", JOptionPane.ERROR_MESSAGE);
      void jMenuSave_actionPerformed(ActionEvent e) {
          if (JFileChooser.APPROVE_OPTION == fileChooser.showSaveDialog(this))
                System.err.println("Save: " + fileChooser.getSelectedFile().getPath());     
      void jMenuExit_actionPerformed(ActionEvent e) {
        if (!isFileChanged)
           System.exit(1);
        else
            JOptionPane.showConfirmDialog(null, "Do you want to save now?", "Save?", JOptionPane.YES_NO_OPTION);
          // ask the user if he want to save
          // yes or no?
          // yes
           jMenuSave_actionPerformed(e);
          // no
          System.exit(1);
      void jMenuApropos_actionPerformed(ActionEvent e) {
    //THIS IS THE JTABLEDATA.JAVA CLASS THAT EXTENDS JTable. I'm not sure
    // how this works :(//Title: JTableData
    //Author: Luc Duong
    package viewer;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class JTableData extends JTable {
    public JTableData(int row, int col)
    super(row, col);

    Hi, Salut
    you should use JTable's DataModel to update your table.
    data[row][column] = currentLineTokens.nextToken();
    jTableInfo.getModel().setValueAt(data[row][column], row, column);
    jTableInfo.repaint();BEWARE CSV files and StringTokenizer, i've had problems with it (for example ;;Test; is not tokenized "", "", "Test")
    StringTokenizer ignores separator when in first position, and ignores double separators. I use this piece of code before tokenize a String :
    private static char _separator = ';';
    private static String checkCsvString(String s) {
             * V�rification du s�parateur inital, perdu par le StringTokenizer et
             * pourtant bien important
            if (s.startsWith("" + _separator)) {
                s = " " + s;
             * V�rification des doubles s�parateurs, perdus par le StringTokenizer
            int index;
            while ((index = s.indexOf("" + _separator + _separator)) >= 0) {
                s = s.substring(0, index) + _separator + " " + _separator + s.substring(index + 2);
            return s;
        }hope it helps
    Nico

  • Uploading Excel File and Reading Data from that File

    <b>Hi
    Can anyone Please tell me how to upload an Excel File in to the Web Dynpro Application and After that i want to read the data from that uploaded excel file in the Web Dynpro Application to the Web Dynpro table.
    Plz help me to solve this.......
    Regards
    Chandran</b>

    Hi,
    Upload Excel file using File Upload UI
    1)Add jxl jar folder in the lib folder of ur project.
    2)Go to properties of ur project and add jar to ur project.
    3)Using the File upload ui ,browse and upload the file.
    4)Write the read file in to ur server location using fileoutput stream.
    5)then using code u can read the excelfile from the server location itself.
    Here is the code:
         IWDAttributeInfo attInfo =wdContext.getNodeInfo().getAttribute("upload");
    /** get the name of excel file and storing it in the server with the same name and extention****/
    binaryType=IWDModifiableBinaryTypeattInfo.getModifiableSimpleType();
    fileuploaded = binaryType.getFileName();
    byte b[] = wdContext.currentContextElement().getUpload();
    File filename =new File("
    <Server name>
    <folde name>
    " + fileuploaded);
    try {
    FileOutputStream out = new FileOutputStream(filename);
    out.write(b);
    out.close();
    } catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    /**Readind from the server**/
    int iRows = 0;
    try {     Workbook wb = null;
         Sheet sheet = null;
         wb = Workbook.getWorkbook(filename);
         sheet = wb.getSheet(0);
         int iColumns = sheet.getColumns();
          iRows = sheet.getRows();
         int i = 0;
        //get Cell contents by (COLUMN, ROW);
        for (int r = 0; r < iRows; r++) {
       for (int c = 0; c < iColumns; c++) {
         Cell cell = sheet.getCell(c, r);
         characterarray<i> = cell.getContents();
    //wdComponentAPI.getMessageManager().reportSuccess("Row"r characterarray<i>);
    i++;
    wb.close();
    Declare Globally
    //@@begin others
    String fileuploaded;
    IWDModifiableBinaryType binaryType;
    String characterarray[] = new String[1000];
    //@@end
    Also look at this blog too  /people/perumal.kanthan/blog/2005/03/21/reading-excel-data-from-java-using-hssf-api
    Thanks and Regards,
    Arun

  • Applescript to read data from text file

    Hello all, I am writing an Applescript to read a file and put that file's contents into a variable. However, when I use the applescript command "read", I get the error:
    The text file reads "4.65". I need to extract that number to show up in a dialog box. This is the code I have so far.
    set milefile to ("Macintosh HD:Users:RyanSiebecker:Documents:Scripts:Source-Files:Running-Files:milefile.tx t")
    set theFileContents to (read file milefile)
    I am stuck and I cannot find any other way to do this.
    As always, any help is appreciated.
    Thanks, Ryan

    Have you noticed that your file name's extension (".tx t") has a space in it?  Though that mismatch would get a -43 Not Found error, not EOF.
    Your code ( with and without the gapped extension) works here. 
    Maybe the path isn't perfect?
    To make a perfect path easily, start with this:
         set milefile to POSIX file ("")  -- note the null string ("")
    Then arrange your windows so that you can drag the icon representing your file from wherever it is in the Finder's world into your AppleScript Editor's window, and carefully drop it right between the ""s.
    If you miss, don't worry.  It'll be selected, so just Cut and then Paste it between the ""s.  You'll get a perfect path, only with slashes instead of colons.  The "POSIX file" specifier converts it to "colon notation", still perfectly.
    --Gil

  • Read data from Excel file and diaplay in Webdynpro

    Hi all,
    I need some help. I have a Excel file with set of  name, phonenumbers . I want to know how to display the data using Webdynpro. Could some one help me. help is appreciated and I promise to award points for right answer.
    Thank you
    Maruti

    <b>Hi
    i can explain you to read data from Excel file
    First You have to download the jxl.jar file. You can get this file from the Below site
    </b><a href="http://www.andykhan.com/jexcelapi/download.html">jexcelapi jar</a>
    It will be in Compressed Fromat So Unzip it to get the Contents
    After Unzipping The File You will get a Folder (jexcelapi/jxl.jar)
    Now in NWDS open web dynpro explorer, Right Click Your Project, a popup menu will appear and in that click Properties
    You will get window displaying your Project Properties
    On Left Side of the window You Will Find "Java Build Path"
    Click That "Java Build Path" and you will get 4 Tabs Showing ( Source,Projects,Libraries,Order and Export)
    Click Libraries Tab
    You will find options many options buttons
    In that click the Button "Add External Jars"
    You will get Window in order to fecth the jxl.jar file from the location you had stored
    After selecting the jxl.jar i will get displayed and click ok
    Now Open Navigator
    Open Your Project
    You will find Lib folder
    Copy the jxl.jar to that lib folder
    Note : You cannot Read the Content from the excel file directly
    First You Have to copy that file to the Server,
    And from the Server you can get the file absolute path
    With the absolute path you can read the contents of the Excel file
    You have to save the Excel file as .xls Format and Not as xlsx format i will not accept that...
    You have Upload the Excel file from the Server Using the File Upload UI Element
    This Coding will extract 3 columns from the Xls File
    Coding
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import jxl.Cell;
    import jxl.Sheet;
    import jxl.Workbook;
    import com.sap.fileupload.wdp.IPrivateFileUpload_View;
    import com.sap.tc.webdynpro.services.sal.datatransport.api.IWDResource;
    public void onActionUpload_File(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionUpload_File(ServerEvent)
        IPrivateFileUpload_View.IContextElement element1 = wdContext.currentContextElement();
        IWDResource resource = element1.getFileResource();
        element1.setFileName(resource.getResourceName());
        element1.setFileExtension(resource.getResourceType().getFileExtension());
        //@@end
    public void onActionUpload_File_in_Server(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionUpload_File_in_Server(ServerEvent)
        InputStream text=null;
        int temp=0;
        try
             File file = new File(wdContext.currentContextElement().getFileResource().getResourceName().toString());
             FileOutputStream op = new FileOutputStream(file);
             if(wdContext.currentContextElement().getFileResource()!=null)
                  text=wdContext.currentContextElement().getFileResource().read(false);
                  while((temp=text.read())!=-1)
                       op.write(temp);                                      
             op.flush();
             op.close();
             path = file.getAbsolutePath();
             wdComponentAPI.getMessageManager().reportSuccess(path);
        catch(Exception e)
             e.printStackTrace();
        //@@end
    public void onActionUpload_Data_into_Table(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionUpload_Data_into_Table(ServerEvent)
        try
              Workbook wb =Workbook.getWorkbook(new File(path));
              Sheet sh = wb.getSheet(0);
              //wdComponentAPI.getMessageManager().reportSuccess("Columns = "+sh.getColumns());
              //wdComponentAPI.getMessageManager().reportSuccess("Rows = "+sh.getRows());
              int columns = sh.getColumns();
              int rows = sh.getRows();
              int i=0;
             for(int j=1;j<=rows;j++)
                       ele=wdContext.nodeTable_Data().createTable_DataElement();
                       Cell c1 = sh.getCell(i,j);
                      ele.setTab_Name(c1.getContents());
                       Cell c2 = sh.getCell(i+1,j);
                       ele.setTab_Degree(c2.getContents());
                          Cell c3 = sh.getCell(i+2,j);
                       ele.setTab_Percentage(c3.getContents());
                       wdContext.nodeTable_Data().addElement(ele);
        catch(Exception ex)
             wdComponentAPI.getMessageManager().reportSuccess(ex.toString());
        //@@end
       * The following code section can be used for any Java code that is
       * not to be visible to other controllers/views or that contains constructs
       * currently not supported directly by Web Dynpro (such as inner classes or
       * member variables etc.). </p>
       * Note: The content of this section is in no way managed/controlled
       * by the Web Dynpro Designtime or the Web Dynpro Runtime.
      //@@begin others
      String path;
      IPrivateFileUpload_View.ITable_DataElement ele;
    //@@end
    Regards
    Chandran S

  • Reading Data from Unix file and write into an Internal table

    Dear all,
                     I am having an requirement of reading data from unix file and write the same into an internal table..how to do that ...experts please help me in this regard.

    Hi,
    do like this
    PARAMETERS: p_unix LIKE rlgrap-filename OBLIGATORY.
    DATA: v_buffer(2047) TYPE c.
    DATA: BEGIN OF i_buffer OCCURS 0,
            line(2047) TYPE c,
    END OF i_buffer.
    * Open the unix file..
    OPEN DATASET p_unix FOR INPUT IN TEXT MODE.
    <b>IF sy-subrc NE 0.
    *** Error Message "Unable to open file.
    ELSE.</b>
       DO.
         CLEAR: v_buffer.
         READ DATASET p_unix INTO v_buffer.
         IF sy-subrc NE 0.
            EXIT.
         ENDIF.
         MOVE v_buffer TO i_buffer.
         APPEND i_buffer.
      ENDDO.
    ENDIF.
    CLOSE DATASET p_unix.
    <b>Reward points if it helps,</b>
    Satish

  • How read data from *.LB File in LabVIEW?

    Hi dear specialist,
    How I can read data from  *.LB File in LabVIEW?
    Thanks` Hovo

    Thanks Ben, but when I open it as datalog file` comes following error:
    Error 71 occurred at Open/Create/Replace Datalog in Simple Temp Datalog Reader.vi
    Error 71 occurred at Open/Create/Replace Datalog in Simple Temp Datalog Reader.vi
    Possible reason(s):
    LabVIEW:  File datalog type conflict.
    C:\Documents and Settings\Home\Desktop\a.lb
    Here is an example of lb file (a.lb), and here is a VI for read datalog file(Simple Temp Datalog Reader.vi)
    What means this error?
    How I can read a byte at a time?
    Attachments:
    testForLB.zip ‏101 KB

  • How to read data from a file in OSB

    hi guys,
    Recently, I've got a problem with reading file from specific location. I've actually followed this post OSB 11g - Read or Poll File in OSB - Oracle Fusion Middleware Blog, and then
    I know how to read a file. However, it does not as expected. Because, I've found no way to read data from the file. Therefore, no chance to manipulate the data like assigning to a variable, or extracting ....
    Hence, is there any way to read data from file by using proxy service in OSB ??? No Java code ???
    by the way, supposed that there is no way to read data from a file in OSB. So, What purposes will the way in the post above be used for?
    Many thanks in advance

    http://jakarta.apache.org/poi/hssf/index.html
    HSSF stands for Horrible Spreadsheet Format, but it still works!

  • How to read data from a file that was formatted by excel?

    Hi everyone, I'm familiar with java.io and the ability to read from files, can anyone tell me how to read data from a file that was formatted by excel? Or at least give me some web references so that I can learn about it?

    http://jakarta.apache.org/poi/hssf/index.html
    HSSF stands for Horrible Spreadsheet Format, but it still works!

  • Best way to control and read data from multiple instruments?

    Hello,
    I'm building an application to test power supplies involving multiple pieces of equipment over a couple of different comm busses. The application will also send control instructions to some of the instruments, and read data from some of the instruments. The reading and control profiles will not run on the same schedule (variable length control steps, configurable read interval).
    I was thinking of using a queued statemachine (producer/consumer) for the control profile and another to read the data, but I got concerned that there would be collisions between sending control commands and read commands to the same machine. Is there a suggested design pattern for implementing something like this?
    Timing of the commands isn't critical down to the milisecond, but I need to collect reasonably accurate timestamps when the data is read. The same is true for the control commands.
    Here are the instruments I'm going to use, if the are control, read, or both, and the communication method
    Instrument Funtions Comm Method
    Power Supply Read data Communicates to PMBus Adapter
    PMBus to USB Adapter Read data USB (Non-Visa)
    Switch control relays USB (VISA)
    Power Dist. Unit read data/control outlets SNMP (Ethernet)
    Electronic Load read data/control load GPIB (VISA)
    Thermal Chamber read data/control temp Ethernet (VISA)
    Thanks,
    Simon

    Hello, there is a template in LV called "Continuous measurement and Logging".
    It can give you some idea how to properly decouple the "GUI Event handler" top loop (where your Event structure is) from the DAQ and other loops.
    You do not need to totally replicate the above example, but you can find there nice tricks which can help you at certain points.
    The second loop from the top is the "UI message loop". It handles the commands coming from the top loop, and regarding to the local state machine and other possible conditions and states, it can command the other loops below.
    During normal run, the different instrument loops just do the data reading, but if you send a control command from the top loop to a certain instrument loop (use a separate Queue for every instrument loops), that loop will Dequeue the control command, execute it, and goes back to data reading mode (in data reading mode the loop Dequeu itself with a "data read" command automatically). In this way the control and data read modes happen in serial not in parallel which you want to avoid (but I think some instrument drivers can even handle parallel access, it will not happen in really parallel...).
    In every instrument loop when you read a value, attach a TimeStamp to it, and send this timestamp/value couple to the DataLogging loop via a Queue. You can use a cluster including 3 items: Source(instrument)/timestamp/value. All the instrument loops can use the same "Data logging" Queue. In the Datalogging while loop, after Dequeue-ing, you can Unbundle the cluster and save the timestamp and data-value into the required channel (different channel for every instrument) of a TDMS file.
    (Important: NEVER use 2 Event structures in the same top level "main" VI!)

  • Read data from xml files and  populate internal table

    Hi.
    How to read data from xml files into internal tables?
    Can u tell me the classes and methods to read xml data..
    Can u  explain it with a sample program...

    <pre>DATA itab_accontextdir TYPE TABLE OF ACCONTEXTDIR.
    DATA struct_accontextdir LIKE LINE OF itab_accontextdir.
    DATA l_o_error TYPE REF TO cx_root.
    DATA: filename type string ,
                 xmldata type xstring .
    DATA: mr      TYPE REF TO if_mr_api.
    mr = cl_mime_repository_api=>get_api( ).
    mr->get( EXPORTING  i_url     = 'SAP/PUBLIC/BC/xml_files_accontext/xml_accontextdir.xml'
                  IMPORTING  e_content = xmldata ).
    WRITE xmldata.
    TRY.
    CALL TRANSFORMATION id
          SOURCE XML xmldata
          RESULT shiva = itab_accontextdir.
      CATCH cx_root INTO l_o_error.
    ENDTRY.
    LOOP AT itab_accontextdir INTO struct_accontextdir.
        WRITE: / struct_accontextdir-context_id,
               struct_accontextdir-context_name,
               struct_accontextdir-context_type.
        NEW-LINE.
        ENDLOOP.</pre>
    <br/>
    Description:   
    In the above code snippet I am storing the data in an xml file(you know xml is used to store and transport data ) called 'xml_accontextdir.xml' that is uploaded into the MIME repository at path 'SAP/PUBLIC/BC/xml_files_accontext/xml_accontextdir.xml'.
    The below API is used to read a file in MIME repo and convert it into a string that is stored in ' xmldata'. (This is just a raw data that is got by appending the each line of  xml file).
    mr = cl_mime_repository_api=>get_api( ).
    mr->get( EXPORTING  i_url     = 'SAP/PUBLIC/BC/xml_files_accontext/xml_accontextdir.xml'
                  IMPORTING  e_content = xmldata ).
        Once the 'xmldata' string is available we use the tranformation to parse the xml string that we have got from the above API and convert it into the internal table.
    <pre>TRY.
    CALL TRANSFORMATION id
          SOURCE XML xmldata
          RESULT shiva = itab_accontextdir.
      CATCH cx_root INTO l_o_error.
    ENDTRY.</pre>
    Here the trasnsformation 'id ' is used to conververt the source xml 'xmldata' to resulting internal table itab_accontextdir, that have same structure as our xml file 'xml_accontextdir.xml'.  In the RESULT root of the xml file has to be specified. (In my the root is 'shiva'). 
    Things to be taken care:
    One of the major problem that occurs when reading the xml file is 'format not compatible with the internal table' that you are reading into internal table.  Iin order to get rid of this issue use one more tranformation to convert the data from the internal table into the xml file.    
    <pre>TRY.
          CALL TRANSFORMATION id
            SOURCE shiv = t_internal_tab
            RESULT XML xml.
        CATCH cx_root INTO l_o_error.
      ENDTRY.
      WRITE xml.
      NEW-LINE.</pre>
    <br/>
    This is the same transformation that we used above but the differnce is that the SOURCE and RESULT parameters are changed the source is now the internal table and result is *xml *string. Use xml browser that is available with the ABAP workbench to read the xml string displayed with proper indentation. In this way we get the format of xml file to be used that is compatable with the given internal table. 
    Thank you, Hope this will help you!!!
    Edited by: Shiva Prasad L on Jun 15, 2009 7:30 AM
    Edited by: Shiva Prasad L on Jun 15, 2009 11:56 AM
    Edited by: Shiva Prasad L on Jun 15, 2009 12:06 PM

  • Reading data From XML file and setting into ViewObject to Pouplate ADF UI

    Hi,
    I have following requirement.
    I would like to read data from XML file and populate the data in ViewObject so that the data can be displayed in the ADF UI.
    Also when user modifies the data in the ADF UI, it should be modified back into to ViewObject.
    Here is an example - XML file contains Book Title and Author. I would like to read Book Title and Author from XML file and set it into ViewObject Attribute and then display Book title and Author in ADF UI page. Also when user modifies Book title and Author, I would like to store it back in View Object.
    Please help me with this requirement and let me know if any solution exist in ADF, for populating the ADF UI screen fields with external XML file data.
    Thanks

    Read chapter 42 http://download.oracle.com/docs/cd/E16162_01/web.1112/e16182/bcadvvo.htm of the fusion developer guide
    Section 42.7, "Reading and Writing XML"
    Section 42.8, "Using Programmatic View Objects for Alternative Data Sources"
    Timo

  • How to write and read data in a specific memory location ??

    Hi Everyone:
    Does anyone know how to write and read data in a specific memory location by using Java ?
    I need pointers, but I don't know how to do it ??
    Thanks for answering
    Rodger

    Hi Everyone:
    Does anyone know how to write and read data in a
    specific memory location by using Java ?
    I need pointers, but I don't know how to do it ??
    Thanks for answering
    RodgerWith Java you cannot write to a specific memory location. Java does not have pointers. If you really want to do it, you need to use JNI, i.e write the required functions in C (or other languages that support pointers) and make those functions available to Java (through JNI). This approach is not portable. You can have a look at http://java.sun.com/docs/books/tutorial/native1.1/index.html
    Regards.

Maybe you are looking for

  • Changing the ImageIcon

    Hello, I've just about finished a program I've been working on for the last few weeks. But I need some help with one more thing. What I want to do is somehow build into my If and Else statements some code that will change the ImageIcon to a certain p

  • How much post-production is required to match wide and close-up shots from the Sony Z7U?

    I own a Sony HVR-Z7U and I am interested in knowing how much work would have to be done in AVID or Adobe Premiere Pro CC to match colors between wide shots and close-up shots taken from the Sony HVR-Z7U? The project in question is a movie trailer for

  • Lightroom 5 Sprache Mac nur Deutsch oder auch Englisch

    Hallo zusammen. Ich bin Mac user und möchte Lightroom Schüler edition in Deutschland kaufen, aber in englischer Sprache auf meinem Mac betreiben. Geht das, oder muss ich das Programm in England kaufen? Vielen Dank im Voraus, Uwe

  • Using new 3rd generations nano with OS 10.3.x

    Hi Got a new nano and want to use it with my emac. Messege is that new nano requires 10.4 or greater OS. Does anyone knows how the fix this without buying new OS for mu mac ?

  • WRT160N Downloads - no version 2 firmware or software upgrades?

    I just purchased a WRT160N v2 router and have spoken with Linksys tech support on the phone.  It was suggested to try a firmware upgrade on the router ASAP, but: When I go to the Linkys download page for the WRT160N https://www.linksysbycisco.com/CA/