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


Please Help Members By Posting Answers For Below Questions

What are the data types in qtp?

659


Explain how you can replace string in qtp?

597


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>.

1530


What is the descriptive programming?

1505


Get the count of files of similar types from a folder.

964






This is Karthic and my mail id is karthic.venkitapathi@gmail.com, please give me an idea to crack qtp 10

1496


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?

1364


What are the features and benefits of quick test pro (qtp 8.0)?

588


What are the steps involved in recovery scenario wizard?

516


is there any addin for remedy user application

1737


Approach for Installation,comaptibility,system testing

1698


what is stepin & stepout?

1410


what type of framework u r using in ur organization

1640


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..

1273


Does Low-level recording capture mouse movements?

579