Can I place data in Cloumn format converting OBX to NTE

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Can I place data in Cloumn format converting OBX to NTE

  • Creator
    Topic
  • #49541
    Robert Hamden
    Participant

      I think I need to pad the data:

      Present look:

      NTE|||ANT    AMAMPICILLINANTIBIOTIC    0.5L            I

      NTE|||ANT    CFZCEFAZOLIN    <=2L            S NTE|||ANT    CFPCEFOPERAZONE    <=4L            S NTE|||ANT    CFTCEFOTAXIME    <=2L            S Needed look NTE|||ANT    AMAMPICILLINANTIBIOTIC         0.5L           I NTE|||ANT    CFZCEFAZOLIN                       <=2L          S NTE|||ANT    CFPCEFOPERAZONE                 <=4L          S NTE|||ANT    CFTCEFOTAXIME                     <=2L          S

    Viewing 8 reply threads
    • Author
      Replies
      • #62404
        Jim Kosloskey
        Participant

          Robert,

          You will need to use some Tcl in your Xlate (if using an Xlate) to format the output.

          Jim Kosloskey

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

        • #62405
          Robert Hamden
          Participant

            I hve been trying to use TCL concat then string trimright or string trimleft wih no success.

          • #62406
            John Hamilton
            Participant

              Try the format command

              It allows you to more control of what the outbound string looks like.

              You shoul be able to create the columns easly.

            • #62407
              Charlie Bursell
              Participant

                If you are sure your string will always be of that style and no embedded spaces in any of the fields you can treat it as a list.  For example, something like “ANT    AMAMPICILLINANTIBIOTIC    0.5L            I” could be treated as a list of 4 elements but if you have some thing like

                “ANT    AMAMPICILLINANT  BIOTIC    0.5L            I” it wouldn’t work because AMAMPICILLINANT and BIOTIC would be different elements.  If you suspect embedded spaces I’ll leave it to you to parse out the fields.  Asumming no embedded spaces you could do something like:

                set inp “ANT    AMAMPICILLINANTIBIOTIC    0.5L            I”

                lassign $inp A B C D

                set output [format “%-5s %-30s %-14s %-3s” $A $B $C $D]

                (Adjust formatting as required)

              • #62408
                Robert Hamden
                Participant

                  Thanks for the hand, I have tried the foollowing and can see the change to the data in the test windon but changes data never makes to NTE

                  lassign $xlateInVals A

                  set xlateOutVals [format “%-8s” $A]

                  To see the change I did this:

                  echo $xlateInVals

                  lassign $xlateInVals A

                  set xlateOutVals [format “%-8s” $A]

                  echo $xlateOutVals

                  echo [string length $xlateOutVals]

                • #62409
                  Charlie Bursell
                  Participant

                    You want be able to see what is in the modified xlateOutVals until after the statement is executed.  What you should see the way you did it is the same values in xlateInVals and xlateOutVals.

                  • #62410
                    Robert Hamden
                    Participant

                      Here is the output: Note the lenght of the 2nd ANT and then look at the NTE segment

                      ANT

                      ANT      

                      MESSAGE 1

                      0(0).MSH(0)  :  >|^&|MIC|COM|MIC|21400|200703301351||ORU|55268..LAB.PA|P|2.1|||AL< 1(0).0(0).0(0).PID(0)  :  >|1||RSRMRN||ROSR^INTERFACE|||||||||||||RSRACCT< 1(0).0(0).1(0).PV1(0)  :  >|||^^^HCA< 1(0).1(0).0(0).OBR(0)  :  >|1|LABMICORD1^MIC|M32426^MIC|WOUNDC^WOUNDCULTURE^L|R||200703301348|||INFCE||||200703301348|ABDOMINAL|DR.FARLEY||Micro||||200703301351|||P< 1(0).1(0).0(0).NTE(0)  :  >|||Specimen #: 07:PA:B0000127R~< 1(0).1(1).0(0).OBR(0)  :  >|2|LABMICORD1^MIC|M32426^MIC|WOUNDC^WOUNDCULTURE^L|R||200703301348|||INFCE||||200703301348|ABDOMINAL|DR.FARLEY||Micro||||200703301351|||P||||LABMICORD1&MIC^M32426&MIC< 1(0).1(1).0(0).NTE(0)  :  >|||Micro~< 1(0).1(1).0(0).NTE(1)  :  >|||ANT<

                    • #62411
                      Charlie Bursell
                      Participant

                        Change this statement

                        set xlateOutVals [format “%-8s” $A]

                        To

                        set xlateOutVals

                          ]

                        1. #62412
                          Robert Hamden
                          Participant

                            Thank you Charlie, that was the ticket

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