Convert OBX to Z segments

Clovertech Forums Cloverleaf Convert OBX to Z segments

  • Creator
    Topic
  • #111008
    John Hamilton
    Participant

      We are running Epic to LabCorp orders interface.
      Cloverleaf 6.1 Converting to 6.2 on AIX.

      Currently I do this with a TCL script. But would like to move it to a translation.

      We get from Epic this iteration of OBX segments. We have at least 5 different Z segments to create.

      2(0).1(0).2(0).0(0).OBX(0)  :  >|1|ST|ZCI2-1^HEIGHT||62|||||||||<
      2(0).1(0).2(0).0(1).OBX(0)  :  >|2|ST|ZCI3-1^WEIGHT||111|||||||||<
      2(0).1(0).2(0).0(12).OBX(0)  :  >|13|ST|ZCI2-2^HEIGHT UNITS||IN|||||||||<
      2(0).1(0).2(0).0(13).OBX(0)  :  >|14|ST|ZCI3-2^WEIGHT UNITS||LB|||||||||<
      2(0).1(0).2(0).0(14).OBX(0)  :  >|15|ST|ZCI4-2^URINE VOLUME UNITS||ML|||||||||<
      2(0).1(0).2(0).0(15).OBX(0)  :  >|16|ST|ZCI5-1^FASTING?||N|||||||||<

      OBX.3 hold the Segment field and subfield to put the value in OBX.5 into.
      I know I could add dozens of IF statements and do it. But I’m hoping for a more elegant way to do this.

      So the above ideally would become

      ZCI|62^IN|111^LB|^ML|N

      So is there a way to take the ZCI(5-1) as a variable in use it in the destination field ?  

      IN OBX(0).#5  Copy    Out  ZCI(0).#($Var).($Var1)

      I have tried multiple variations but it seems this can’t be done.
      But I know there a lot of experienced people here and they may have done this.

      Thanks for taking the time to review.

       

    Viewing 2 reply threads
    • Author
      Replies
      • #111009
        Jim Kosloskey
        Participant

          Unfortunately at the component and subcomponent level of the address path no indirect reference is directly supported by the Xlate.

          IF the order was static you Could use multiple COPY Actions referencing the direct repetition in the Address Path of the Source OBX and the component notation for the Destination because the position would be known.

          OR –

          You could write an xpm type proc which replaces the variable notation in the Destination Address path and have one  (or more) COPY (or CALL) Actions with multiple Source elements and one Destination element. I think you would use an xpmstore command after modifying the xlateOutList to replace the variable notation with their value(s).

          I have done something like (but not exactly) this in the past.

          So essentially you will have a Destination of ZCI(0).#(@Var).(@Var1). The xlateOutList element you are provided by the Xlate will have the above value. In the Source you would provide the elements @Var and @Var1. then in your code using a string command replace the values @Var and @Var1 in the Destination xlateOutList to the values from the Source for @Var and @Var1.

          Your proc would also copy the values for the Source (xlateInVals) actual OBX data to the xlateOutVals.

          I am sure there would be other details to work out but the above should give you an idea of what can be done using XPM functions and the Xlate

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

        • #111010
          John Hamilton
          Participant

            Well that stinks.  I work with several people who have no knowledge of TCL and no time to really learn it.   I was just trying to make it as supportable as possible for a less experienced interface person.

            But thanks Jim.  I hope all things are well with you.

             

          • #111011
            Jim Kosloskey
            Participant

              Well then I would go with the multiple IF Actions.

              The supporting folks don’t need to be coding geniuses to figure it out. Especially if fully commented.

              If you want to neaten thing up a bit for when the Xlate is first opened you could do something like this:

              IF =zc1_handling eq =zc1_handling

              IF (part of ZC1 handling) <– Subordinate to the above IF

              …. More ZC1 handling Subordinate to the first IF above

              When the Xlate is opened then only the first IF would be shown with the subordinates ‘hidden’ until the first IF is expanded.

              This is just one of the many things I teach in my Xlate ITERATE class.

              I am doing well – good to hear from you again John.

              If you would like to discuss this in more detail off line my email is part of my post.

              Take care.

              • This reply was modified 5 years, 5 months ago by Jim Kosloskey. Reason: Indentation not working or I can't figure it out so additional information at subordinate IF etc

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

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