How to Find tottal number of row present in Table

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
NishantSingh
Posts: 39
Joined: Thu Oct 09, 2014 1:15 pm
Location: Bangalore

How to Find tottal number of row present in Table

Post by NishantSingh » Wed Nov 12, 2014 8:33 am

Hi,

I am working on a .net Application, So this application when we add a data it will create a row in the table.
I want to know the total number of row a table have. So what code or function should I use.

OS: Windows 7
Ranorex Studio 5.2

Please help me out in this

Table Snapshot attached

Regards,
Nishant Singh
You do not have the required permissions to view the files attached to this post.
Regrads,
Nishant Singh

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to Find tottal number of row present in Table

Post by odklizec » Wed Nov 12, 2014 9:08 am

Hi,

You can find an example of table reading/manipulation code here:
http://www.ranorex.com/support/user-gui ... html#c7781

Basically, the code for extracting the number of table rows is this:
tableAdapter.Rows.Count

So all you need to do is to get that example code and reduce it to bare minimum ;)

Eventually, you can use this code:

Code: Select all

    public void TableRowsCount_Repo(Ranorex.Adapter repoItem)
    {  
		// cast repoItem to Table (where the repoItem is table name stored in repository) 
		Ranorex.Table table = repoItem.As <Ranorex.Table>();
		int tableRowsCount = table.Rows.Count;
		Ranorex.Report.Log (ReportLevel.Success, "Table Rows count:" + tableRowsCount.ToString());
    } 
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

NishantSingh
Posts: 39
Joined: Thu Oct 09, 2014 1:15 pm
Location: Bangalore

Re: How to Find tottal number of row present in Table

Post by NishantSingh » Wed Nov 12, 2014 12:47 pm

Thanks a lot yes its woking fine.

Regards,
Nishant Singh
Regrads,
Nishant Singh