3 Replies Latest reply on Aug 29, 2013 10:48 AM by philmodjunk

    Scripting an If Statement

    Kirk_1

      Title

      Scripting an If Statement

      Post

           How do i script an if statement to include serveral varables. If the state is in the list then...

           What If::INConsigneeState = "MD" or "NC" or "SC" or "VA" does not evaluate.

           What If::INConsigneeState = "MD NC SC VA" does not evaluate.

        • 1. Re: Scripting an If Statement
          philmodjunk

               What If::INConsigneeState = "MD" or What If::INConsigneeState = "NC" or What If::INConsigneeState ="SC" or What If::INConsigneeState ="VA"

               You could also use a text function such as:

               PatternCount ( "MDNCSCVA" ; What If::INConsigneeState )

          • 2. Re: Scripting an If Statement
            raybaudi

                 "You could also use a text function such as: PatternCount ( "MDNCSCVA" ; What If::INConsigneeState )"

            It is safer to use ValueCount ( FilterValues (  What If::INConsigneeState ;  "MDNCSCVAother states here" ) )

            • 3. Re: Scripting an If Statement
              philmodjunk

                   I agree that this is safer in a general way. But in the US, these are standard abbreviations established by the US government and are unique so you don't have to use filter values. but it would be a good idea to put a space between each abbreviation to prevent a "false positive" result due to a state abbreviation matching to the last letter of one listed state and the first letter of the next.

                   But then again, it might be that the particular needs of your system make it possible to use the List Function to get that list of state abbreviations...