Concat and Iterate

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Concat and Iterate

  • Creator
    Topic
  • #51712
    Mark Perschbacher
    Participant

      I’m trying to concat all the OBR 4 values from an ORM into a single field within an xlate.  I have an Iterate set up, and COPY

      2(%g1).1(0).0(0).OBR(0).#4(0).[0] to 0(0).PV1(0).#5(0)  what is showing up is just the last OBR 4 value.  IF I list out the repeating OBR’s in the Concat action like this

      2(0).1(0).0(0).OBR(0).#4(0).[0]

      2(1).1(0).0(0).OBR(0).#4(0).[0]

      2(2).1(0).0(0).OBR(0).#4(0).[0]

      It works fine, any ideas what is going on?

    Viewing 7 reply threads
    • Author
      Replies
      • #71391
        Shibu Mathew
        Participant

          Mark,

          Looks like the loop is overwriting the value with each iteration. May be your should copy the OBR.4 values to a variable, and then concat the variable to the PV1.5 field.

          Thanks.

        • #71392
          Mark Perschbacher
          Participant

            Shibu, thanks for your reply.  So I tried a Copy command with the iterated OBR to a variable, then Concat to the PV1 field, but got the same results.

          • #71393
            Robert Milfajt
            Participant

              You can refer to the output value in your source list for the CONCAT.  I think the following should work.  You may need to null out PV1.5 before hand depending on what happened earlier in your Xlate.

              Code:

              CONCAT
              Source
              2(%g1).1(0).0(0).OBR(0).#4(0).[0]
              ~0(0).PV1(0).#5(0)      —>(~ means use the output value)
              Destination
              0(0).PV1(0).#5(0)

              Hope this helps,

              Robert Milfajt
              Northwestern Medicine
              Chicago, IL

            • #71394
              Mark Perschbacher
              Participant

                Yeah! It worked.  Thanks Robert, what exactly does referencing the output value do in this case?

              • #71395
                Tom Rioux
                Participant

                  Mark,

                  By referencing the output value, it takes what has been previously mapped to that field and uses it as a source value.   One thing you need to remember though is that if you are using bulkcopy or pathcopy on the PV1 segment BEFORE you hit your iteration, then there is a chance that PV1.5 may be mapped with data that you don’t need or want.   Unless you want to include that data along with that of your iteration, then you will need to do some checking to make sure that the PV1.5 isn’t populated with unwanted data first.

                  Also, if it is necessary to keep the data in PV1.5 in the same order in which it came out of the OBR.4, then you will need to modify the CONCAT as such:

                  CONCAT

                  Source

                  ~0(0).PV1(0).#5(0)      —>(~ means use the output value)

                  2(%g1).1(0).0(0).OBR(0).#4(0).[0]

                  Destination

                  0(0).PV1(0).#5(0)

                  Hope this helps….

                  Tom Rioux

                • #71396
                  Mark Perschbacher
                  Participant

                    Yes it does, thanks.  Now that I have the OBR values successfully concatenating, what I really want to do is run them through a table, and concat the output.  I tried adding this snipet to the Copy variable to PV1 field action, but only got the last table value concatenated onto the OBR values.  Again, any ideas?

                    set data $xlateInVals

                    set route1 [hcitbllookup pathor $data]

                    append xlateOutVals “$route1”

                  • #71397
                    Tom Rioux
                    Participant

                      Are you wanting to run each individual OBR.4 value through a table and then take that resulting output and concat it to the PV1.5 value?  If so, try something like this:

                      ITERATE

                         COPY  (to initialize the variable with each iteration)

                             Source        @null

                             Destination  @route1

                         TABLE  {pathor}

                             Source        2(%g1).1(0).0(0).OBR(0).#4(0).[0]

                             Destination  @route1

                         CONCAT

                             Source        ~0(0).PV1(0).#5(0)

                                               @route1

                             Destination  0(0).PV1(0).#5(0)

                      Let me know if this works for you or if you are wanting something totally different.

                      Hope this helps…

                      Tom Rioux

                    • #71398
                      Mark Perschbacher
                      Participant

                        Thomas, you nailed it.  Thanks so much.  It would have taken me another week to figure it out.

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