Operation on each field

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Operation on each field

  • Creator
    Topic
  • #55012
    Tahir Shaikh
    Participant

      Hi,

      Is there any way to perform some operation on each field of HL7 message?

      e.g. I need first letter of each fields to be capitalized.

      One way I think is to create a tcl – Parse HL7 message- separate each segment in fields and perform the operation.

      Is there any other way?

      Thanks,

      Tahir

    Viewing 4 reply threads
    • Author
      Replies
      • #83791
        Jim Kosloskey
        Participant

          Really – every field in the HL/7 message? That is strange.

          The method you describe should work and there may be different Tcl commands to use.

          As to another way – given I am sceptical that every field needs this done – is to have an xltp proc which just does the capitalization and reference only the fields that need that in an Xlate (invoking the capitalization code). Thus using the Xlate to parse the message, etc.

          I would write the xltp proc and save it, then reference the proc wherever needed in the Xlate.

          Just another way…

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

        • #83792
          David Barr
          Participant

            You wouldn’t have to parse the message. You could do this in TCL with a regsub (regular expression search and replace). Just make an expression that matches the field and segment delimiter and replaces the following character with a capital letter. I have no idea why you would want to do this.

          • #83793

            Tahir, perhaps you could better explain what you are trying to do?

            The xlate allows you to make field-based changes. It parses the messages in to fields and then you can make changes on the fields.

            -- Max Drown (Infor)

          • #83794
            Tahir Shaikh
            Participant

              In my case,Customer sends the HL7 message with all the fields in Uppercase and they want these fields to be displayed as Mixed case.

              e.g. Customer sends ‘SMITH’ as first name and wants this to be displayed as ‘Smith’. And this is for all the fields.

              Thanks,

              Tahir

            • #83795
              Craig Weldy
              Participant

                Tahir,

                    We have found that you probably don’t want to change every field in an HL7 message to Mixed case, just those in the Name/address/notes type fields.  If you have a department code “ECC” and it turns into “Ecc” it may not be received well by the receiving system.  

                    I run an Xlate shop so in my xlates I put a .xltp script on any field that I want to convert to mixed (code is included below).

                    It adds a little work up front, but I find it is much easier to include or exclude the script as you find fields that you want to change to mixed and those that you don’t want modified.

                FILE:  tomixedcast_xltp.tcl

                proc tomixedcase {} {

                   upvar xlateId       xlateId        

                     xlateInList   xlateInList    

                     xlateInTypes  xlateInTypes    

                     xlateInVals   xlateInVals    

                     xlateOutList  xlateOutList    

                     xlateOutTypes xlateOutTypes    

                     xlateOutVals  xlateOutVals

                set inp [lindex $xlateInVals 0]

                if { $inp > ” ” } {

                  foreach el $inp {

                     set el [string totitle $el]

                     lappend outList $el

                  }

                  set xlateOutVals

                  ]

                  } else {

                    set xlateOutVals

                    }

                    }

                    Hope it helps!!

                  Craig Weldy
                  Senior Interface Analyst
                  Beacon Health System
                  South Bend, In, 46615

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