In vbscript can you use two possible conditions in an if statement? (OR)

28,572

you have to explicitly state the condition for each OR. Please see below

If filter_purchase = 0 Or filter_purchase = "" Then
   SetDocVar "filter_purchase", "0"
Else
   SetDocVar "filter_purchase", CStr(filter_purchase)
End If
Share:
28,572
Michael Morgan
Author by

Michael Morgan

Updated on July 09, 2022

Comments

  • Michael Morgan
    Michael Morgan almost 2 years

    An example would be:

    If filter_purchase = 0 Or "" Then
    SetDocVar "filter_purchase", "0"
    Else
    SetDocVar "filter_purchase", CStr(filter_purchase)
    End If
    

    But I get a 'Type Mismatch'. Would there be an easier way than doing Else IFs?