Iterate problem, 1 type: group, 2 type: segment

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Iterate problem, 1 type: group, 2 type: segment

  • Creator
    Topic
  • #53635
    Johnny Anderson
    Participant

      CL v5.8, Sun Solaris 10, HL7 v2.3.1

      Started with 1 Iterate, type: segment.  I added a new Iterate, type: segment, to be matched with the first type: segment.

      I added a new Iterate, type: group, and placed the 2 type: segments under it.  See below, I have 2 ip segments and only

      1 op segment, need 2 op segments.  See all attachments, they have multiple slides.  For attachment

    Viewing 12 reply threads
    • Author
      Replies
      • #78369
        Jim Kosloskey
        Participant

          Johnny,

          I am just curious if you have run the inbound message(s) through the HRL Testing tool and if so were the repetitions where you expected and did the data look correct?

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

        • #78370
          Johnny Anderson
          Participant

            Sorry for the delay, Saturday, our CL test server was moved to a different city and we

          • #78371
            Jim Kosloskey
            Participant

              Johnny,

              I really don’t have the time to delve deeply into this today and I will be in Houston for the next week. I will try to look more deeply into it as time permits.

              In the meantime I think you have the 02_17 defined as repeating in two places. The primary HRL for the actual sub-HRL and again in the sub-HRL.

              I would verify that is correct. If it is not (I suspect it is not) then that may be confusing the parser thus the ITERATE not functioning as expected.

              I suspect you only want the repetition specified in the parent HRL at the point it is referencing the sub-HRL.

              Another suggestion is to echo out the %g and %s counters to validate the values are what you expect at the appropriate time.

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

            • #78372
              Johnny Anderson
              Participant

                All attachments have multiple slides or pages.

                For the issue of the 02_17 defined as repeating in two places, I removed the Repeats from the sub-HRL and got bad results so I

                put it back then I removed the Repeats from the parent HRL and got bad results so I put it back.

                I tried to echo variable %g1 but got this error: “The list of addresses are totally unresolvable”, see attachment

              • #78373
                Jim Kosloskey
                Participant

                  Johnny,

                  Use a $ in front of counters – like $%g1 when referencing as a Source or Destination (and thus affecting Tcl).

                  That should allow you to echo out the value.

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

                • #78374
                  Johnny Anderson
                  Participant

                    I have echos for the the variable %g1.  Attachment has multiple slides.

                  • #78375
                    Robert Kersemakers
                    Participant

                      Hi Johnny,

                      When I look at the testing results of your HRL, none of the testmessages are showing that the HRL ‘Types_02_17’ is being filled. So imho the HRL definition isn’t working, although it looks valid to me.

                      Do I understand correctly that your ‘Types_02_17’ consists of one Type_02, followed by zero or more Type_17? Maybe you could try to SET Type_02 inside the HRL Types_02_17 to No Repeat.

                      But you have to get the HRL working correctly first.

                      I’m not sure if you get this HRL inside an HRL to work; I haven’t seen it mentioned on this forum before and I don’t have a working example of it either.

                      Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

                    • #78376
                      Jim Kosloskey
                      Participant

                        I have defined HRL inside HRL so basically that does work.

                        I do agree that the place to concentrate is on the message construct definition versus the actual data.

                        Again, when I get back to my office I should have more time to delve into this.

                        In the meantime, something I do is to make a very skeleton Xlate just enough to validate the structure before aI flesh out the rest. That allows me to validate the structure before I have too much ‘noise’ to contend with.

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

                      • #78377
                        Johnny Anderson
                        Participant

                          Robert, the above

                        • #78378
                          Robert Kersemakers
                          Participant

                            Ok, based on these latest testingtool results you sent, I think I got it.

                            I am going to talk about you first xlate (xlate.ppt), where you have an iterate within an iterate. So not that later xlate_45.ppt, where you  have only one iteration.

                            In the first iterate, you use %g1. The iterate within, you use %s1. This is ok. However, for the outbound PID segments, you are also using %s1 and this is where things go wrong. Why? Because either %g1 or %s1 can increase, meaning a new PID segment should be output. You can clearly see this in the last testingtool result of the HRL.

                            So you will need to define and maintain your own counter (%g9; I am using a group counter because you are repeating a group) to keep track of the number of PID segments that are output.

                            Before the iteration, set %g9 to 0:

                            Code:

                            COPY =0 -> $%g9


                            Then in all the PID segments, use %g9 as your variable, instead of %s1 you are using now.

                            At the end of writing a complete PID-segment, you need to increase %g9:

                            Code:

                            MATH ADD $%g9 =1 -> $%g9

                            That should do the trick. Hope this works.

                            Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

                          • #78379
                            Johnny Anderson
                            Participant

                              Robert, thanks for the help, I

                            • #78380
                              Robert Kersemakers
                              Participant

                                I’m going to try to explain.

                                If you look at the test_tool_results that you sent yesterday, you will see in message 3 the following lines:

                                Code:

                                — Begin HRL Segment Types_02_17(0) —
                                — Begin FRL Segment Types_02_17(0).Type_02 —  
                                — Begin FRL Segment Types_02_17(0).Type_17 —  
                                — Begin HRL Segment Types_02_17(1) —  
                                — Begin FRL Segment Types_02_17(1).Type_02 —


                                So in this message the HRL Types_02_17 is iterating, with only 1 Type_02 and optionally a Type_17 following.

                                Message 5 shows this:

                                Code:

                                — Begin HRL Segment Types_02_17 —  
                                — Begin FRL Segment Types_02_17.Type_02(0) —
                                — Begin FRL Segment Types_02_17.Type_02(1) —

                                — Begin FRL Segment Types_02_17.Type_02(4) —


                                Here you have only one Type_02_17 with many Type_02 iterating within it.

                                Therefore you can also have a combination of this: several iterations of Type_02_17 and within each iteration an iteration of many Type_02.

                                I think I can conclude though that each occurrence of a Type_02 (optionally followed by a Type_07) should result in a PID-segment, correct?

                                In that case, in your last xlate you need to place the iteration of Type_17 AND incrementing %g9 inside the iteration of Type_02. Practically: select all lines of your xlate from the position in slide 5 up until the position in slide 6 and then move this selection ‘up’ in the translation 2 steps. These lines should now be inside the iteration of Type_02, so after each Type_02 a PID segment is created.

                                Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

                              • #78381
                                Johnny Anderson
                                Participant

                                  Robert, that fixed it.  Thank you very much.

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