I am using QTP 9.1 to automate test cases.The application has an UltraWinGrid and am trying to find a row using a search strig.I want to find the rowcount to loop through the rows to find out my search string.When I used rowcount property,I got a message saying this property is not supported.
Please let me know how do I go about that.
Thanks,
RamPriya
Hi Rampriya,
You can try the following to get the number of rows in the grid:
rowcount = SwfTable("...").GetNAProperty("Rows.Count")
Then to access each row:
For I = 0 TO rowcount-1
Set currentRow = SwfTable("...").GetNAProperty("Rows["+CSTR(I)+"]")
' To get a specific cell text for the current row
cellText = SwfTable("...").GetNAProperty("Rows["+CSTR(I)+"].Cells[0].Text")
Next
Hope that will help
Regards,
Ammar
How do you access the first visible row in a filtered grid?
Hi,
Can you please me the solution that worked fine for the above issue. I am also facing the same challenge in our application. I tried with the code suggested by others in this page. But its consuming around 3 minutes for 5000+ rows.
Its taking 3 minutes for me also. Sorry, I mentioned wrong at my earlier post. If you find some solution, let me know.
Hello Neeta,
If you still have any concerns or questions I will be glad to help. If you need any additional assistance don’t hesitate to ask.
Regards
Neeta,
I believe the approach that I posted here will work for you.
Let me know if you have any questions.
Hi Georgi,
Thanks for your post. I have 1 more issue regarding the same. In non filtered grid, we have some 5000+ rows as of now. After filter, there is only 1 row. I have to fetch the values of few columns of this particular row. This particular valued row may appear at any row between this row count. So, I cant iterate every row to get its value. Is there any method through which I can retrieve filtered row values without iterating 5000 rows?
Have you been able to resolve your issue ? If you still have any concerns or questions I will be glad to help. If you need any additional assistance don’t hesitate to ask.
If you want to find the count of your filtered or non filtered rows, you could use GetNAProperty method, without using a Loop through all rows in the grid. You could use both UltraGrid`s properties which conatains required values. For example:
SwfWindow("Form1").SwfTable("ultraGrid1").GetNAProperty("Rows.FilteredInRowCount")
and
SwfWindow("Form1").SwfTable("ultraGrid1").GetNAProperty("Rows.FilteredInNonGroupByRowCount")