Micro Focus QTP (UFT) Forums
WebTable Name keeps changing - 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: WebTable Name keeps changing (/Thread-WebTable-Name-keeps-changing)



WebTable Name keeps changing - SmithaQTP - 03-06-2008

Hi All ....
Description: I have to write a script for clicking all the links in a webtable in a flow,the flow consist of 2 tables,I used For loop to click all the links one by one...the problem is when I click the first Link in first table ..it leads to the second table..and when i click on the second link in first table it leads to second table(but now the table name is different)
1st table(1st link)------>2nd table(1st link)
here i should click all the links in 2 table and goes
back to first table
1st table(2nd link)------>2nd table(1st link) now the webtable name of 2nd
is changed...so i am getting the error webtable
name not found in repository
I think you guys have understood what is my problem..Can any one help to find out a solution for it please..Please check with the below code......I have attached the same code as attachment too

Code:
RowCount = Browser("Browser").Page("Page").WebTable("Convertible").RowCount
ColumnCount = Browser("Browser").Page("Page").WebTable("Convertible").ColumnCount(1)

For a = 1 To RowCount
    
    For b = 1 To ColumnCount
        
        Set cfsmake= Browser("Browser").Page("Page").WebTable("Convertible").ChildItem(a,b,"Link",0)
            cfsmake.Click
        R1 = Browser("Browser").Page("Page").WebTable("Aston Martin").RowCount
        C1 = Browser("Browser").Page("Page").WebTable("Aston Martin").ColumnCount(1)
            
        For a1 = 1 To R1
            
            For b1 = 1 To C1
                
                cellData = Browser("Browser").Page("Page").WebTable("Aston Martin").GetCellData(a1,b1)
                If cellData = Browser("Browser").Page("Page").WebTable("Aston Martin").GetCellData(R1,C1-1) Then
                      Browser("Browser").Page("Page").Link("Home").Click
                Else     
                    Set cfsmake= Browser("Browser").Page("Page").WebTable("Aston Martin").ChildItem( a1 , b1 ,"Link",0)
                          cfsmake.Click
                        Browser("Browser").Back
                         b1 = b1+1
                 End If
             Next
        Next
    Next
Next

Please do the need full


RE: WebTable Name keeps changing - Ankur - 03-11-2008

make a generic function using descriptive programming...call the function in the loop...you will save so many For Next statements.


RE: WebTable Name keeps changing - SmithaQTP - 03-11-2008

Hi Ankur:

Thanks for your reply,To be frank i am just a beginner in QTP,I dont have any idea of generic function ,Can you please give me an idea of generic functions ,How to use it and if possible give me some example scripts ....so that it will be very useful for me ...Thanks in Advance


RE: WebTable Name keeps changing - Ankur - 03-11-2008

ok to get an idea of how function and DP works...here is an example of a function to count no of rows in a Siebel app... trust it will help you...
https://www.learnqtp.com/how-to-count-total-no-of-rows-when-all-rows-are-not-visible/