interate a segment and a field

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf interate a segment and a field

  • Creator
    Topic
  • #50298
    Mason Miller
    Participant

      I am trying to interate across repeating ROL segments to say if ROL.3 =PP then inside that interate say interate on field ROL.4 if ROL.4.08 =89 then copy ROL.4.0 to PD1.4.  I can not get the second interation to work is this even possible?

      this is what I have

      { { OP ITERATE }

         { BASIS 0(0).ROL }

         { VAR %s1 }

         { TYPE segment }

         { BODY {

             { { OP IF }

                 { ERR 0 }

                 { COND { 0(0).ROL(%s1).#3  eq =PP} }

                 { THENBODY {

                     { { OP ITERATE }

                         { BASIS 0(0).ROL(%s1).#4 }

                         { VAR %f5 }

                         { TYPE field }

                         { BODY {

                             { { OP IF }

                                 { ERR 0 }

                                 { COND { 0(0).ROL(%s1).#4(%f5).[8]  eq =89} }

                                 { THENBODY {

                                     { { OP COPY }

                                         { ERR 0 }

                                         { IN {{0(0).ROL(%s1).#4(%f5).[0]}} }

                                         { OUT {{0(0).PD1.#4(0).[0]}} }

                                     }

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

          Mason,

          What you want to do is possible.

          First make sure your basis is correct for both iterations.

          Then make sure your IF actions work. It can be tricky to get the IF to reference as literal – some folks place the literal value in a temp variable and then reference the temp variable in the IF Action.

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

        • #65529
          Tom Rioux
          Participant

            I’ve mimiced your code on my test system and it seems to work okay.  Maybe some more information would be helpful.  You say it isn’t working, can you give us examples of any errors you are seeing or maybe some examples of what the inbound data looks like and what you are expecting?

            Thanks…Tom

          • #65530
            Mason Miller
            Participant

              This is the inbound their can be multiple ROL segments without PP

              ROL||UC|PP|39^Brownfield^Ron^^^^DO^^900000^L^^^DN^^^^20060316~233023994^^^^^^^^900001^^^^HPSS~001131^^^^^^^^89^

              ^^^PRN~01045^^^^^^^^190^^^^LN~BB0457639^^^^^^^^189^^^^DEA~9111115^^^^^^^^244^^^^PRN~1730125766^^^^^^^^459^^^^NPI~

              C69085^^^^^^^^900002^^^^UPIN|200809181448||||1|||^ORN^FX^^0^304^4295627~^BPN^BP^^0^304^4507344~^WPN^PH^^0^304^4295594

              This is what I am trying to get outbound

              PD1||||001131^Brownfield^Ron

            • #65531
              Tom Rioux
              Participant

                From just a quick glance, it appears that what you are doing should be working.   Is there anything else below the code that you are showing that could possibly be affecting the outcome of these fields?  Is there a pathcopy of the PD1 below these iterates? What are you currently getting in your PD1 segment?

                Tom

              • #65532
                Robert Kersemakers
                Participant

                  What does it show when you put in this tcl-snippet

                  Code:

                  echo “Value: <$xlateInVals>“

                  into the COPY statement? Does the value show up when running the translation through the testing-tool?

                  If not: try putting this command

                  Code:

                  COPY @null -> @null
                   echo “Works fine!!”

                  somewhere in your iteration. It will show you which iteration works and which not. Move this statement up/down in the translation, save it and then put it through the testingtool again.

                  Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

                • #65533
                  Gary Atkinson
                  Participant

                    xlateInVals is a global variable that stores the Inbound list.  So, if your inbound field contains “gary” then echo $xlateInVals would return “gary”.  I was taught to treate this variable as a list.  

                    I believe @null with return an empty string, but maybe it works differently in an iteration.

                  • #65534
                    Robert Milfajt
                    Participant

                      I wonder if you change the “eq” string equals to “==” numeric equals in the IF statement, if this would solve your problem.

                      Hope this helps,

                      Robert Milfajt
                      Northwestern Medicine
                      Chicago, IL

                    • #65535
                      Gary Atkinson
                      Participant

                        Ah I missed that one!  I bet that will do it  ðŸ˜‰

                      • #65536
                        Mason Miller
                        Participant

                          The issue is in the first iteration on the ROL segment. here is my message definition is this looking at all ROL segments?

                          MSH

                          EVN

                          PID

                          [ PD1 ]

                          [{ ROL } ]

                          [ MRG ]

                          [{ NK1 } ]

                          [{ AL1 } ]

                          [{ROL } ]

                          PV1

                          [ PV2 ]

                          [{ ROL } ]

                          [{ OBX } ]

                          [{ AL1 } ]

                          [{ DG1 } ]

                          [{ DRG } ]

                          [{ PR1 } ]

                          [{ GT1 } ]

                          [

                            {

                               [ IN1 ]

                               [ IN2 ]

                               [ IN3 ]

                               [ ZIN ]

                            }

                          ]

                          [ ACC ]

                          [ UB1 ]

                          [ UB2 ]

                          [{ ZU1 } ]

                          [{ ZHL } ]

                          [ PDA ]

                          [ ZPV ]

                        • #65537
                          John Mercogliano
                          Participant

                            Hi Mason,

                             I believe your HL7 definition is your problem.  You shouldn’t have the same segment defined multiple times in the same grouping.  In this case all the ROL’s are part of the 0(0) group.  So, the translator is getting confused as to which ROL segment it should read.

                            My guess is that each ROL should be grouped with the previous segment so for example the PD1 segment should look something like:

                            Code:


                            [
                                PD1
                               [{ROL}]
                            ]

                            Note that doing this will change the groups that any segment that follows belongs to so you potentially have to update your translations if you do anything with later segments.

                            Hope this helps,

                            John Mercogliano
                            Sentara Healthcare
                            Hampton Roads, VA

                          • #65538
                            Mason Miller
                            Participant

                              That was the conculsion I came to and I put all ROL segments in a seperate groups and it looks like it is working. HL7 2.4 has two ROL segmetns in the same group.

                              thanks

                            • #65539
                              John Mercogliano
                              Participant

                                We have been lucky, none of our systems send an ROL segment.  It looks like Cloverleaf has 2.4 and above defined exactly as the standard wants, just too bad you can’t use it that way in Cloverleaf.  It sounds that Cloverleaf needs to rework how they implement the standards so it works properly with there tools.  Sounds like I need to write up a suggestions 😯

                                John Mercogliano
                                Sentara Healthcare
                                Hampton Roads, VA

                              • #65540
                                Russ Ross
                                Participant

                                  One place to put a corrected HL7 2.4 variant in the mean time could be in the master site assuming you are using QDX 5.6.

                                  We have been doing this sort of thing before the master site became a part of cloverleaf and used symbolic links to make them visible to any site that wanted to use them.

                                  If you do put them in the master site then you can use them to configure your Xlates across all sites, but you will only modify your global HL7 variants when you are in the master site.

                                  Now that I think of it, doing this for any of the $HCIROOT/formats/hl7/… that get used would assure one that no future upgrade could adversly impact this aspect of an existing integration by changing the HL7 pathing thus potentially breaking xlates.

                                  Russ Ross
                                  RussRoss318@gmail.com

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