Ranorex does not fully recognize a datagrid that QTP does...

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
carsonw
Posts: 178
Joined: Tue Nov 08, 2011 10:01 pm

Ranorex does not fully recognize a datagrid that QTP does...

Post by carsonw » Fri Feb 10, 2012 1:01 am

I've attached a screenshot that I hope will help illustrate the problem.

Basically, I have a datagrid (according to the spy the role is "Table") that only has rows recognized and not columns.

In QTP, we get the column name by index like this:

Code: Select all

Set objTable = SwfWindow("Volume Markups for Customer").SwfTable("dataGrid")

	If objTable.RowCount = 0 Then
		Exit Sub
	End If
   	'get column names
	
	intTotalColumns = objTable.ColumnCount
	For intColumn = 1 to intTotalColumns - 1
		If objTable.GetCellProperty(0, intColumn, "colname") = "Currency" Then
			intCurrencyColumn = intColumn
		ElseIf objTable.GetCellProperty(0, intColumn, "colname") = "Amount up to" Then
			 intAmountColumn = intColumn
		ElseIf objTable.GetCellProperty(0, intColumn, "colname") = "Markup percentage" Then
			 intMarkupColumn = intColumn
    	End If
	Next
...and it works fine. The columns and names are recognized without a problem. In Ranorex, the column collection in the table is empty. At this point I can iterate over all the cells in a row, but I really need to know the position of the cell.

Am I missing something?

On a potentially related topic, the treeview to the left of the grid in the screenshot... I can't access it at all. Ranorex sees it as a tree, but says it doesn't contain any Items.

We have a workaround for it that's pretty clean

Code: Select all

IList<Row> dataRows = RxSppAdminMain.RxGetRepository().RxFormVolumeMarkups.TableDataGrid.Rows;
						
			foreach (Row dataRow in dataRows)
			{																
				Cell currencyCell =  dataRow.FindChild<Cell>("Currency");
				Cell amountCell =  dataRow.FindChild<Cell>("Amount up to");
				
				if (currencyCell.Text.Contains(currency) && amountCell.Text == amount)
				{
					foundRow = dataRow;
					return true;						
				}
			}
			
			foundRow = null;
			return false;
...but I would just like to understand why the recognition works in one tool and not another (and getting the column index/headers can be really convenient and sometimes necessary).

Thanks!
Attachments
Index.jpg
No columns for me
Index.jpg (335.2 KiB) Viewed 1817 times

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

Re: Ranorex does not fully recognize a datagrid that QTP does...

Post by Support Team » Fri Feb 10, 2012 11:14 am

Hi,
carsonw wrote:At this point I can iterate over all the cells in a row, but I really need to know the position of the cell.
Am I missing something?
To identify your cell, you could use the msaa childindex instead of the columnindex. Another possible solution would be to enable the setting "Evaluate computationally expensive attributes". If you enable this setting Ranorex gets a bit slower but you should get your columnindex.
Here you can enable this setting
settings.png
settings.png (38.27 KiB) Viewed 1805 times
About your tree problem
Would it be possible to post us a Ranorex Snapshot to get further information about the tree?
How to create a Ranorex Snapshot

Regards,
Peter
Ranorex Team
.
Image