Announcement

Collapse
No announcement yet.

Making an Entire Message Upper Case

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Making an Entire Message Upper Case

    Is there a way to tell the whole message to change to Upper Case? I have tried to put

    var newMessage = message.toUpperCase();

    in the preprocessor, but that doesn't seem to work.

    Any suggestions??


    Thanks!!!!

  • #2
    Did you actually return that?

    Code:
    return newMessage;
    Also, that will only work if the raw message starts with a word... if you're trying to do that with an HL7 v2.x message it won't work because that starts with "MSH|^~\&".

    If you want to convert each individual field/component to uppercase, then you should do that in a transformer. You can do something similar to this: http://www.mirthcorp.com/community/f...0642#post30642

    Instead of replacing, you can just call toUpperCase(). Or if you want to capitalize every single word (not just the first), use this: WordUtils.capitalizeFully(str)
    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

    Nicholas Rupley
    Work: 949-237-6069
    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


    - How do I foo?
    - You just bar.

    Comment


    • #3
      String?

      Is message a string or an instance of a class called message?

      the method will only work on a string if its a class all you'll get is MESSAGE - I think !??!? or in most cases with something that fails badly in javascript it kind of pretends that there was no problem!


      Originally posted by atibbits View Post
      Is there a way to tell the whole message to change to Upper Case? I have tried to put

      var newMessage = message.toUpperCase();

      in the preprocessor, but that doesn't seem to work.

      Any suggestions??


      Thanks!!!!

      Comment


      • #4
        In the preprocessor script, "message" is a JavaScript String.
        Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

        Nicholas Rupley
        Work: 949-237-6069
        Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


        - How do I foo?
        - You just bar.

        Comment


        • #5
          I also need to ensure the entire message is upper case, however capitalizing each word is not the same as making each word upper case.
          When I tried to call toUpperCase() on msg, I found that the message became undefined because the tags were no longer recognised following conversion to upper case.
          The same problem happened when I called toUpperCase() on a single segment.
          Is there a method I can use that will leave the tags and only capitalize the content?

          Comment


          • #6
            you need to do it in the pre-processing script where the message is in a Javascript string format, just what Nick has mentioned in earlier post.
            HL7v2.7 Certified Control Specialist!

            Comment

            Working...
            X