Iteration from OBX|2| to NTE|1|…

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Iteration from OBX|2| to NTE|1|…

  • Creator
    Topic
  • #50894
    Gena Gill
    Participant

    I need to set up a translation where I need to keep OBX|1| exactly like it is, but for each iteration of OBX starting with the 2nd iteration, I need to copy each iteration into an iteration of NTE starting with iteration 1.  Like this:

    OBX|1| –> OBX|1|

    OBX|2| –> NTE|1|

    OBX|3| –> NTE|2|

    In the end, there should only be 1 iteration of OBX in the message, and then multiple iterations of the NTE segment that follows.

    Any ideas?

Viewing 1 reply thread
  • Author
    Replies
    • #67938
      Mike Grieger
      Participant

      Question – do you have to be concerned with any NTEs under your OBXs?  ie – OBX-2 has NTEs under it, so you need to make OBX-2 into NTE-1, but then keep the existing NTEs as well?

      If not, it should be fairly easy to accomplish.  One method you could use is as follow: establish an iteration of the group/segment (whatever you are iterating on). In that iterate, do an IF, and evaluate your iteration variable to see if it is zero (first iteration).  (ex. IF $%s1 eq =0) – note the $ in front of variable.  under that IF, copy your fields to their OBX output.  under ELSE, copy your fields to NTE.  you can set up another variable to use, and have it equal to the math expression of your iteration value minus 1, so that your NTE copy basis starts with zero.  (ie, on OBX-2, the iteration variable is at 1 since it is zero based, so you want to subtract 1 from it so the NTE basis is one less than the current OBX you are on).  And if you want to use NTE-2 numbering, that should equal your current OBX iteration variable also.

      Now, if you also have NTEs that can be present under your OBXs, that complicates things a bit.  Still doable, but more complex.  I won’t get into that at this point.

    • #67939
      Gena Gill
      Participant

      Thanks!  There will be no NTE’s in the original message.  I had a complete mental block and didn’t even think of using IF and ELSE to take care of this.

Viewing 1 reply thread
  • 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