|
QTP的例子也有bug的...这是帮助中的一个方法..就不能执行,方法返回时写错了方法名
Function ItemByKeyColumn(Obj, KeyColumnIndex, KeyColumnValue, KeyItemIndex, TargetColumnIndex, micClass, TargetItemIndex)
Set Table = Obj
rowCount = Table.RowCount
' If TargetItemIndex was not specified, use 1 as default
If TargetItemIndex < 1 Then
TargetItemIndex = 1
End If
' If KeyColumnIndex was not specified, use 1 as default
If KeyItemIndex < 1 Then
KeyItemIndex = 1
End If
' Look for KeyColumnValue in the key column to determine from which
' row to retrieve the target item
Row = 0
foundIndex = 0
While Row <= RowCount And foundIndex < KeyItemIndex
Row = Row + 1
CellData = Table.GetCellData(Row, KeyColumnIndex)
If CellData = KeyColumnValue Then
foundIndex = foundIndex + 1
End If
Wend
If foundIndex < KeyItemIndex Then
Exit Function
End If
' Now that we know the row, retrieve the item (according to its micClass)
' from the target column.
ChildItemsCount = Table.ChildItemCount(Row, TargetColumnIndex, micClass)
If ChildItemsCount >=1 And ChildItemsCount >= TargetItemIndex Then
Set GetItemByKeyColumn = Table.ChildItem(Row, TargetColumnIndex, micClass, TargetItemIndex-1)
End If
End Function |
|