Copy from one OBX segment to a previous OBX in Xlate

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Copy from one OBX segment to a previous OBX in Xlate

  • Creator
    Topic
  • #51295
    Troy Morton
    Participant

    I need to copy the UOM value from the third OBX.5 in the result back to the first OBX.6 in the result series.

Viewing 2 reply threads
  • Author
    Replies
    • #69575
      Troy Morton
      Participant

      I tried this, however, it appears that @newvar is not being used as the group iteration.  Its copying to group (0) every time.  If I hardcode 3 into @mynewvar, it still only copies the UOM to the (0) group OBX.

      Code:

                     { { OP IF }
                         { ERR 0 }
                         { COND { 1(0).1(0).1(%g1).OBX.00572.[0] == =3} }
                         { THENBODY {
                             { { OP SUB }
                                 { ERR 0 }
                                 { IN {{$%g1} =2} }
                                 { OUT @mynewvar }
                                 { FUNCTION SUB }
                             }
                             { { OP COPY }
                                 { ERR 0 }
                                 { PRE {
                                     set #xlateOutVals [string range [lindex $xlateInVals 0] 6 end]
                                 }}
                                 { IN {{1(0).1(0).1(%g1).OBX.00573(0).[0]}} }
                                 { OUT {{1(0).1(0).1($@mynewvar).OBX.00574}} }
                             }
                             { { OP COPY }
                                 { ERR 0 }
                                 { PRE {
                                     echo $xlateInVals
                                 }}
                          }}
                         { ELSEBODY {
                         }}

      Output:

      Code:

      0(0).MSH(0)  :  >|^~&|LAB||||20091021094833||ORU^R01|92940000017|T|2.3|||MI00005265^^^SMD||PNSEVENS^MAYOTEST||19800101|F||||||||||I00000008753|RE|26143.001^LAB||||||||SAROW^ RON||^STRAYER^SUE^^^^^000451|LUBS|1|26143.001^LAB||SPG7P^PNEUMO VACC 7 TYPES||200910210809|200910210809|||||||200910210815||^STRAYER^SUE^^^^^000451||||W9134||||SO|F|SPG7P^SPG7P|^^^^^D|1|NM|SP4^SEROTYPE 4^ST4|1|0.4|Unit: ug/mL|||||F|||200910210947|IB^SMDB – LUBS DESK|7^SAROW^ RON|1||Reference range: >1.9|2|ST|SP14^SEROTYPE 14^ST14|1|<0.6||||||F|||200910210947|IB^SMDB – LUBS DESK|7^SAROW^ RON|2||Reference range: >5.2|3|NM|SP19F^SEROTYPE 19F^ST19F|1|1.6||||||F|||200910210947|IB^SMDB – LUBS DESK|7^SAROW^ RON|3||Reference range: >1.7<

    • #69576
      James Cobane
      Participant

      Troy,

      You can’t use temp variables as iteration variables, but you can use, create, and manipulate the value of iteration variables by referencing

    • #69577
      Troy Morton
      Participant

      Thanks James!  That worked.  I didn’t know you could create an iteration variable on the fly like that.  I’ll have to file this away in my Cloverleaf secrets, tips and tricks folder.    😀

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

Forum Statistics

Registered Users
5,042
Forums
28
Topics
9,200
Replies
34,021
Topic Tags
267