Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can anyone help me with my script.

Status
Not open for further replies.

Rad999

Technical User
Nov 15, 2006
22
CA
Need help with Script.
Ours is a financial Market product for Trade exchanges.

Functionality is to pick up XML file load it and check the content using XML checkpoint.I just need help with the looping part so that it works for all the three ina single run.
The existing script is running fine for any of one exchange at a time.How do i make my script intelligent to run for all the three exchanges in one run.Below is the script:
FilePath= DataTable("ETMXMLFilePath", dtLocalSheet)

Dim fso: Set fso=createObject("Scripting.fileSystemObject")
Dim CurrentFolder: Set CurrentFolder = fso.GetFolder(FilePath)
Dim Nameoffile, MM,YY,DD, MyTime, AddressOfString,XMLFileDate,XMLFileName1,FileNameWithPath
Dim MyArray
Mytime = Now
MM = Month(Mytime)
YY = Year(Mytime)
DD = Day(Mytime)

FileName = "XNYS_"+CStr(YY) +"-"+CStr(MM)+"-"+CStr(DD)

XMLFileDate=CStr(YY) +"-"+CStr(MM)+"-"+CStr(DD)
DataTable.GetSheet("CheckETM-XMLFile").GetParameter("XMLFileDate").Value=XMLFileDate

Dim Files: Set Files = CurrentFolder.Files
Dim File

For Each File In Files


if CStr(MID(File.Name, 1,15)) = CSTR(FileName) Then
XMLFileName1 = File.Name

End If
Next

msgbox XMLFileName1

FileNameWithPath=FilePath+"\"+XMLFileName1
DataTable.GetSheet("CheckETM-XMLFile").GetParameter("XMLFileName").Value= FileNameWithPath
XMLFile("XTSE_2006-11-14T16_17_57").Check CheckPoint("XTSE_2006-11-14T16_17_57")

XNYS is the name of the exchange.The other two exchanges are XTSE and FORX.
The script is good for anyone of the three exchanges.But I have to run all the three exchanges in one script.Can anyone please help.I am pretty new to QTP and Scripting.

 
Your Code:
MM = Month(Mytime)
YY = Year(Mytime)
DD = Day(Mytime)

FileName = "XNYS_"+CStr(YY) +"-"+CStr(MM)+"-"+CStr(DD)
************************************************************
Instead of hardcoding the name of exchange in your script. Try Parameterizing it. A probable solution would be as follows:-

FileName = Datatable("ExcgName","Global")+CStr(YY) +"-"+CStr(MM)+"-"+CStr(DD)

Where the datasheet will have all the 3 entries on different rows:
Column Name: ExcgName
Row 1: XNYS
Row 1: XTSE
Row 1: FORX

Run the test on all the 3 rows.

Tweak the code further,

All the best.
 
Thanks A Lot for taking your time to reply.I really appreciate it.
 
Actually by the time you replied I have used InputBox method.But Parameterising Exchange is also a good idea which I thought at that moment but didnt work at that time cause of the checkpoints.Now when I think of it i guess it works cause I can use select statement for checkpoint so each iteration it picks up the related checkpoint for the exchange.

Thankyou
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top