SilkTest Question:
Download Job Interview Questions and Answers PDF
While (FileReadLine (hFile, sMailData)) is not doing it for each line of the input file. How do I tell it to go on to the next line and add each string to the list and add the list to the master list of list?
Answer:
While (FileReadLine (hFile, sMailData)) is not doing it for each line of the input file. How do I tell it to go on to the next line and add each string to the list and add the list to the master list of list?
[+] LIST OF LIST OF STRING ParseMailFile ()
[ ] STRING sElement, sLine, sMailData
[ ] HANDLE hFile
[ ] LIST OF STRING lsMailData = {}
[ ] LIST OF LIST OF STRING llsMailData = {}
[ ] rMail Mail
[ ]
[ ] hFile = FileOpen (csDataDir+"Mail.txt", FM_READ)
[-] while (FileReadLine (hFile, sMailData))
[ ] ListAppend(lsMailData, GetField(sMailData, ",", 1))
[ ] ListAppend(lsMailData, GetField(sMailData, ",", 2))
[ ] ListAppend(lsMailData, GetField(sMailData, ",", 3))
[ ] ListAppend(lsMailData, GetField(sMailData, ",", 4))
[ ] ListAppend(lsMailData, GetField(sMailData, ",", 5))
[ ] ListAppend(lsMailData, GetField(sMailData, ",", 6))
[ ] ListAppend(lsMailData, GetField(sMailData, ",", 7))
[ ]
[ ] ListAppend(llsMailData,lsMailData)
[ ]
[ ] FileClose (hFile)
[ ] return llsMailData
[ ]
Just force it to start from first raw before the loop. Should go through each lines.
[+] LIST OF LIST OF STRING ParseMailFile ()
[ ] STRING sElement, sLine, sMailData
[ ] HANDLE hFile
[ ] LIST OF STRING lsMailData = {}
[ ] LIST OF LIST OF STRING llsMailData = {}
[ ] rMail Mail
[ ]
[ ] hFile = FileOpen (csDataDir+"Mail.txt", FM_READ)
[-] while (FileReadLine (hFile, sMailData))
[ ] ListAppend(lsMailData, GetField(sMailData, ",", 1))
[ ] ListAppend(lsMailData, GetField(sMailData, ",", 2))
[ ] ListAppend(lsMailData, GetField(sMailData, ",", 3))
[ ] ListAppend(lsMailData, GetField(sMailData, ",", 4))
[ ] ListAppend(lsMailData, GetField(sMailData, ",", 5))
[ ] ListAppend(lsMailData, GetField(sMailData, ",", 6))
[ ] ListAppend(lsMailData, GetField(sMailData, ",", 7))
[ ]
[ ] ListAppend(llsMailData,lsMailData)
[ ]
[ ] FileClose (hFile)
[ ] return llsMailData
[ ]
Just force it to start from first raw before the loop. Should go through each lines.
Download SilkTest Interview Questions And Answers
PDF
Previous Question | Next Question |
What is DBTester? | How to create group and sub group descriptions in a testplan? |