Micro Focus QTP (UFT) Forums
Count number of rows under particular column of webtable - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Count number of rows under particular column of webtable (/Thread-Count-number-of-rows-under-particular-column-of-webtable)



Count number of rows under particular column of webtable - Nagu - 05-25-2009

Hi

How to count the number of rows under particular column of a webtable.
In my application i have a webtable its having 7 columns and 6 rows whereas under 4th column each row is partitioned into 3 rows so when i gave the rowcount of that webtable it shows maximum no. rows count.


RE: Count number of rows under particular column of webtable - nandu - 05-26-2009

Hai..
There is no perticular method for row count for perticular column...
But it is possible to do like this...

Code:
s=0
for j=1 to datatable.getrowcount
datatable.setcurrentrow(j)
i=datatable.getsheet(1).getparameter(2).value
if i<>"" Then
s=s+1
End If
Next
Msgbox s



RE: Count number of rows under particular column of webtable - Nagu - 05-26-2009

Hi

i was talking about webtable not datatable


RE: Count number of rows under particular column of webtable - nandu - 05-28-2009

The best way i found out was to keep the first row blank and use a formula in the first row as "=COUNTA(A2:A1000)". This would mean that first row always gives you the column count in current column and you can always use GetParameter and ValueByRow method to access the value. Please look in QTP help file for more details


RE: Count number of rows under particular column of webtable - Nagu - 05-28-2009

Hi
I exported all the links of that table to a excel sheet later i want to loop on that column in excel and very first occurence link which starts with LAUSD i want to take as input and click on that click.
I did something like this:
Code:
Set oDesc=Description.Create()
oDesc("html tag").Value="A"
Set rc = Obj.WebTable("name:=Track").ChildObjects(oDesc)
num = rc.Count()
For i=3 to num-1
tag = rc(i).GetROProperty("innertext")
'msgbox tag
linkval=tag
osheet.cells(i,11)=linkval
Rowcount =osheet.usedrange.rows.count
For y=3 to Rowcount
    val=osheet.cells(y,11).Value
  If (val="LAUSD") Then
                      
          Obj.link("text:="&val).click

                        End If
Next
Next


But it does not show any error message.What might be wrong in this?I think it takes it has a string in val variable.

Any help regarding this would be appreciated in advance.
Tahnks..