Micro Focus QTP (UFT) Forums
request for VB code for finding X in dynamic web table - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: request for VB code for finding X in dynamic web table (/Thread-request-for-VB-code-for-finding-X-in-dynamic-web-table)



request for VB code for finding X in dynamic web table - davidsmi@bossig.com - 04-14-2011

I am looking for Ideas here.
Problem:

I am trying to find a value in a dynamic web table let’s say the value is “X”. I need to return the position of “X” and then Return the X.

I need the VB Code that finds a value lets say it is “X” and is located in a dynamic web table that has a dynamic number of rows and coulombs.

I need the VB code that returns the position of X

I need the VB code to return the “X”

Thanks David


RE: request for VB code for finding X in dynamic web table - Jay - 04-15-2011

Code:
iRow = Browser().page().webtable().Rowcount
iColumn =  Browser().page().webtable().Columncount

For i= 0 to iRow
For j =0 to iColumn
        set objWebtable = Browser().page().webtable()
          if X = objwebtable.getcelldata(i,j)  
                       Msgbox "Row Number : " & i & " and Column number : " & j
                       Msgbox "Value of X : " & X
                       Exit For
          End if
Next    
Next
Syntext may be incorrect but the logic is right.

~ Jay


RE: request for VB code for finding X in dynamic web table - davidsmi@bossig.com - 04-16-2011

Thanks Jay
this is what I was thinking
Pseudo code:::::

Code:
For row = 1 to rowsize :: A loop to count rows
For col = 1 to colsize :: A loop to count columns
If box(x,y).value ="x" then :: Test
Print "Box" row ", " col "has value " box(x,y).value
:: Show user results
end if :: end conditional
end for loop :: col
end for loop :: row