Tuesday 11 June 2013

How to Get Column No for any field/ColumnName in WebTable

Below is a piece of code which should be part of ur .QFL file.this will return the column no for specfic cell text(in specfic row).
this is very essential function as by defect VBScript/QTP lib provide only row no not column for cell data


Function gettingColNo( tbleObj,ColName,RowNo) 
 colcount= tbleObj.ColumnCount(row)
  For colNum =1 To colcount
   ColHeader = tbleObj.GetCellData(RowNo,colNum)
   If inStr(Lcase(ColHeader),Lcase(ColName)) > 0 Then
    blnResult = True
    gettingColNo= colNum
    Exit For
   End If
  Next        
  If  colNum > colcount  Then
    blnResult = False
    'your custom code to hadle false condtion, like reporting to parent function or qc
  End If
End Function


No comments:

Post a Comment