Suppress message if no Base64 PDF in OBX

Clovertech Forums Cloverleaf Suppress message if no Base64 PDF in OBX

  • Creator
    Topic
  • #122322
    Darrell Glover
    Participant

      I have a vendor sending ORU messages with multiple OBX segments and one of them is an encoded Base64 PDF document.  I need to clear all the non-PDF OBX segments, so that I have just the single PDF one.  I have created a very simple Xlate and it works like a champ.  However, now the vendor is telling me that they will be sending some ORU messages without the PDF at all.  I need to suppress any messages that do not include the Base64 PDF OBX segment, but for the life of me I cannot get it to work.  I imagine I missing something very simple/obvious.  Any ideas how to update the xlate to suppress those messages?

      Attachments:
      You must be logged in to view attached files.
    Viewing 4 reply threads
    • Author
      Replies
      • #122324
        Jason Russell
        Participant

          There’s a few ways to do this, but the simplest in your case is set a variable to a phrase that shows there is a PDF. So in your if statement, put “YES” (or True or whatever) in @hasPDF, and at the end, check that variable and suppress if it isn’t true. So if @hasPDF ne =YES, then suppress.

        • #122325
          James Cobane
          Participant

            Darrell,

            You could add a statement in your ITER that sets a temp variable if a PDF exists (i.e. @pdfExists, set it to ‘1’), then just after your ITER you can add an IF statement to check if @pdfExists is not equal to ‘1’, and SUPPRESS.

            Hope that makes sense.

            Jim Cobane – Henry Ford Health

            • #122328
              Darrell Glover
              Participant

                Jim,

                I tried that (see below), but when testing via the Testing Tool it is not suppressing the message.  It’s as if the @PDF variable is failing to be set (if statement is false somehow?).  See my logic below.

                 

                Attachments:
                You must be logged in to view attached files.
            • #122326
              Jim Vilbrandt
              Participant

                Hi Darrell,

                you are most likely iterating through the OBX segments with an IF-Statement that looks for the PDF segment. Inside this IF-Statement, include a “SEND” and outside the iterate, include a “SURPRESS”.

                Regards, Jim

                • #122335
                  Jim Kosloskey
                  Participant

                    I want to make sure everyone understands the difference between the SEND and the CONTINUE Actions in the Xlate.

                    The SEND sends the message directly to the Destination Thread bypassing post Xlate processing between the Xlate and the Destination thread.

                    CONTINUE passes the message on to the next state in the engine (typically the post Xlate UPoC).

                    I recommend the use of the CONTINUE UNLESS you are sure there will not be any post Xlate processing. What can happen (has happened to me) is you have an Xlate running well (perhaps for years and maybe you did not even create it, with a SEND), then a requirement comes along that is best solved with the post Xlate UPoC. You create and test your code; then place it in the UPOC. But it does not seem to function. Bounce head against wall and burn up valuable hours until you discover the SEND which (of course) is bypassing the post Xlate Proc.

                    I submit with today’s Xlate power and chaining, it is rare a SEND is needed and indeed can get in the way later on.

                    Understand as well that the Xlate will always create a message UNLESS the SUPPRESS Action is used so in many cases the CONTINUE can cause multiple messages to be generated.

                    • This reply was modified 18 hours, 14 minutes ago by Jim Kosloskey. Reason: Add comments about automatic Xlate message generation

                    email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 61 years IT – old fart.

                • #122330
                  Jerry Sawa
                  Participant

                    We have a vendor that sometimes does not send the PDF so we have a Pre Proc TCL script that checks the message for “Base64”.

                    If not found, we kill the message.          return “{KILL $mh}”

                    • #122331
                      Darrell Glover
                      Participant

                        Woohoo!  Jerry, I think that did the trick.  Thanks to everyone that responded!

                         

                    • #122333
                      Jim Kosloskey
                      Participant

                        If I were to do this in an Xlate see attached.

                        First, I would ITERATE over the element in question (in our case the OBX segment in my case the OBX Group – no real difference.

                        Inside that ITERATE I would Check to see if any repetition OBX-3.1 is PDFReport. If it is set the SUPPRESS switch, then BREAK because we don’t need to keep checking.

                        ELSE
                        Do whatever is needed to build the message. No need for CONTINUE or SEND as the Xlate will always create one message outbound – in this case the one you build inside the ELSE.

                        Attachments:
                        You must be logged in to view attached files.

                        email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 61 years IT – old fart.

                    Viewing 4 reply threads
                    • You must be logged in to reply to this topic.