Micro Focus QTP (UFT) Forums
IF 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: IF statement (/Thread-IF-statement)



IF statement - mahadevan.swamy - 10-01-2008

Hi,

In QTP, I have a column in the data table which contains the name of the reports.

All Listed Invoices
Invoice List
Fleet Invoice and Details
Key To The Highway Invoice and Details
Fuels & Lubes Invoice and Details
Multiple Fuels & Lubes Invoice and Details

If QTP were to test the first two reports, it would work. The 3rd,
4th, 5th and 6th reports requires some navigation through the
application where I have use the Query function in the application to
sort out the reports. I would like to know how to generate an IF
statement after this line:

Code:
Browser("Reports").Page("Reports").WebList("s_0_1_7_0").Select DataTable("Select_a_Report", dtGlobalSheet)
Browser("Reports").Page("Reports").Link("Run Now").Click

Basically i need some syntax to capture the value from A3 and say:

Code:
If <syntax> = "Fleet Invoice and Details"
Then ..........
End IF

Please tell me the syntax to capture the value from cell A3. Thanks


Swamy


RE: IF statement - stevol - 10-01-2008

Code:
dim rep_name
rep_name= DataTable("xxx","yyy")

If rep_name = "Fleet Invoice and Details" Then
   ...
End If

where xxx= column name, yyy=sheet name

Other way: use Select Case Statement
Select Case rep_name
   Case "All Listed Invoices"
         ...
   Case "Fleet Invoice and Details"
         ...
   Case Else
         ...
End Select



RE: IF statement - ssping - 10-06-2008

Hello,

try this

Code:
if Browser("Reports").Page("Reports").WebList("s_0_1_7_0").value="Fleet Invoice and Details"  then

hope this helps.