DataGrid Columns

Class library usage, coding and language questions.
hkathuria
Posts: 9
Joined: Thu Dec 04, 2008 12:57 am

DataGrid Columns

Post by hkathuria » Wed Dec 17, 2008 10: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

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Thu Dec 18, 2008 11:23 am

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

hkathuria
Posts: 9
Joined: Thu Dec 04, 2008 12:57 am

Post by hkathuria » Thu Dec 18, 2008 4: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

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Fri Dec 19, 2008 11:40 am

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