How to check to see if a HL7 segment is present.

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf How to check to see if a HL7 segment is present.

  • Creator
    Topic
  • #48294
    Ron Pinter
    Participant

      Is there a way in the translate to see if a specific HL7 segment was sent.  I want to be able to do an if statement on the segment identifier (MSH, PID, ZP1, etc).  For example, I have a ZP1 segment that I may receive.  If I receive this segment I would then want to perform the various xlate (copy, if, etc) statements.  If the segment was not sent, I do not want to execute the xlate statements.  Also, on the ZP1 segment, I do not have a field which is always valued when it is sent to me.  So I cannot always check a specific field to see if it is null and then assume that the segment was not there.

      For example:

      IF ZP1 was sent

          Copy ZP1-2 to  @temp

          If ZP1-18  is null

             Copy N to  @temp1

          Else

             Copy ZP1-18  to @temp1

      .

      .

      .

      .

      If I do not know that segment was sent and just perform the copy and if statements, the if ZP1-18 will move an N to the temp.  I only want to do this when the ZP1 segment is sent to me and this field is not valued.

    Viewing 0 reply threads
    • Author
      Replies
      • #58268
        Ed Mastascusa
        Participant

          Ron,

          If there are no required fields in the segment you can set up an iterate on the segment(s).

          If the segment isn’t there on the inbound message you shouldn’t enter the iterate loop. Your basis won’t be a list, it will probably be group or segment – the specifics will depend on your message definition.

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