Count number of rows in datatable

3,507 views
Skip to first unread message

Kiran Ogeti

unread,
Jan 11, 2012, 12:26:29 PM1/11/12
to mercu...@googlegroups.com
While on run time, i need to get the row count of a particular column .. the row count means the number of filled rows only.. could you help pls


shashi qa

unread,
Jan 11, 2012, 11:57:12 PM1/11/12
to mercu...@googlegroups.com
Dim x
x = datatable.getsheet(Sheet NO).getrowcount()
Msgbox x


On Wed, Jan 11, 2012 at 10:56 PM, Kiran Ogeti <kse...@yahoo.com> wrote:
While on run time, i need to get the row count of a particular column .. the row count means the number of filled rows only.. could you help pls


--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to Mercu...@googlegroups.com
To unsubscribe from this group, send email to
MercuryQTP+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en



--
Regards

Shashidhar

Anish Pillai

unread,
Jan 12, 2012, 12:42:50 PM1/12/12
to mercu...@googlegroups.com
Hi,

Please check if the below mentioned logic works for you -

iCol = 'Column Number
iTotalRows = Br.Pg.WebTable.GetROProperty("rows")
iNonBlankRows = 0

For i=0 to iTotalRows-10
 If Br.Pg.WT.GetCellData(i,iCol) <> "" Then
  
iNonBlankRows = iNonBlankRows  + 1
 Else
   Exit For
 End If
Next

msgbox "Total Non Blank Rows " &
iNonBlankRows


Regards,
Anish Pillai

[Automation Repository]

--
Regards,
Anish Pillai
My QTP Blog

pramod goud

unread,
Jan 11, 2012, 1:05:35 PM1/11/12
to mercu...@googlegroups.com
Take global sheet insert some values in column name is default "A" and run statement 

a=DataTable.GetSheet(1).GetParameter("A").Value
msgbox a


On Wed, Jan 11, 2012 at 10:56 PM, Kiran Ogeti <kse...@yahoo.com> wrote:
While on run time, i need to get the row count of a particular column .. the row count means the number of filled rows only.. could you help pls


--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to Mercu...@googlegroups.com
To unsubscribe from this group, send email to
MercuryQTP+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en



--
Thanks&Regards
        Pramod
9052456959

Johnson Solomon

unread,
Jan 11, 2012, 12:36:24 PM1/11/12
to mercu...@googlegroups.com
Hi Kiran,

You could get the run time row count using the below method. 

msgbox Browser("Test").Page(" Test ").WebTable(" Test").RowCount

Please explain more on what do you mean by empty rows, HTML Code will be helpful.

with Regards,
Johnson Solomon

Parke Kuntz

unread,
Jan 11, 2012, 7:52:57 PM1/11/12
to mercu...@googlegroups.com
Kiran:

I am assuming you are wanting a row count of a datatable and not Excel or a web table.

Take a look at http://geekswithblogs.net/tmoore/archive/2006/11/03/96018.aspx

Parke


On Wed, Jan 11, 2012 at 12:26 PM, Kiran Ogeti <kse...@yahoo.com> wrote:
While on run time, i need to get the row count of a particular column .. the row count means the number of filled rows only.. could you help pls


--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to Mercu...@googlegroups.com
To unsubscribe from this group, send email to
MercuryQTP+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en



--
Parke

Sheik Adil

unread,
Jan 17, 2012, 6:31:34 AM1/17/12
to mercu...@googlegroups.com
Hey
          Try this code it works
     
      Rc = Browser("micclass:=Browser").Page("micclass:=Page").WebTable("name:=xyz").RowCount
          For i = 2 to Rc             
               Cc = Browser("micclass:=Browser").Page("micclass:=Page").WebTable("name:=xyz").ColumnCount
                Msgbox Cc
          Next
Note: i have started the iteration from 2 coz 1st Row will be Header Part so we have to start iterate from 2

Cheers..........

Adil


On Wed, Jan 11, 2012 at 10:56 PM, Kiran Ogeti <kse...@yahoo.com> wrote:
While on run time, i need to get the row count of a particular column .. the row count means the number of filled rows only.. could you help pls


kse...@yahoo.com

unread,
Jan 21, 2012, 8:42:26 AM1/21/12
to mercu...@googlegroups.com
Thanks for all your responses 

But it's not web table I was asking about , in data table I need to get count of rows filled with data for a particular column 

This case row count for each column is different 

Sent from my iPhone
Reply all
Reply to author
Forward
0 new messages