Micro Focus QTP (UFT) Forums
Search WebTable? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Search WebTable? (/Thread-Search-WebTable)

Pages: 1 2


Search WebTable? - Brian T. - 06-24-2010

Trying to find specific data in a webtable and then clicking on link?

Currently the Webtable has over 400 rows and 7 columns.
The Rows will grow in number but the 7 columns are static.

Example:

Name For, Name By, Type, Action, Date, Status, Details
John, Dave, Test, Add, Date, Status, Link

I need to search the WebTable for a specific row that would meet the search requirements for the Name, Type, and current date...if the row is found and all data matches the search requirement then I will need to click the link in the details column of the same row.


Thanks,
Brian


RE: Search WebTable? - Saket - 06-24-2010

you can use WebTable(" ").GetRowWithCellText("The unique item text in the row")
this will give you the row number,
get the link object in the row for the detail column and do the click.

does this help tp solve your issue?


RE: Search WebTable? - Brian T. - 06-28-2010

Saket,

this did help and I think I'm able to find the data with the following...

Code:
If Browser("").Page("").WebTable("").GetRowWithCellText("GD APRS Nine,Internet,Jun 18 2010 4:57PM") = True Then

Browser("").Page("").Link("View").click

End If

(GD APRS Nine , Internet , Date) are from the static columns
GD APRS Nine is a name that is the first search and then type Internet is the second and Date is the third. I think this is right. The problem I'm having is clicking on the View link that is in the last column (Details) of the web table.

Since this page will have a view link at the end of each request
row I will need to be able to click on that link for that specific request I'm looking for.

Problem is that in the object repository the View link is list several times....ie...View, View_2, View_3.....and so on. Is there a way to be able to just click on the link without specifiying the specific object or just click on the link in that row.

And can you review what I have and let me know if it looks correct the way I'm performing my search.

And if I just edit the GetRowWithCellText...data will it perform the search on the new data.


I hope you can understand what I have written.

Thanks for Help.


RE: Search WebTable? - basanth27 - 06-29-2010

Saket -
this may be a risky suggestion as duplicate items will cause issues...Just a thought.


RE: Search WebTable? - Saket - 06-29-2010

Yes, I agree. Thats why I specified there to use unique text to identify a row. I think this is feasible to implement it here as Brian did it.

Brian - you should use the link object there in identified row and click on it. use DP, dont take it from repository.


RE: Search WebTable? - Brian T. - 06-29-2010

Sorry Saket...

What is DP? and can you give me an example? You are right when I add objects to the repository by learn it captures all View Links and creates objects like View_2, View_3 making it specific to that request.

Thanks for all the help!


RE: Search WebTable? - Brian T. - 06-30-2010

Saket,

Also needed a little follow up on the previous post....

Using the following statement with specific text....if you look at what I have for the GetRowWithCellText- there are 3 elements seperated by commas I'm trying to Identify in a specific row will this work or is it just locating the first string of text "GD APRS Nine"

Code:
Browser("").Page("").WebTable("").GetRowWithCellText("GD APRS Nine,Internet,Jun 18 2010 4:57PM")

And when the test is executed the date field will have to search for current date not a specific date as displayed in the example.

Can you provide me with an example of how I can execute the search of the web table for the row with the 3 elements in the example with date being current date and then to click on the view link using DP?

Thanks for all the help!


RE: Search WebTable? - Brian T. - 07-01-2010

Here is more info on my current issue any help would be greatly appreciated.

Code:
row  =  Browser("").Page("").WebTable("").GetRowWithCellText("GD APRS Nine,Internet,Jun 18 2010 4:57PM", 2, 7)
                    
Set View = Browser("").Page("").WebTable("").ChildItem(3, 7, "Link", 1)

View.Click

This code allows me to click on the link but using the ChildItem you have to specify the row.

My problem is I need to access the row that is in the 7th column of the GetRowWithCellText description.

Tried different variables but no luck....I really need help!

I will also still need to have the script pull the find the request with the most recent date.

Thanks,
Brian


RE: Search WebTable? - Saket - 07-01-2010

I am not sure if I am getting you query clearly. why do you need to specify the row when you get this in variable 'row' in the earlier statement.


RE: Search WebTable? - Brian T. - 07-01-2010

Saket,

Sorry for the confusion, I'm able to query the row but when I try to click on the link in the 7th column of that specific row the script is clicking on the wrong obect link "View" because in the object repository there are multiple views....view, view_2.... I do not want to specify that in the code each time. I want the code to just click on the link that is in the 7th column of the query row. The query should find row with cell text and then click on the link in the 7th column.

In an earlier post you mentioned using DP and I wanted to know what that was and could you give me an example of how the query would look with clicking on that link in the 7th column for that specific query.

I hope this helps.

Thanks