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, aqFile.ctANSI);
sapFile.SetPosition(0, 0);
Log.Message(sapFile.LinesCount);
sapFile.Close();
}
The PHOENIX_ACTUALS is a text file and has 211 lines, LinesCount is returning 1 instead.
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();
}