2 Replies Latest reply: May 15, 2014 9:57 AM by Ari _ RSS

    Question - find character, alpha or numeric

    Ari _

      Here is my code:

      If(left(OPID,2)="AD".Or.left(OPID,2)="AT".Or.left(OPID,2)="AC".Or.left(OPID,2)="WE",[AMT-PD],0.00)

       

      I do not know if there will be more variables in the future.  Instead of "AD" "AC"

      If there a way for me to see if the 2nd position is numeric or alpha?

       

      I know it always starts with "A" or "W", then the 2nd character is numeric or alpha...

       

      Thanks (version 9)

        • Question - find character, alpha or numeric
          Grant Perkins

          Hi Ari,

           

          The simple answer to your question is "Yes".

           

          I assume you may want to filter only when the second character of the code is not numeric or something like that?

           

          Lets look at some thing you might want to investigate.

           

          For a start have you considered experimenting with wildcards? Assuming the code could start with either A or W followed by something else you could use a wildcard "A" and "W" rather than a list.

           

          Alternatively if you need a list you could try the ".IN."  operator in the formula instead of a series of ORs.

           

          To 'extract' just the second character you can use the SUBSTR function. To assess whether the extracted character is alpha or numeric you can use the "ISALPHA" function in the result of the SUBSTR formula.

           

          You can then build your IF statement selection based on 'Does the code start with A or W and is the second character Alpha' for example. There are also a number of other possibilities - for instance checking the the second character is NOTIN the list "1,2,3,4, etc".

           

          There are some worked examples of all of these functions in the help files.

           

          Have I understood your requirement correctly?

           

          HTH.

           

           

          Grant

          • Question - find character, alpha or numeric
            Ari _

            Thanks!