51Testing软件测试论坛
标题:
怎么在datatable达到我想要的循环??
[打印本页]
作者:
kam
时间:
2009-4-29 23:48
标题:
怎么在datatable达到我想要的循环??
以下是FLIGHT上录制的脚本
[code]
For i=1 to 3
Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").ActiveX("MaskEdBox").Type "090909"
Window("Flight Reservation").WinComboBox("Fly From:").Select DataTable("p_Item", dtLocalSheet)
datatable.LocalSheet.setnextrow
For j=1 to 3
Window("Flight Reservation").WinComboBox("Fly To:").Select DataTable("p_Item1", dtLocalSheet)
datatable.LocalSheet.setnextrow
Next
Next
[localimg=400,250]1[/localimg]
我希望的循环是
london->denver frn->port london->paris fran->den fran->port fran->paris seattle->denver sea->port sea->paris 3*3
而上面的代码实际上运行的是london->denver frn->port london->paris fran->port fran->paris sea->paris 3*2
怎么样代码才能达到我希望的循环??
[attach]51468[/attach]
作者:
kam
时间:
2009-4-29 23:52
上面有段写错了。我这修改下
我希望的循环是
london->denver lond->port london->paris fran->den fran->port fran->paris seattle->denver sea->port sea->paris
而上面的代码实际上运行的是london->denver lon->port london->paris fran->port fran->paris sea->paris
作者:
lijinshui
时间:
2009-4-30 08:34
我知道了
因为 datatable.LocalSheet.setnextrow
你执行了两遍 删掉第一个就可以了
作者:
lijinshui
时间:
2009-4-30 08:45
Dim tempa,tempb
Dim gj
For i=1 to 3
tempa = DataTable("AA", dtLocalSheet)
For j=1 to 3
tempb = DataTable("BB", dtLocalSheet)
msgbox "Tempa ->" & tempa & "Tempb ->" & tempb
gj = j
datatable.LocalSheet.setnextrow
Next
If gj = 3 Then
datatable.LocalSheet.setnextrow
End If
Next
上面这个代码可以实现你的要求,确认过了
作者:
wangshuman
时间:
2009-4-30 11:15
Dim tempa,tempb
For i=1 to 3
DataTable.GetSheet("Action1").setcurrentrow(i)
tempa = DataTable("Flyfrom", dtLocalSheet)
For j=1 to 3
DataTable.GetSheet("Action1").setcurrentrow(j)
tempb = DataTable("Flyto", dtLocalSheet)
msgbox Tempa&" ->" & tempb &vbCRLF
Next
Next
作者:
kam
时间:
2009-4-30 20:13
谢谢各位了。问题已经决绝了
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2