web stats
JS code - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 10-29-2018, 09:59 AM
cabanjose367 cabanjose367 is offline
Mirth Newb
 
Join Date: Sep 2018
Posts: 9
cabanjose367 is on a distinguished road
Default JS code

I'm trying to remove the first two digits and the last two digits on an appointment ID that comes across in an HL7 message. I tried to use the below example

msg['SCH']['SCH.1']['SCH.1.1'].toString().replace(/^0+/g,' ');

I found this on line but I can not find where it was. Sometimes it works and sometimes it does not. Does anyone have an idea what I can use to be able to remove the two starting numbers and the last two numbers of any ID using Javascript in one of my transformer steps.
Thank You.
I am currently using Mirth 3.6
Reply With Quote
  #2  
Old 11-14-2018, 05:53 AM
bbushelle bbushelle is offline
Mirth Newb
 
Join Date: Jul 2015
Location: Carmel, IN
Posts: 7
bbushelle is on a distinguished road
Default

Code:
var id = msg['SCH']['SCH.1']['SCH.1.1'].toString();
    id = id.substring(2,id.length-2);
This will remove the first 2 and last 2 characters of the ID
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 03:38 AM.


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