Forum Discussion

amitbansal's avatar
amitbansal
Occasional Contributor
8 years ago

aqFile LinesCount fails to work

here is my function where I am using LinesCount and facing issue, language used is JScript function getLines(){  var sapFile;  sapFile = aqFile.OpenTextFile("PHOENIX_ACTUALS", aqFile.faRead, aqFil...
  • amitbansal's avatar
    amitbansal
    8 years ago

    Thanks for your reply.

    when I use the FS object as in below function it reads the lines and I am able to count the lines in count variable.

     

    function ReadFile(AFileName)
    {
      const ForReading = 1;
      let FS = Sys.OleObject("Scripting.FileSystemObject");

      let F = FS.OpenTextFile(AFileName, ForReading);
    count =0;  

    while(! F.AtEndOfStream){
        let s = F.ReadLine();
        count++;

      }
      F.Close();
    }