Iterate on PID.3, Compare to MRG

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Iterate on PID.3, Compare to MRG

  • Creator
    Topic
  • #54540
    Josh Stanek
    Participant

      I have been asked to do a comparison between an MRG segment and the PID.3 segment.  The scenario is as follows:

      – Look at the MRN in the MRG.1 field.

      – Loop through the PID.3 field and compare each MRN in the PID.3 to the value in the MRG.

      – If the MRN in the PID.3 field is the same as the MRG.1 field, remove that MRN from the PID.3 list–keeping all other MRNs

      Input example:

      PID|1|MPI_Num^^^NE|1234^^^FacID^MR~23456^^^FacID^MR|…rest of PID Segment

      MRG|1234^^^FacID^MR|||MPI_Num^^^NE

      Expected Output

      Input example:

      PID|1|MPI_Num^^^NE|23456^^^FacID^MR|…rest of PID Segment

      MRG|1234^^^FacID^MR|||MPI_Num^^^NE

      **The output is the same with the exception that the PID.3 value of 1234 is removed because that value is in the MRG segment.

      Thanks for the help!!

      Josh

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

          Do you want to do this in an Xlate?

          If yes then I would:

          Initialize your counter (COPY =0 to $%f99 for example)

          ITERATE over the PID-3.

          Check to see if PID-3.1 is equal to MRG-1.1

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

        • #81909
          Josh Stanek
          Participant

            I would do it either way—however, I think a pre-proc tcl would make more sense.

          • #81910
            Jim Kosloskey
            Participant

              If you are already using an Xlate then I would do it there – up to you.

              Of course what I described assumes no BULKCOPY in play. If theere is BULKCOPY, a few more steps.

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

            • #81911
              Josh Stanek
              Participant

                I do have an existing translation and I’m using Bulkcopy.  I can change that to do a Pathcopy for each segment if that is easier.

                Thanks for the help!

              • #81912
                Jim Kosloskey
                Participant

                  For BULKCOPY

                  Before you do the MRG/PID logic, ITERATE through the PID-3 COPYing (can use PATHCOPY here) @null to PID-3.

                  This will remove the repetitions BULKCOPY put there before you rebuild the PID-3 so you don’t have any refuse left over from BULKCOPY.

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

                • #81913
                  Josh Stanek
                  Participant

                    That helps a lot!  I think I’m very close, but what I’m getting now is a blank repetition in that field.  

                    Input (Assume 2nd MRN is in the MRG segment):

                    PID|1|MPI_Num^^^NE|1234^^^FacID^MR~23456^^^FacID^MR~78585^^^FacID^MR|…rest of PID Segment

                    Output:

                    PID|1|MPI_Num^^^NE|1234^^^FacID^MR~~78585^^^FacID^MR|…rest of PID Segment

                    I have deactivated the IF statement and confirmed that the Pathcopy is nulling out the PID.3 field completely.  Any ideas?

                    Thanks!!

                  • #81914
                    Josh Stanek
                    Participant

                      I think the issue here is if the values are different and I copy them, I may be using the wrong variable in my copy.  Would that be why there is a blank repetition?

                      Should my copy be using the ITERATION variable or the counter variable?

                      COPY

                      0(0).PID(0).#3(%f4) —>   0(0).PID(0).#3(%f4)

                    • #81915
                      Jim Kosloskey
                      Participant

                        For the outbound you need your own manageed counter (somethiing llike %f99).

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

                      • #81916
                        Jim Kosloskey
                        Participant

                          For the outbound you need your own manageed counter (somethiing llike %f99).

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

                        • #81917
                          Josh Stanek
                          Participant

                            I’m still getting a blank repetition field in my result.  My copy looks like this if the value is different than MRG.1

                            COPY

                            0(0).PID(0).#3(%f4) —>   0(0).PID(0).#3(%f99)

                            Output:

                            PID|1|MPI_Num^^^NE|1234^^^FacID^MR~~78585^^^FacID^MR|…rest of PID Segment

                          • #81918
                            Josh Stanek
                            Participant

                              This is now working.  I was using Activate/Deactivate and I don’t think it was really clearing my code properly.  I removed the code and it’s acting appropriately now.

                              Thanks so much Jim!

                            • #81919
                              Peter Heggie
                              Participant

                                Sometimes your translator editing is not saved to the server, even though the GUI’s save button is clearly clicked. This occurs sporadically, but only when you have made multiple changes and saves to a translator.

                                Our whole team has encountered this at various times across multiple versions of Cloverleaf (5.8, 5.8.4, 6.0). We run on AIX. It happens once or twice a month. It is very frustrating if you don’t recognize the situation. But you notice it when you put debugging echo statements in the code window and you don’t get the echos out at runtime.

                                The solution is to close and re-open the translator. As Jerry Pournelle used to say – “Save early and often”.

                                Peter

                                Peter Heggie

                              • #81920
                                Robert Kersemakers
                                Participant

                                  @Peter and very off topic.

                                  I recognize this behaviour. We had this for a long time on CL5.0 or 5.2 (not sure) and it generally happened when an iteration was copied or something inside an iteration was copied. You got some very weird situations then and indeed: closing and reopening the Xlate would resolve the problem.

                                  I haven’t seen this behaviour lately (we have been on 5.5 for a long time and recently upgraded to 6.0.2), but will make a note of it. Pure evil.

                                  Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

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