是否可以在运行时在QTP数据表或Excel表中动态添加新行?它必须是动态的,因为添加新行取决于输入数据返回的数据行数。它看起来没有任何方法可以在数据表或Excel中添加行,所以我不知道如何处理这个问题。根据现有列中的值在QTP中动态添加行
的数据表:6列和当前与4个帐户号码现在测试对于为行,所以它看起来像这样:
列1,列2,列3,第4栏第5栏第6栏 帐户1个 帐户2 帐户3 帐户4
的应用:Web应用程序,其具有帐号作为输入,并且可返回多行数据。目前,如果帐号号码返回多行数据,则会覆盖前一个条目。我需要它在上一行下面创建一个新行(这样它就不会),并覆盖上一个条目,并且b。)在下一个帐户的行上输入以前的帐户信息。
这里是审查的伪代码:
Dim Rowcount, webrowcnt
Rowcount=datatable.getsheet"Sheet name".GetRowCount
For i=1 to Rowcount
Datatable.GetSheet"Sheet name".SetCurrentRow(i)
Browser("").Page("").Link("").Click
Browser("").Page("").WebEdit("").Set DataTable("Row1", dtLocalSheet)
Browser("").Page("").WebButton("").Click
webrowcnt=Browser("").Page("").WebTable("").RowCount
For n=3 to webrowcnt (note: n=3 because the data I need starts on row 3)
If webrowcnt > 3 Then (note: this is where I want it to create a new row if there is more than 3 rows of data)
For i=4 to webrowcnt
some code here to create however many rows of data the account number has.
Next
End If
column1 = Browser("").Page("").WebTable("").GetCellData(n, 1)
DataTable("column1", dtLocalSheet)=column1
column2 = Browser("").Page("").WebTable("").GetCellData(n, 2)
DataTable("column2", dtLocalSheet)=column2
column3 = Browser("").Page("").WebTable("").GetCellData(n, 3)
DataTable("column3", dtLocalSheet)=column3
column4 = Browser("").Page("").WebTable("").GetCellData(n, 4)
DataTable("column4", dtLocalSheet)=column4
column5 = Browser("").Page("").WebTable("").GetCellData(n, 5)
DataTable("column5", dtLocalSheet)=column5
column6 = Browser("").Page("").WebTable("").GetCellData(n, 6)
DataTable("column6", dtLocalSheet)=column6
Browser("").Page("").Link("").click (note: link to return to home page to restart on new account number)
Next