Field Not Clearing Between Messages

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Field Not Clearing Between Messages

  • Creator
    Topic
  • #55577
    Mohammed Iqbal
    Participant

    Good evening All,

    I am attempting to identify the cause of an issue I am encountering when creating a single OBX-5 field, for a single OBX segment, from the product of appending the contents of multiple OBX-5 fields from repeating OBX segments, using a foreach statement and append.

    The TCL Pre Proc code fragment I’ve added to my xlate accomplished what I needed it to; however, it appears the variable created does not clear itself from memory between messages, which causes for the content from the previous message to be appended to the content of each following message. It’s as if the xlate is unwilling to let go of the string created from the previous message. This occurs despite attempting to clear the variable with a @null copy over. I am currently using the following TCL in my xlate for OBX-5:

    Code:

    set obx5 $xlateInVals
    foreach $xlateInVals $obx5 {
           set xOut [string map {{ “” } “”} [concat $obx5\.br\]]
    break
    }
    append obx5out $xOut
           set xlateOutVals [list $obx5out]

    The OBX segment is set up as an iterating group at 1(0).1(0).3(%g1).

    I’ve tried writing to a temp variable as well so I can clear it before iterating; however, this did not resolve the issue either. If anyone else has encountered a similar issue and if you were able to identify the root cause and solution, if you could please provide that information it would be greatly appreciated.

    Thank you.

    Respectfully,

    Mohammed

Viewing 5 reply threads
  • Author
    Replies
    • #85796
      Jim Kosloskey
      Participant

      If I am understanding the desired result correctly you want to concatenate all of the present OBX-5 fields for all of the present OBX Group into one OBX-5 field as one OBX Group.

      I am not sure why you are attempting to do this with Tcl since the Xlate will allow you to do this without Tcl.

      One question is do the various OBX-5 fields need to become a repeating OBX-5 field in the OB?

      The answer will determine which method to deploy.

      If no repeating OBX-5 field out:

      ITERATE over the OBX Group.  CONCAT the OB OBX-5 with the current IB OBX-5 using zeros at the group repetition point n the OB and the ITERATE  Variable (counter) at the appropriate position of the IB Address Path.. When the ITERATE is done, the OB OBX-5 will have all of the located OBX-5 fields for all of the OBX Group repetitions.

      If OB OBX-5 is to be repeating…

      ITERATE over the OBX Group. COPY the current OBX-5 field to the OB OBX-5 field using zero at the OB Group Address Path position and the OBX Group Variable (counter) at the Field Address Path Location. When the ITERATE is done the OB OBX-5 will have one repetition for each repetition of the IB OBX.

      If you have any questions regarding the above, feel free to email me and I will work with you.

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

    • #85797
      Mohammed Iqbal
      Participant

      Jim, thank you for the response. My apologies, for the delayed reply.

      The first situation is the one that applies for me, in terms of the OB being a single OBX segment. That said, I attempted your suggestion; however, it does not appear to be working, possibly because I may not be interpreting your directions correctly. The text below is from the xlate’s text file, for the relevant portion addressing OBX-5:

      Code:

                     { { OP COPY }
                         { ERR 0 }
                         { IN {{1(0).1(0).3(%g1).0(0).OBX(0).#5(0).[0]} {=\.br\} {~1(0).1(0).1(0).OBX(0).#5(0).[0]}} }
                         { OUT {{1(0).1(0).1(0).OBX(0).#5(0).[0]}} }
                         { COPYSEP {} }
                     }

      The following is how I previously had it configured with the foreach statement:

      Code:

                     { { OP COPY }
                         { REM 1 }
                         { ERR 0 }
                         { PRE {
                             set obx5 $xlateInVals
                                     foreach $xlateInVals $obx5 {

                                     set xOut [string map {{ “” } “”} [concat $obx5\.br\]]

                                     break

                                     }

                                     append obx5out $xOut

                                     set xlateOutVals [list $obx5out]
                         }}
                         { IN 1(0).1(0).3(%g1).0(0).OBX(0).#5(0) }
                         { OUT 1(0).1(0).1(0).OBX(0).#5(0) }
                     }

      Does my setup seem inaccurate?

    • #85798
      Jim Kosloskey
      Participant

      Try using the CONCAT Action in the Xlate not the COPY Action.

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

    • #85799
      Mohammed Iqbal
      Participant

      The first code snippet is with the use of the CONCAT Action in place. I’m not certain why it states COPY when viewed in text.

    • #85800
      Jim Kosloskey
      Participant

      Are you sure you are ITERATING over the OBX Group? Based on what I see in the IB address path the repetition counter appears to be one group too high.

      If you would like to discuss this off line, email me.

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

    • #85801
      Mohammed Iqbal
      Participant

      Jim,

      Thank you for your help and pointing me in the right direction. I was able to get it working by taking another look at how I was iterating through the multiple segments. I had to add another group, and then place a group within that group. After doing so, followed by additional trial and error, the concatenation started to occur.

      Thank you again for your help.

      Respectfully,

      -Mohammed Iqbal

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

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,435
Topic Tags
286
Empty Topic Tags
10