Creating new segments from within xlate

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Creating new segments from within xlate

  • Creator
    Topic
  • #55551
    Mike Keys
    Participant

    I can do this fairy easy in Tcl, but wanted to know if there is an xlate equivalent method.

    Example: We have a NTE segment with our document feed that contains signature block information. NTE.3 is a long string with .br line breaks.

    What I’ve done is string mapped that NTE.3 and replaced the .br with the ~.

    What I’d like to do in the xlate is write some Tcl code that splits NTE.3 on the “~” and then create a new NTE in the output for each new line/NTE.

    I’ve read some blurbs about use the ‘$’ in front of the iterate variable, but am unsure how to actually create new segment from within the xlate.

    If this is too convoluted, i’ll just do it with Tcl as this is much easier.

Viewing 1 reply thread
  • Author
    Replies
    • #85720
      Jim Kosloskey
      Participant

      Mike,

      Is the string mapping you speak of done prior to the Xlate or inside the Xlate?

      You will need to have your own ITERATE counter/variable.Since this is a field repetition then something like %s99 (I like to start my own counters at 99 but you can use any unused value). This counter will be used to indicate which NTE repetition outbound is being built.

      At the beginning of your Xlate COPY =0 to $%s99 (note the $).

      If prior to the Xlate, then

       – make sure the NTE-3 is defined as repeating in the IB Variant.

       – ITERATE over the NTE-3 (let’s say the ITERATE counter here is %f1).

       – inside the ITERATE:

         – COPY all of the NTE stuff you need using %f1 in the IB address path and %s99 in the OB address path (at the segment level).

          – MATH ADD =1 $%s99 –> $%s99  (This increments the outbound counter for the next segment).

      If inside the Xlate then you will need to split the NTE-3 on .br creating a list (if 6.1.0 or later you can use the STRING Action with the appropriate function).

      Then you will need some tcl to pop each element of the list. This would be inside a LIST ITERATE which needs to be controlled. Most of the above stuff for building the NTE segments will be the same except the ITERATE Counter will be %l1 but the OB counter will still be %s99 but the source will be the list created by the split.

      If you want more detail or assistance, feel free to email me.

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

    • #85721
      Mike Keys
      Participant

      Jim,

      Thanks! With your help, this is now working as expected!

      Mike

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