Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Data Table Query
#2
Solved: 10 Years, 10 Months ago
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)
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
Reply


Messages In This Thread
Data Table Query - by Suma Parimal - 01-18-2014, 02:26 PM
RE: Data Table Query - by supputuri - 01-19-2014, 04:40 PM
RE: Data Table Query - by Suma Parimal - 01-20-2014, 01:21 PM
RE: Data Table Query - by supputuri - 01-20-2014, 03:58 PM
RE: Data Table Query - by Suma Parimal - 01-21-2014, 12:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  data table use uft_usr 1 2,242 06-29-2016, 05:23 PM
Last Post: Ankesh
  Writing to Run time data table Neetha 5 12,175 08-27-2015, 10:18 AM
Last Post: supputuri
  Query regarding "Call" statement anupam4j 1 2,048 09-26-2014, 01:46 PM
Last Post: vinod123
  Retrieving data from web table nsuresh316 1 3,112 03-03-2014, 08:29 AM
Last Post: basanth27
  How to get data from data table in Ascending order dipashri 1 3,756 01-28-2014, 09:54 PM
Last Post: jacosta

Forum Jump:


Users browsing this thread: 2 Guest(s)