Adding new OBX segments to an iteration?

Clovertech Forums Cloverleaf Adding new OBX segments to an iteration?

  • Creator
    Topic
  • #122240
    Darrell Glover
    Participant

      I am using an iteration to convert the ORU NTE segments to OBX due to application requirements  This will be for pathology reports to an electronic medical record.  Unfortunately, the current NTE segments do not have any patient identification, so I need to manually add the information as new OBX segments so they will display at the top of the body of the report in the medical record application.  When I try to add information it overwrites the first OBX segment.  As a workaround I have it currently setup to append the patient information to the first OBX segment, but I would much rather just add the patient information as their own OBX segments at the top.  Is there any way to do that?  Please see my attached screenshot of what I have right now.  Thanks!

      Attachments:
      You must be logged in to view attached files.
    Viewing 5 reply threads
    • Author
      Replies
      • #122242
        Peter Heggie
        Participant

          I believe this falls under the “fun with indexes” category. You will need to maintain separate indexes/variables for the NTE segments vs the OBX segments. As you mentioned, you may want to “insert” a new OBX segment at the top. You will have math functions to increment counters that are used as the OBX indexes. This means that your OBX index will end up being greater than your NTE index.

          Example – if you know there will be five patient identification OBX segments, write those out first, incrementing the index for each OBX, from 0 through 4. Then when you get into your NTE-based loop, use that same OBX index, currently valued at 4, and add 1 to it for each NTE segment that you are copying over to an OBX.

          This will take some time to work out, but everything is addressable.

          Peter Heggie
          PeterHeggie@crouse.org

        • #122243
          Lisa Nanney
          Participant

            Is this sort of what you are trying to do? I have to add an OBX segment at the top of reports with the accession#. Then, I renumber the remaining OBX segments through the iteration.

            Attachments:
            You must be logged in to view attached files.
          • #122245
            Jim Kosloskey
            Participant

              If after reading the provided answers (all of which are correct) you still are having issues, I am willing to via desktop sharing, help you work through this issue. There are some nuances involved.

              Just email me and we can work on this off-line if you would like. Email is in my signature.

              email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 61 years IT – old fart.

            • #122246
              Jason Russell
              Participant

                Cloverleaf is really kind of ‘not good’ in this regard. You have to keep two sets of variables, one standard translate variable (@var) where you can do MATH functions, then the iterate variable (%g1 – where g can be i or f depending on context, and a number), which you have to put a $ to store into (see Lisa’s copy line of @idx -> $%g2). Cloverleaf won’t allow you to math on the % variable, so you have to update the @variable then store it into the % variable. It’s a really odd design choice. Otherwise, as the others said, you need to keep your iterate index and copy index separate and keep the counter current.

                • #122247
                  Jim Kosloskey
                  Participant

                    Actually, I do MATH Actions on the % variables all the time. You can increment or decrement them as needed inside the Xlate thus reducing or eliminating altogether the need for intervening temp variables.

                    For example, to set the Set ID for an OBX Segment, do a MATH ADD using $%s1 and =1 placing the result in the OBX Set ID field (the % variables are always relative to zero, the Set ID relative to one).

                    I cover this along with other Xlate ITERATE nuances and principles in my Xlate ITERATE Calss (shameless plug).

                    email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 61 years IT – old fart.

                  • #122248
                    Jim Kosloskey
                    Participant

                      Another example is you can actually increment or decrement the % counters directly as well by doing a MATH ADD with $%s1 (for example) and =1 in the Source column and $%s1 in the Destination column.

                      The rule is when referencing the iteration variable (% counter) in the Source or Destination a $ must prepend the iteration value, whereas when used in the address path of a data item no $ is used (or else the result has the value of zero).

                      email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 61 years IT – old fart.

                  • #122249
                    Darrell Glover
                    Participant

                      Thank you all for the great feedback!  I am new to this forum and you guys all have great info!  I used Lisa’s example as a template and I am getting closer.  The IF part of my xlate is working fine, but the actual iteration in the ELSE is not working correctly.  I just end up with all the OBX1 segments being added from the NTE1 segments (the OBX5 is never populated).   I suspect it is something with how I have the iteration Type/Basis/Variable configured.  Please see the attached and let me know where I am screwing up.  Thanks!

                      Attachments:
                      You must be logged in to view attached files.
                    • #122251
                      Darrell Glover
                      Participant

                        I think I have it working!  Thanks again for all the help!

                        • #122252
                          Jim Kosloskey
                          Participant

                            Congratulations in getting it working. It appears your solution will only work if there is one and only one OBX/NTE group. Perhaps that is the situation. However, if the source system ever sends multiple OBX/NTE Groups, your solution may not function as desired.

                            email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 61 years IT – old fart.

                      Viewing 5 reply threads
                      • You must be logged in to reply to this topic.