DataGrid Columns : Automation API

DataGrid Columns

Class library usage, coding and language questions.

DataGrid Columns

Postby hkathuria » Wed Dec 17, 2008 11:53 pm

How would I access DataGrid columns by thier names rather than indexes?

Say I have following grid

Name Age Designation
Mike 27 Developer
Louis 32 Manager



I can access the second row's "Age" cloumn value by finding the grid using RxPath and then accesing the rows and columns by indexes. But how would i do that by column names.
If I don't use the cloumn names my test would fail if I change the sequence of cloumns.
Hitesh
hkathuria
 
Posts: 9
Joined: Thu Dec 04, 2008 1:57 am

Postby Support Team » Thu Dec 18, 2008 12:23 pm

There is no built-in functionality for that, yet. But you can easily map the column names to indices yourself, e.g. by going through the header row once and storing the column name <-> index relation in a dictionary. Then you can use this mapping when you access a cell und update the mapping whenever the columns are reordered.

Regards,
Alex
Ranorex Support Team
User avatar
Support Team
Site Admin
 
Posts: 4285
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Postby hkathuria » Thu Dec 18, 2008 5:51 pm

I understand that. Thanks for the solution. This would be helpful in making the test more reliable!!

Any Plans to inlcude such features in the core in January Release for Ranorex 2.0?
This would make the product more powerful.
Hitesh
hkathuria
 
Posts: 9
Joined: Thu Dec 04, 2008 1:57 am

Postby Support Team » Fri Dec 19, 2008 12:40 pm

Actually, we are already on feature stop for the Ranorex 2.0 release, but I add this feature to the wanted-features-list.

Regards,
Alex
Ranorex Support Team
User avatar
Support Team
Site Admin
 
Posts: 4285
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria


Return to Automation API

Who is online

Users browsing this forum: No registered users and 0 guests