Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IF statement
#1
Solved: 10 Years, 9 Months, 1 Week ago
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
Reply
#2
Solved: 10 Years, 9 Months, 1 Week ago
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
Reply
#3
Solved: 10 Years, 9 Months, 1 Week ago
Hello,

try this

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

hope this helps.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Executing statement and commiting statement via qtp unbeliever 6 19,863 01-07-2010, 07:11 PM
Last Post: unbeliever

Forum Jump:


Users browsing this thread: 1 Guest(s)