How to determine if a segment is present it HL7 message

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf How to determine if a segment is present it HL7 message

  • Creator
    Topic
  • #49112
    Dennis Dunn
    Participant

    Hello,

    I am working on a translation for HL7 messages and I need to determine if the GT1 segment is present in the input message.  If it is, I need to do a table lookup.  I am thinking that I need to do an IF action with the Evaluate First operator.  I am assuming that this will evaluate some arbitrary TCL code and I can then compare the return value to some constant.  I am also assuming that this TCL code has some handle to message handles and whatnot.

    Is there some TCL procedure that can determine if the segment is present?  I suppose I could do a regex search on the message text, provided my assumptions are correct.  Is there a better way to accomplish this?

    Thanks,

    –dennis

Viewing 1 reply thread
  • Author
    Replies
    • #60751
      Jim Kosloskey
      Participant

      Dennis,

      Just check a field which you know will always be present in the GT1 segment if it exists.

      Check the field in question in the first GT1 occurrence to see if it is equal to @null. If it is, then no GT1 segments exist. Obviously if the first one does not exist no others can as well.

      So unless there are other circumstances there is no need for Tcl, just an IF Action.

      Jim Kosloskey

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

    • #60752
      Dennis Dunn
      Participant

      Thanks Jim,

      I had been testing against =”” and =null but that wasn’t working like I thought it should so I started to look into other avenues.  The @null was the clue I needed, my IF test became  

      0(0).GT1(0).00405.[0] ne @null

      Thanks for your help.

      –dennis

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

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,293
Replies
34,435
Topic Tags
286
Empty Topic Tags
10