Concating an Iterate

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Concating an Iterate

  • Creator
    Topic
  • #52644
    Kevin Crist
    Participant

      I am trying to concat all the OBX.5.1 fields into the OBR.31 field. I am only getting the last OBX field to go into this field. I cant tell if my iterate is wrong or if it is overwriting therefore ending up with the last one.

      These are the OBX examples:

      |1|CE|RAD1^TRANSPORT MODE|1|CART^TRANSPORT MODE,CART< |2|CE|RAD5^OTH RAD EXAMS TODAY|1|Y^OTH RAD EXAMS TODAY,YES< |3|ST|REA8^REASON FOR EXAM|1|not really^REASON FOR EXAM,not really<

      I want them to look like this in the OBR.31 field:

      CART^TRANSPORT MODE,CART::OTH RAD EXAMS TODAY,YES::REASON FOR EXAM,not really< I have attached my iterate and xlate. Thanks for any help or advice.

    Viewing 6 reply threads
    • Author
      Replies
      • #74965
        Rob Abbott
        Keymaster

          it looks like you need the destination field as a source in every CONCAT.  Looking at the screenshots I only see it in the last one.

          It might be easier to read if you to build up a temp variable inside the iterate and COPY that to the destination after the iterate.

          Rob Abbott
          Cloverleaf Emeritus

        • #74966
          Russ Ross
          Participant

            I noticed on some of your concat statments the destination field has a %g in the path and that might be what is part of your delima.

            Another approach to help reduce pathing issues is to concat everyhting to a temproary varibale and once everything is concatendated as desired then copy the contents of the temporary variable to the desired destination field.

            Also, as Rob pointed out the temporary variable will be the first input item to the concat statment as well as the output of the concat statment.

            Russ Ross
            RussRoss318@gmail.com

          • #74967
            Kevin Crist
            Participant

              Thanks for the replies but i think i am confusing myself.

              Below is what the original OBX looks like. I need to concat the OBX.3.1 field (which is the question) to the OBX.5.1 field (which is the answer field), except for if the OBX.3.1 is REASON FOR EXAM then i concat that to the OBX.3.0 field. So the example in my previous post is after this is done, which works ok until i try to add them all to the same field.

              OBX|1|CE|RAD1^TRANSPORT MODE|1|CART^CART

              OBX|2|CE|RAD5^OTH RAD EXAMS TODAY|1|Y^YES

              OBX|3|ST|REA8^REASON FOR EXAM|1|not really

              If my iteration is off where does that need to be?

            • #74968
              Henry Tabingo
              Participant

                Is your last concat statement within the iterate?

              • #74969
                Henry Tabingo
                Participant

                  Hi Kevin,

                  If you haven’t already resolved your xlate, you may also need to place the repeating variable in your destination path in that last concat. The OBR field will then have a repeating tilde “~” that separates each value:

                  CONCAT   {~2(0).1(0).OBX.00573(0).[1]}=::->2(0).0(0).OBR.00263(%g1)

                  Henry

                • #74970
                  Kevin Crist
                  Participant

                    OK, i am having quite a time with this. i have changed to try and use more variables and am running into an issue. When i try to concat all of the OBX.5.1 fields into 1 variable i think they are overwriting each other but not real sure. Any ideas?

                  • #74971
                    Russ Ross
                    Participant

                      I never did completely understand exactly what you wanted to accomplish but still not seeing that your output temp variable is the first input to the CONCAT statement.  

                      For example using your CONCAT for @Prompts in your screen shot I’m thinking might look something like this:

                      @Prompts {2(0).1(0).1(0).0(%g1).OBX.00571.[1]} =, {2(0).1(0).1(0).0(%g1).OBX.00573.[1]} -> @Prompts

                      Of course don’t forget to initilize @Prompts to @null before you start using it inside your iterates.

                      Russ Ross
                      RussRoss318@gmail.com

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