Page 1 of 1

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

Posted: Fri Feb 10, 2012 1:01 am
by carsonw
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!

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

Posted: Fri Feb 10, 2012 11:14 am
by Support Team
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
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