Change OBX value based on string

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Change OBX value based on string

  • Creator
    Topic
  • #51212
    Gary Atkinson
    Participant

      Hi-

      I have inbound message, which contains only one OBX segment with repeating field 5 values.  I need to take the repeating field 5 values and created multiple OBX segments.  If the string “Addendum:” is found in one of OBX:5 fields I need to set OBX:3 “ADDRADREPORT”.  In the xlate I am able to create the multiple OBX’s and look for the string “Addendum:”.  But I am not sure how go back to first OBX segment and replace “ADDRADREPORT’ in OBX:3 to all of the OBX segments.  So, if “Addendum:” is found in the very first OBX:5 it works, but if it’s found in second OBX:5 etc only the OBX segments from there down work.  

      So, my confusion is how do I tell the translation to go back and change all the OBX:3’s to ADDRADREPORT?

    Viewing 6 reply threads
    • Author
      Replies
      • #69196
        Troy Morton
        Participant

          Hi Gary,

          I think you should be able to just put a second ITERATE in your Xlate after the first ITERATE through the OBX segments to change all the OBX.3 values to ADDRADREPORT.

          Let me know if that doesn’t work or if you need more detail.

        • #69197
          Gary Atkinson
          Participant

            Thanks Troy!  I just was working on that thought 8) .  I’ll let know if I need more detail.

          • #69198
            Jim Kosloskey
            Participant

              Gary,

              You could do this:

              In your first ITERATE when you detect the presence of your trigger string, set a temp variable (eg temp variable @string_found intitialized to 0, when string is founc COPY =1 to @string_found). In this ITERATE all you will e doing is setting the temp variable.

              Then after (not inside the first ITERATE), add a second ITERATE and inside this one do all of your COPYing but when COPYing OBX-3 use an IF to check to see if @string_found is = 1, if so COPY your literal, else COPY the inbound OBX-3 to the outbound OBX-3.

              I think that should do it.

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

            • #69199
              Gary Atkinson
              Participant

                Jim-

                That is what I tried first since, but I could not figure out away to break out of the iterate and my temp_variable was always equal to 0 (unless the string was in the last obx5 repeat).  So, what I had to do was set a flag another field and then iterate again if the flag was true.  Is there a way to break out of the iterate in the translation?

              • #69200
                Jim Kosloskey
                Participant

                  Gary,

                  No need to break out of the ITERATE (can’t anyway).

                  @ beginning of Xlate COPY =0 –> @lit_found

                  In the first ITERATE (field iteration probably inside OBX Group ITERATE):

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

                • #69201
                  Gary Atkinson
                  Participant

                    I think my issue is with my tcl_proc I am using to find the string.  If the string is found in the xltp I set an variable to 1 else I set it to 0.  I pass this variable to xlateOutVals.  So, the variable gets reset after each obx:5 pass.

                  • #69202
                    Jim Kosloskey
                    Participant

                      Yup – you probably just want to turn it on never off.

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

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