web stats
Making an Entire Message Upper Case - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 03-24-2016, 11:08 AM
atibbits atibbits is offline
Mirth Guru
 
Join Date: May 2012
Location: Salina, KS
Posts: 381
atibbits is on a distinguished road
Thumbs down 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!!!!
Reply With Quote
  #2  
Old 03-24-2016, 11:19 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

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.
Reply With Quote
  #3  
Old 03-29-2016, 05:58 AM
sanderson sanderson is offline
OBX.1 Kenobi
 
Join Date: Dec 2015
Posts: 45
sanderson is on a distinguished road
Default 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!


Quote:
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!!!!
Reply With Quote
  #4  
Old 03-29-2016, 07:02 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

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.
Reply With Quote
  #5  
Old 08-30-2016, 03:26 AM
vnetherw vnetherw is offline
What's HL7?
 
Join Date: Jul 2016
Location: Wirral, UK
Posts: 3
vnetherw is on a distinguished road
Default

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?
Reply With Quote
  #6  
Old 08-30-2016, 06:28 AM
siddharth siddharth is offline
Mirth Guru
 
Join Date: Feb 2013
Posts: 841
siddharth is on a distinguished road
Default

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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 02:33 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation