cancel
Showing results for 
Search instead for 
Did you mean: 

GetRowWithCellText method for Grid

Highlighted
Frequent Visitor

GetRowWithCellText method for Grid

Hi,

I am working on an application which has a documents Grid. The grid has more than 10000 rows, we have option to filter but even on filtering the row no of specific row does not change eg, my intended row to work on is at 105 position, if i apply filter and get only 2 visible rows, the row no of intended row still shows as 105. 

Is there any method in testcomplete which can return us row no of gird using searching specific unique text like we have a method in UFT as GetRowWithCellText("String_Text") ?

Tags (1)
3 REPLIES 3
Community Leader

Re: GetRowWithCellText method for Grid

Hi Ajaypokharkar


There is few solutions for you, check this points:


1) Use TestComplete 'text-recognition' option. With this option on You can search for any element currently visible on screen. For example if you have 5 rows in your grid and with third row you have a text 'document1' then you can search for this text as TextObject and read its properties.


https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/text-recognition/...


2) Second solution its to deploy application in 'Debug mode', after that you can natively read grid properties like:


readSecondRowInSecondColumn() (method name its fake Smiley Wink)


3) Third the most weird one is to read all property values by its 'Top' coordinates. For example the third row is always in the same line so it's Top coordinates will be for example 50 px. With this knowledge you can read all data in all columns for single row.


Hope this helps you.

Contributor

Re: GetRowWithCellText method for Grid

I have written one function to get the row index and click on the specific grid depending on the value (Text)

 

You have specify the Grid object, and column name in which you have the values and the values 

 

function ClickGrid(Grid,Column,Value)
{
var RowIndex;
function FindRow(Grid, Column, Value, ViewId)
{
if (typeof(ViewId) == "undefined")
ViewId = 0;
for (var i=0; i<Grid.wRowCount(ViewId); i++)
if (Grid.wValue(i, Column, ViewId) == Value)
return i;
return -1;
}
RowIndex = FindRow(Grid,Column,Value);
}

Community Manager

Re: GetRowWithCellText method for Grid

Thanks for the great suggestions, Wamboo, anupamchampati.

@Ajaypokharkar, do they help you resolve the issue? Which reply can we mark as a solution?

 

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors