Splitting OBX Base on Font

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Splitting OBX Base on Font

  • Creator
    Topic
  • #47736
    Scott Frye
    Participant

    My OBX looks like this…

    OBX|1|ST|5480^GC Best Motor|1|Obycm6Lclzp5FlxwdwFlxabnExtsonNorsp1|

    Is there a way in an Xlate for me to split it like this…

    OBX|1|ST|5480^GC Best Motor|1|Obycm6

    OBX|2|ST|5480^GC Best Motor|1|Lclzp5

    OBX|3|ST|5480^GC Best Motor|1|Flxwdw

    OBX|4|ST|5480^GC Best Motor|1|Flxabn

    OBX|5|ST|5480^GC Best Motor|1|Extson

    OBX|6|ST|5480^GC Best Motor|1|Norsp1

    I can do the creating extra OBX’s, I just don’t know if there is a way to split this based on the UPPER Case character.

    Thanks

    Scott

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

      OK I have not tested this thoroughly but here is a concept:

      You are going to need Tcl for this.

      1. COPY the ib OBX-5 field to the ob OBX-5 field using a Tcl proc to regsub all Upper Case to Upper Case plus whatever your component separator (typically ~) is. Such that AbcdefGhijk might become Abcdef~Ghijk.

      2. Iterate over the ob (OUTBOUND) OBX-5 you just created at the field level using the ob OBX-5 as a basis for the iteration. Use something like %f1 for the counter

      3. COPY the ob OBX-5 field with a properly placed %f1 to the ob OBX-5 where the %f1 becomes your segment or group counter on the destination.

      Last you might need to accomodate for the first OBX segment’s OBX-5 having the entire string.

      Just an idea and if you want to pursue it further, email me.

      Maybe someone can propose a regsub pattern which would work – I have not thought that through.

      Jim Kosloskey

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

    • #56573
      Scott Frye
      Participant

      Your theory looks solid.

    • #56574
      Anonymous
      Participant

      set OBX5 [lindex $fieldList 5]

      set wordList [regexp -inline -all — {[A-Z][a-z]+} $OBX5]

      Once you get your OBX5, you can split it using the Regex above.

      Then you can loop through the words…

      foreach value $wordList {

      #do something

      }

      Hari Krishna

      Columbus Regional Hospital

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

Forum Statistics

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