Micro Focus QTP (UFT) Forums

Full Version: IF statement
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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
Hello,

try this

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

hope this helps.