01-19-2014, 04:40 PM
Hi there,
we don't have any pure vbscripting methods to get the value from datasheet as it's a QTP specific feature.
Please find the below code which will get the required out out (if i understood your question correctly)
By default all the cells in the runtime datatable are editable. Use the value method of Datatable to edit the value. Note: you can see the new value in the runtime datatable only.
Let me know if you need any more info.
we don't have any pure vbscripting methods to get the value from datasheet as it's a QTP specific feature.
Please find the below code which will get the required out out (if i understood your question correctly)
Code:
msgbox GetDataTableCellValue(1,7,2)
Function GetDataTableCellValue(Sheet,Row,Col)
Dim iRowNumber
Dim siSheet
Dim sColumnName
iRowNumber = Row
siSheet= Sheet
sColumnName = GetParameterNumber(siSheet,Col)
If iRowNumber <= DataTable.GetSheet(siSheet).GetRowCount Then
DataTable.GetSheet(siSheet).SetCurrentRow iRowNumber
GetDataTableCellValue = DataTable.GetSheet(Sheet).GetParameter(sColumnName)
Else
msgbox "The Row '" & iRowNumber & "' does not exit. Please provide a valid row number.",0+16,"Invalid Row Number"
ExitTest
End If
End Function
Function GetParameterNumber(Sheet,sParameterNumber)
On Error Resume Next
Set oSheet = DataTable.GetSheet(Sheet)
If oSheet.GetParameterCount = 0 Then
'If Err.Number <>0 Then
msgbox "The sheet '" & Sheet & "' does not exit. Please provide a valid sheet name (or) number.",0+16,"Invalid DataSheet Name"
Set oSheet = Nothing
ExitTest
End If
If oSheet.GetParameterCount >= sParameterNumber Then
For iParNumber = 1 to oSheet.GetParameterCount
GetParameterNumber = oSheet.GetParameter(sParameterNumber).Name
Next
Set oSheet = Nothing
Else
msgbox "The Column '" & sParameterNumber & "' does not exit. Please provide a valid column number.",0+16,"Invalid Column Number"
ExitTest
End If
End Function
By default all the cells in the runtime datatable are editable. Use the value method of Datatable to edit the value. Note: you can see the new value in the runtime datatable only.
Let me know if you need any more info.
Thanks,
SUpputuri
SUpputuri