Micro Focus QTP (UFT) Forums
Fix a SetObject = statement - 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: Fix a SetObject = statement (/Thread-Fix-a-SetObject-statement)



Fix a SetObject = statement - mv8167 - 10-07-2011

In a For loop, this code works:

Code:
NumGr = GrC*2+2
Set TableObj = Browser("Wisdom").Page("WisdomLogin").Frame("parent").WebTable("Document Type_" & NumGr)

However, I must keep each Document Type_# in my OR. This does not work well as the table numbers change. I could I guess have Document View_1 to _100

With an OR object Document View (name is Document View.* and regexp on), I tried these using RegExp:

Code:
Set TableObj = Browser("Wisdom").Page("WisdomLogin").Frame("parent").WebTable("name:=Document Type_" & NumGr,  "visible:=True", "html tag:=Table")
Set TableObj = Browser("Wisdom").Page("WisdomLogin").Frame("parent").WebTable("innerText:=" & "Document Type",  "visible:=" & "True", "html tag:=" & "Table") Then ', "index:=" & NumGr)
Set TableObj = Browser("Wisdom").Page("WisdomLogin").Frame("parent").WebTable("innerText:=Document Type",  "html tag:=Table", "index:=" & NumGr)

But none of these Set TableObj = worked. What am I doing wrong?

The table index # is always changing. I need to find the table # that is visible. And set my TableObj to this number. Any ideas?

see atttachment for OR properties