The "Proper" TrxID – Handling Sub-Field Delimiters

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf The "Proper" TrxID – Handling Sub-Field Delimiters

  • Creator
    Topic
  • #50389
    Terry Kellum
    Participant

    I’ve run into this before, and just have never drug it to ground.

    HL7, CL 5.2, TrxID

    Say I have an ORM^O01.  That has a sub-field delimiter (sfd) smack in the middle of the mix.  The sfd is defined in MSH[2.0], and legally can be many characters.

    If you set TrxID determination to HL7, you use a syntax in your route like “ORM_O01”.  My assumption is that Cloverleaf is helpfully keeping me from cutting my fingers on that pesky sfd.

    In developing my own TrxID procs, I’ve tried several methods to get the same effective output, but I’ve never been able to get there.

    I’ve tried:  (sfd is in $sfd)

    Code:

    regsub -all {$sfd} $trxId {_} trxId

     (with escaping and quoting)

    Code:

    string map {$sfd _} $trxId

    (with escaping and quoting)

    Every time before, after failing miserably and considering the option of Hara-kiri, I’ve always just put in the ORM^O01 to my route, knowing that one day running with scissors will be my undoing.

    Can anybody give me a clue as to how this SHOULD be done?

    Thanks!!!!

Viewing 3 reply threads
  • Author
    Replies
    • #65930
      Dinakar Desai
      Participant

      Try following: You need to escape ^ character.

      set a “ORU^O01”

      ORU^O01

      tcl>regsub — {^} $a {_} b

      1

      tcl>echo $b

      ORU_O01

    • #65931
      Tom Rioux
      Participant

      Why not keep it simple and do as Charlie always preaches…just use “string map”

    • #65932
      Terry Kellum
      Participant

      It looks like my version has trouble expanding in Curly Brackets or some such.  Here’s what my shell shows:

      Code:

      bash-2.05$ hcitcl
      hcitcl>set sfd “^”
      hcitcl>echo $sfd
      ^
      hcitcl>string length $sfd
      1
      hcitcl>set trxid ORM^O01
      hcitcl>echo $trxid
      ORM^O01
      hcitcl>string map {$sfd _} $trxid
      ORM^O01
      hcitcl>string map {^ _} $trxid
      ORM_O01
      hcitcl>exit
      bash-2.05$ tclsh
      % set sfd “^”
      ^
      % set trxid ORM^O01
      ORM^O01
      % string map {$sfd _} $trxid
      ORM^O01
      % string map {^ _} $trxid
      ORM_O01
      %

      However, in playing around I found this:

      Code:

      % set maps [list $sfd _]
      ^ _
      % string map $maps $trxid
      ORM_O01
      %

      So somehow it looks like a variable expansion issue….

      I’ll give it a try in the engine tomorrow.

    • #65933
      Tom Rioux
      Participant

      My bad….instead of the {} use “” instead…

      hcitcl>set trxid ADT^A01

      ADT^A01

      hcitcl>string map “$sfd _” $trxid

      ADT_A01

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

Forum Statistics

Registered Users
5,125
Forums
28
Topics
9,294
Replies
34,439
Topic Tags
287
Empty Topic Tags
10