Capturing Symbols/Characters for IF Statement

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Capturing Symbols/Characters for IF Statement

  • Creator
    Topic
  • #53537
    Jon Melin
    Participant

      Hello!

      I am having an issue grabbing certain characters to use in an IF statement and I am not sure whether there is a way to do this or not.

      In a certain field another system is sending #?[TEXT]?#, where the TEXT can be anything. I was trying to iterate through the segments looking for the leading #?[ but when I run it through the testing tool it says I am missing a closing bracket. I don’t know a way around this. If I try to match on the full word #?[TEXT]?# and use it in the IF statement it says I have an Unrecognizable lexical token. The ultimate goal for this XLATE is to find those incoming messages with those specific leading and ending characters #?[ TEXT ]?# and null that field going outbound to my other systems.  

      Please see the screenshots below, I have one of the XLATE and two of the error messages. Does anyone know how to work with characters like brackets coming in without Cloverleaf thinking I am trying to enclose / bracket data in? Please let me know if you have any questions and thank you in advance.

    Viewing 2 reply threads
    • Author
      Replies
      • #78047
        Robert Milfajt
        Participant

          First error is due to fact xlateInVals and xlateOutVals are lists list and not strings.  You should do this:

          Code:

          set clear [string range [lindex $xlateInVals 0] 0 2]
          set xlateOutVals [list $clear]

          Robert Milfajt
          Northwestern Medicine
          Chicago, IL

        • #78048
          Robert Milfajt
          Participant

            The second error could be due to fact that you are using special characters as an argument to the IF statement.  I’ve found that from time to time, I need to set a variable to whatever string breaks an IF statment and use that variable as an argument to the IF statement.  Something like:

            COPY =#?[ @chkval

            IF @check eq @chkval

            But I’m not 100% sure on this one.

            Robert Milfajt
            Northwestern Medicine
            Chicago, IL

          • #78049
            Jon Melin
            Participant

              The combination of both of your responses got me to where I needed to be. Thank you very much for the help. I should have recognized those issues, but a second and third set of eyes certainly makes it easier!

              Thank you again,

              Jon

          Viewing 2 reply threads
          • The forum ‘Cloverleaf’ is closed to new topics and replies.