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
What are the data types in qtp?
Explain how you can replace string in qtp?
How should I click on the right click menu objects When I trying to add the object properties to the OR.It is showing only Window(Window).Not all the objects of the window. Also while recording I found No script. How to solve this>.
What is the descriptive programming?
Get the count of files of similar types from a folder.
This is Karthic and my mail id is karthic.venkitapathi@gmail.com, please give me an idea to crack qtp 10
what is meant by function library?Public and private functions in function library? if private functions are applicable for only for the particular test means then y we have to add those to function library?
What are the features and benefits of quick test pro (qtp 8.0)?
What are the steps involved in recovery scenario wizard?
is there any addin for remedy user application
Approach for Installation,comaptibility,system testing
what is stepin & stepout?
what type of framework u r using in ur organization
Call to copy of an action and call to existing action… i know the diff but in real project how to use..? i want live scenario.pls help me..
Does Low-level recording capture mouse movements?