Iterate 2 different segments to a 3rd

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Iterate 2 different segments to a 3rd

  • Creator
    Topic
  • #49814
    Gena Gill
    Participant

    I’m trying to set up a new interface that sends Orders to a dietary system.  The dietary system requires ODS and ODT segments, but our order system doesn’t send them.

    Here’s the problem.  I’ve got everything working except I need to send data from a couple of fields in the OBR segment to a new ODS segment.  At the same time, I have an Iteration set up where for each OBX segment, various fields are copied into ODS segments.

    The iteration works, but I’m stuck on how to get the information from the OBR segment into a new ODS segment.  So, if I have 5 OBX and 1 OBR, I should have 6 ODS segments.  No matter what I’ve tried, either nothing happens with the OBR to ODS translation, or worse, the info in the OBR segment overwrites the first ODS segment that I created from the OBX iteration.

    I need to set up a translation where OBR copies to ODS iteration 1 and OBX iteration 1 copies to ODS iteration 2, OBX iteration 2 to ODS iteration 3, and so on.

    Any ideas?

Viewing 2 reply threads
  • Author
    Replies
    • #63688
      Jim Kosloskey
      Participant

      Gena,

      You are going to need to maintain and use your own iteration counters for the outbound (ODS) fields.

      This may take more than a simple exchange of postings.

      email me if you want to discuss off line.

      Thanks,

      Jim Kosloskey

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

    • #63689
      Robert Kersemakers
      Participant

      I agree with Jim. I’ll try to explain in short.

      First initialize a segment or group counter (depending on what is needed; for the example I assume a segment counter). I always take %s9 for counters that I manipulate myself.

      Code:

      COPY =0 -> $%s9


      Then process the OBR segment and use %s9 as your outbound segment counter. After processing the OBR, you need to increase %s9.

      Code:

      COPY OBR(…) -> ODS(%s9)
      MATH: ADD $%s9 =1 -> $%s9


      After that you iterate through the OBXs and after each iteration (or each new ODS segment) you also increase %s9:

      Code:

      ITERATE type: segment; basis: OBX; Variable: %s1
         COPY OBX(%s1)(…) -> ODS(%s9)
         MATH: ADD $%s9 =1 -> $%s9

      Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

    • #63690
      Gena Gill
      Participant

      Thanks Jim and Robert.

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

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,435
Topic Tags
286
Empty Topic Tags
10