This discussion is archived
1 Reply Latest reply: Oct 25, 2012 6:21 AM by 834498 RSS

Writing dynamic value to a text file in Openscript

970447 Newbie
Currently Being Moderated
How to write the dynamic values which i captured in a variable into a text file in openscript ? I searched throughout the user guide and i don't find any option for that. Please help, thanks in advance..
  • 1. Re: Writing dynamic value to a text file in Openscript
    834498 Journeyer
    Currently Being Moderated
    One method using Export Table to CSV

    import oracle.oats.scripting.modules.basic.api.*;
    // Class DOMTable
    //export table content to a CSV file.
    public void exportToCSVFile(String filePath, boolean overWrite) throws AbstractScriptException, IOException
         {return;}

    DOMTable maTable = null;
    maTable.exportToCSVFile("c:\\temp\\export.csv", false);


    OR to read & write in a file

    Read a file & write in another file
    String MonFichierSource = "C:\\Documents and Settings\\jmarzolf\\My Documents\\Clients\\CD-APPS\\DataBank\\CD-APPS-SBL.csv";
    String MonFichierDest = "C:\\Documents and Settings\\jmarzolf\\My Documents\\Clients\\CD-APPS\\DataBank\\CD-APPS-SBL-2.csv";
              
    Scanner MonScanSrc = new Scanner(new File(MonFichierSource));
    FileWriter MonFichierDst = new FileWriter(MonFichierDest);
    while (MonScanSrc.hasNextLine()) {
    String MaLigne = MonScanSrc.nextLine();
    if (MaLigne.contains("ALL USER RESPONSIBILITY")) {
         MonFichierDst.write(MaLigne);
         MonFichierDst.write("\r");}}
    MonScanSrc.close();
         MonFichierDst.close();

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points