If condition on message type

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf If condition on message type

  • Creator
    Topic
  • #52464
    Rehman Masood
    Participant

      I have to do certain manipulations based on MSH-9 and for that, I am doing a IF condition that looks like,

      0(0).MSH(0).#9(0).[0] eq =SIU^S26

      But I am getting the following error,

      [0:TEST] IF expression parse failed: Unrecognizable lexical token

      Error occurred at: ‘^S26’

      [0:TEST] Unable to compile XLT ‘s1b.xlt’

      Does anyone know of a way to accomplish this?

    Viewing 4 reply threads
    • Author
      Replies
      • #74310
        Jim Kosloskey
        Participant

          Rehman,

          Two problems as I see it:

          First your address path for the field is taking you to the first component of MSH-9 but you are checking for 2 components in your literal.

          Second, I don’t think =SIU^S26 is valid because the ^ is a special character which may need to be escaped.

          If all of the messages that will come through this Xlate are of the SIU Message Type then to determine the Event Type (the second component of MSH-9) I would try this:

          IF (0).MSH(0).#9(0).[1] eq =S26

          On the other hand, if there can be other Message Types than SIU you could try this:

          IF (0).MSH(0).#9(0) eq =SIU^S26 (I am not sure this will work – never tried it).

          But this should work:

          IF (0).MSH(0).#9(0).[0] eq =SIU

             IF(0).MSH(0).#9(0).[1] eq =S26

                do your stuff here…

          email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

        • #74311
          Rehman Masood
          Participant

            Jim, that’s what I would have thought too, but there is no MSH-9.2 built for the Xlate (unless I create a variant and use that).

          • #74312
            Keith McLeod
            Participant

              I would suggest running a message through you testing tool with the variant used in your xlate.  Turn up the detail to 4 and view the path of the component.  Use this path in your ‘if statement’.

            • #74313

              Rehman Masood wrote:

              Jim, that’s what I would have thought too, but there is no MSH-9.2 built for the Xlate (unless I create a variant and use that).

              Subfields do not need to be in the variant. You simple specifiy them in the address with the [n] notation (ex. [1]).

              What Jim suggested is exactly right. Try it like that. However, to simplify it further, you probably only need to check MSH.09.02.

              Another way to do this, if we weren’t working with subfields, is to use a user-defined variable. Copy a value to a user-defined variable, and then check the contents of the variable in the IF statement.

              -- Max Drown (Infor)

            • #74314
              Rehman Masood
              Participant

                Thanks Guys. That was it. Using [1] worked for MSH-9.

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