Is there a size limit to temporary variables inside Xlate?

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Is there a size limit to temporary variables inside Xlate?

  • Creator
    Topic
  • #53002
    Connie Kraska
    Participant

    I think I have hit the maximum size of a string variable I am using inside a translation.  I have to convert mulitple OBX’s into one.  These OBXs contain transcripted reports so there is lots of text.

    Is there a way to indicate I need to use a large temporary variable?

    Sorry for posting a question that I am sure has been asked before, but I could not locate anything when searching the forum.

    Thanks for any assistance.  I will have to rewrite all my logic as a preprosing proc if I can’t get this to work, and of course I am under a rush deadline.

Viewing 5 reply threads
  • Author
    Replies
    • #76214
      Chris Williams
      Participant

      Connie,

      Have you checked the field size in your outbound variant? For unlimited field length it should be set to “-1”.

    • #76215
      Connie Kraska
      Participant

      The outbound variant is not my restriction.  it is the temporary variable I have defined to use during my translation.

      I am looping through OBX segments, concatenating all OBX.5’s into one temporary variable so that I can write it out to one outbound OBX.  When I put in echos in my TCL fragment and I can see that the temp variable, @secondOBX, truncates the accumulating OBX.5 text.  I have coded up a preprocessing script using grm-code and will test that soon.  I am concerned that this is a TCL issue and the temporary variable won’t hold the number of characters I need – 5000.

      Here is my Translation:

      prologue

         xlt_infile: hl7 2.6 hie ORU_R01

         who: spcekp

         date: March 16, 2012 1:24:02 PM MST

         xlt_outfile: hl7 2.6 hie ORU_R01

         type: xlt

         version: 7.0

      end_prologue

      { { OP COMMENT }

         { COMMENT {******************************     GENERAL INFORMATION    ************************************} }

      }

      { { OP COMMENT }

         { COMMENT {Epic ORU_R01 results to Epic.} }

      }

      { { OP COMMENT }

         { COMMENT {Author:  Lucy Maupin                Date: 02/03/11} }

      }

      { { OP COMMENT }

         { COMMENT {PREPROCESSING PROC: remove_amper} }

      }

      { { OP COMMENT }

         { COMMENT {*************************************** Modifications ************************************************} }

      }

      { { OP COMMENT }

         { COMMENT {Date         Modifier           Requester          Task ID    Change Detail} }

      }

      { { OP COMMENT }

         { COMMENT {08/30/2011 Connie Kraska

           Deb Ingraham                      Initial Install.} }

      }

      { { OP COMMENT }

         { COMMENT {02/07/2011 Connie Kraska  Greg Wikstrom  Addendums need to append after the report on OBX 2} }

      }

      { { OP COMMENT }

         { COMMENT {02/24/2012 Connie Kraska  Ric Guzman Changed logic so that the impression component } }

      }

      { { OP COMMENT }

         { COMMENT {                                                                          of an addendum presents first in OBX(0).  Had to use} }

      }

      { { OP COMMENT }

         { COMMENT {                                                                          OBX.3 in logic which forces use of preprocessing proc} }

      }

      { { OP COMMENT }

         { COMMENT {                                                                          remove_amper; which replaces & with ‘and’.} }

      }

      { { OP COMMENT }

         { COMMENT {03/24/2012 Connie Kraska  Ric Guzman Added Addendum literal to OBX(0)

      } }

      }

      { { OP COMMENT }

         { COMMENT {                                                   when ever there is a ADT.1 segment.

      } }

      }

      { { OP BULKCOPY }

         { ERR 0 }

      }

      { { OP COMMENT }

         { COMMENT {Sending Application.} }

      }

      { { OP COPY }

         { ERR 0 }

         { IN =EPIC }

         { OUT 0(0).MSH.00003 }

      }

      { { OP COMMENT }

         { COMMENT {Sending Facility.} }

      }

      { { OP COPY }

         { ERR 0 }

         { IN =TMC }

         { OUT 0(0).MSH.00004 }

      }

      { { OP COMMENT }

         { COMMENT {Receiving Application} }

      }

      { { OP COPY }

         { ERR 0 }

         { IN =HIE }

         { OUT 0(0).MSH(0).00005(0) }

      }

      { { OP COMMENT }

         { COMMENT {Recieving Facility.} }

      }

      { { OP COPY }

         { ERR 0 }

         { IN =Axolotl }

         { OUT 0(0).MSH(0).00006(0) }

      }

      { { OP COMMENT }

         { COMMENT {Set up temporary variables for holding data as loop through OBXs} }

      }

      { { OP COPY }

         { ERR 0 }

         { IN {=\.br\} }

         { OUT @firstOBX }

      }

      { { OP COPY }

         { ERR 0 }

         { IN {=\.br\} }

         { OUT @secondOBX }

      }

      { { OP COPY }

         { ERR 0 }

         { IN =N }

         { OUT @addendumflag }

      }

      { { OP COMMENT }

         { COMMENT {Loop through OBXs and retrieve text} }

      }

      { { OP ITERATE }

         { BASIS 1(0).1(0).1(0).OBX }

         { VAR %f1 }

         { TYPE segment }

         { BODY {

             { { OP COMMENT }

                 { COMMENT {1) Retrieve Impression text (IMP.2)which will go in first OBX  } }

             }

             { { OP COMMENT }

                 { COMMENT {2) Retrieve Addendum  Impression text (ADT.1 )} }

             }

             { { OP COMMENT }

                 { COMMENT {     both of which which will go in first OBX  } }

             }

             { { OP CALL }

                 { ERR 0 }

                 { IN {@firstOBX 1(0).1(0).1(0).OBX(%f1).#3(0) 1(0).1(0).1(0).OBX(%f1).#4(0) 1(0).1(0).1(0).OBX(%f1).#5(0)} }

                 { OUT {@firstOBX @addendumflag} }

                 { TCL {

                     set textin           [lindex $xlateInVals 0]

                     set observ_id        [lindex $xlateInVals 1]

                     set observ_subid     [lindex $xlateInVals 2]

                     set observ_text      [lindex $xlateInVals 3]

                     set cr \.br\

                     set firstOBX $textin$cr$observ_text

                     #echo “OBX0 $firstOBX”

                     # building the first OBX with ADT.1’s and IMP.2’s

                     if { ([cequal $observ_id “andADT”]) && ([cequal $observ_subid “1”]) } {

                          xpmstore $xlateId [lindex $xlateOutList 0] d -c $firstOBX

                          xpmstore $xlateId [lindex $xlateOutList 1] d -c “Y”

                     } elseif {([cequal $observ_id “andIMP”]) && ([cequal $observ_subid “2”]) } {

                          xpmstore $xlateId [lindex $xlateOutList 0] d -c $firstOBX

                     }

                 }}

             }

             { { OP COMMENT }

                 { COMMENT {4) Retrieve report text (IMP.!2, ADT.!1, all GDT) which will go in second OBX} }

             }

             { { OP CALL }

                 { ERR 0 }

                 { IN {@secondOBX 1(0).1(0).1(0).OBX(%f1).#3(0) 1(0).1(0).1(0).OBX(%f1).#4(0) 1(0).1(0).1(0).OBX(%f1).#5(0)} }

                 { OUT @secondOBX }

                 { TCL {

                     set textin        [lindex $xlateInVals 0]

                     set observ_id     [lindex $xlateInVals 1]

                     set observ_subid  [lindex $xlateInVals 2]

                     set observ_text   [lindex $xlateInVals 3]

                     #echo “ID $observ_id SUBID $observ_subid TEXT $observ_text”

                     set cr \.br\

                     set secondOBX $textin$cr$observ_text

                     # building the second OBX with all GDT, ADT not 1, and IMP not 2

                     if { ([cequal $observ_id “andGDT”] ) ||

                          (([cequal $observ_id “andADT”] && ![cequal $observ_subid “1”]) ||

                           ([cequal $observ_id “andIMP”] && ![cequal $observ_subid “2”])) } {

                        #echo “ID $observ_id SUBID $observ_subid TEXT $observ_text”

                        xpmstore $xlateId [lindex $xlateOutList 0] d -c $secondOBX

                        #echo “OBX1 – $secondOBX”

                     }

                 }}

             }

         }}

      }

      { { OP COMMENT }

         { COMMENT {Clear OBXs} }

      }

      { { OP ITERATE }

         { BASIS 1(0).1(0).1(0).OBX }

         { VAR %f1 }

         { TYPE segment }

         { BODY {

             { { OP PATHCOPY }

                 { ERR 0 }

                 { IN @null }

                 { OUT 1(0).1(0).1(0).OBX(%f1) }

                 { DFLT @null }

             }

         }}

      }

      { { OP COMMENT }

         { COMMENT {Build impression OBX (0) concatenating Addendum impression and Impression text} }

      }

      { { OP CALL }

         { ERR 0 }

         { IN {@firstOBX @addendumflag} }

         { OUT {1(0).1(0).1(0).OBX(0).#1(0) 1(0).1(0).1(0).OBX(0).#2(0) {1(0).1(0).1(0).OBX(0).#3(0).[0].[0]} 1(0).1(0).1(0).OBX(0.#4(0) 1(0).1(0).1(0).OBX(0).#5(0) {1(0).1(0).1(0).OBX(0).#3(0).[0].[1]}} }

         { TCL {

             #  build the OBX containing the impression

             set textin       [lindex $xlateInVals 0]

             set addflag      [lindex $xlateInVals 1]

             set cr \.br\

             set addlit “— ADDENDUM —“

             if { [cequal $addflag “Y”]} {

                echo ” found addendum (ADT.1)”

                set firstOBX $addlit$cr$textin

             } else {

                set firstOBX $textin

             }

             xpmstore $xlateId [lindex $xlateOutList 0] d -c “1”

             xpmstore $xlateId [lindex $xlateOutList 1] d -c “FT”

             xpmstore $xlateId [lindex $xlateOutList 2] d -c “&IMP”

             xpmstore $xlateId [lindex $xlateOutList 3] d -c “1”

             xpmstore $xlateId [lindex $xlateOutList 4] d -c $firstOBX

             xpmstore $xlateId [lindex $xlateOutList 5] d -c “”

         }}

      }

      { { OP COMMENT }

         { COMMENT {Build report OBX (1) concatenating Addendum text and report  text} }

      }

      { { OP CALL }

         { ERR 0 }

         { IN {@secondOBX @addendum} }

         { OUT {1(0).1(0).1(0).OBX(1).#1(0) 1(0).1(0).1(0).OBX(1).#2(0) {1(0).1(0).1(0).OBX(1).#3(0).[0].[0]} 1(0).1(0).1(0).OBX(1).#4(0) 1(0).1(0).1(0).OBX(1).#5(0) {1(0).1(0).1(0).OBX(1).#3(0).[0].[1]}} }

         { TCL {

             #  build the OBX containing the impression

             set report    [lindex $xlateInVals 0]

             set addendum  [lindex $xlateInVals 1]

             set cr \.br\

             #echo “REPORT – $report”

             # if the “addendum” variable contains more than .br

             # concatenate it infront of the report variable

             if {[string length $addendum] > 5} {

                #echo ” found addendum”

                set textout $addendum$cr$report

             } else {

               set textout $report

             }

             xpmstore $xlateId [lindex $xlateOutList 0] d -c “2”

             xpmstore $xlateId [lindex $xlateOutList 1] d -c “FT”

             xpmstore $xlateId [lindex $xlateOutList 2] d -c “&GDT”

             xpmstore $xlateId [lindex $xlateOutList 3] d -c “2”

             xpmstore $xlateId [lindex $xlateOutList 4] d -c $textout

             xpmstore $xlateId [lindex $xlateOutList 5] d -c “”

         }}

      }

      { { OP COMMENT }

         { COMMENT {Populate result status, producers id, and responsible observer for both OBX segs} }

      }

      { { OP COPY }

         { ERR 0 }

         { IN {1(0).1(0).1(0).OBX(0).#11(0) 1(0).1(0).1(0).OBX(0).#15(0) 1(0).1(0).1(0).OBX(0).#16(0)} }

         { OUT {1(0).1(0).1(0).OBX(0).#11(0) 1(0).1(0).1(0).OBX(0).#15(0) 1(0).1(0).1(0).OBX(0).#16(0)} }

      }

      { { OP COPY }

         { ERR 0 }

         { IN {1(0).1(0).1(0).OBX(0).#11(0) 1(0).1(0).1(0).OBX(0).#15(0) 1(0).1(0).1(0).OBX(0).#16(0)} }

         { OUT {1(0).1(0).1(0).OBX(1).#11(0) 1(0).1(0).1(0).OBX(1).#15(0) 1(0).1(0).1(0).OBX(1).#16(0)} }

      }

    • #76216
      Connie Kraska
      Participant

      Chris, I did check the size of the field in my outbound variant:

      00573 Observation Value

      I do not see how to set it to -1 via the queue tool.  Would I have to edit the format definition under $HCIROOT?  I am running QDX 5.7.

    • #76217
      Chris Williams
      Participant

      We’ve always edited the FIELDS file under the relevant variant. It’s just a text file. You’ll want to change the value in the LEN item so it reads {LEN  -1}

    • #76218
      Connie Kraska
      Participant

      Chris,

      Thanks so much for your assistance.

      I made the change to the outbound variant, even though I was convinced it had to do with the temporary variable.  Lo and Behold it worked.  I knew I was exceeding 5000 characters (used Word’s character count function) and that I would have to change the variant to accomodate that, but I was fixated on the temporary variable being a issue also.   So now I am mystified by how  changing the outbound variant changed the behavior of an internal temporary variable.  I will have to repeat all my steps to confrm it really did or prove I simply wasn’t looking at it right.

      Thanks again.

    • #76219
      Kevin Crist
      Participant

      We have to put all OBX.5 fields into one for a specific vender. We do this in an Xlate by doing the below copy after iterating the OBX segments.

      COPY

      1(0).1(0).1(%g1).OBX.00573(0) -> 1(0).1(0).1(0).OBX.00573(%g1)

      Hope this helps.

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

Forum Statistics

Registered Users
5,129
Forums
28
Topics
9,301
Replies
34,447
Topic Tags
288
Empty Topic Tags
10