How do u retrieve data from a text file into different
variables. i.e.
in a text file named "source" , the data is like :
india,1000,japan,200,china,50,singapore,45050
this is given in the first line of the text file.
in the second line of the text file the dta is:
sun,moon,planet,river,earth,water
if u use "readline" method by using FSO concept u can
retrieve the entire line in to a variable. but i want to
import each field (ex: "india" in one variable, "1000" in
another variable etc..). Apprecitae proper replies.
Answer Posted / kartheek
'try this cpde
Set fso = createobject("scripting.filesystemobject")
Set f = fso.OpenTextFile("C:\Documents and
Settings\kartheek\Desktop\Dummy.txt",1)
var1=f.ReadLine
k=1
var2=split(var1,",")
datatable.AddSheet("dummy")
datatable.GetSheet("dummy").AddParameter "country",""
datatable.GetSheet("dummy").AddParameter "number1",""
For i = 0 to ubound(var2)
datatable.GetSheet("dummy").SetCurrentRow(k)
If isnumeric(var2(i)) Then
datatable.GetSheet("dummy").GetParameter("number1").Value=var2(i)
k=k+1
else
datatable.GetSheet("dummy").GetParameter("country").Value=var2(i)
End If
Next
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
There are 10 rows in the datatable. How can we fetch 2 rows and then skip 3rd row. After that, pick 4th & 5th row and skip 6th row. Please share code
Hi All, How to Compare two strings character by character in QTP
before launching qtp, we need to close all the open browsers u dont know what are all the browsers either it might be ie,mozilla etc and u dont know how many brosers are open.... u need to close all these before launching qtp.. can anyone plz temme d solution...
what are the frame work models of qtp?which frame work you follow in your company?and explain it process?
An action has both shared and local OR associated with it and both have the same object in them. In the test which one will be considered?
what are the critical test cases in crm? tell me atleast 5 critical test cases? what are the critical bug u find out while testing crm domain?
What are the challenges you faced during you entire life automation ?
can u explain relative path architecture framework in qtp?
How to create scenario selector
Explain different type of event trigger option.
in my application,validation message has in japanise language.how to validate this message is appears properly or not
What is qtpro?
please give me the code for doing retesting of gmail login page using functions so the function has to give the value
What is file database?
Explain the use of action split in qtp?