Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
If statement with multi or's
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
How do I create an If statement to check for three variables?

Code:
LinkName = LinkObj.GetROProperty("text")

DocStyles = ("Fax","View","Zip")
DocStyles = "Fax","View","Zip"
If LinkName <> DocStyles Then

If LinkName <> "Fax" or LinkName <> "View" or LinkName <>"Zip" Then

If LinkName <> ("Fax" or "View" or "Zip") Then

If LinkName <> ("Fax","View","Zip") Then

Can someone help with what the correct coding for an If statement with multiple or's.
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
Rather than focusing on what you don't want it to do, focus on what you do want it to do.
Code:
LinkName = LinkObj.GetROProperty ("Text")
If LinkName = "Fax" Then
  'insert code that you want executed if it is Fax
ElseIf LinkName = "View"
  'insert code that you want executed if it is View
EsleIf LinkName = "Zip"
  'insert code that you want executed if it is Zip
Else
  'insert code that you want executed if it is none of the above
End If

If you don't care if it's Fax, View, or Zip and just want to execute code if it's none of these then try this.
Code:
LinkName = LinkObj.GetROProperty ("Text")
If LinkName <> "Fax" or LinkName <> "View" or LinkName <> "Zip" Then
  'insert code you want executed if it's none of these
End If
Reply
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
Code:
If LinkName = "Fax" or  LinkName = "View"  or   LinkName = "View"   Then
'code here
End if
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Multi Select in UFT/ QTP vanga 0 3,513 02-25-2015, 07:03 PM
Last Post: vanga
  Multi-test Manager 8.2.4 compatibility rlin2012 4 4,939 07-16-2013, 11:24 AM
Last Post: vinod123
  Having trouble integrating QTP with Ant and a multi-module Adobe Flex application peachy32514 0 4,792 03-24-2012, 02:39 AM
Last Post: peachy32514
  Batch Run Vs. Multi Data Set for different test Scenario... Suba 0 2,343 03-29-2011, 06:33 PM
Last Post: Suba
  Multi-Line comment in 8.2 ver. pramod7385 1 3,682 02-25-2010, 05:04 PM
Last Post: sreekanth chilam

Forum Jump:


Users browsing this thread: 1 Guest(s)