web stats
Odd Javascript Reader issue - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 12-27-2018, 09:05 AM
interoneca interoneca is offline
What's HL7?
 
Join Date: Dec 2018
Posts: 5
interoneca is on a distinguished road
Default Odd Javascript Reader issue

Hello, I am seeing an odd error when building an HL7 message. I get a study datetime value from our database, covert it and assign it to a local var. When I assign the variable to 3 different sequences the value shown for the first sequence shows the last zero cutoff where the rest don't. Does anyone know why this happens? I have also seen this behavior with other sequences.

Javascript code snippet
// study date time
var studydatetime = result.getString('order_scheduledstarttime');
var date = DateUtil.getDate('yyyy-MM-dd HH:mm:ss.sss', studydatetime);
studydatetime = DateUtil.formatDate('yyyyMMddHHMMss', date);

msg.OBR['OBR.6'] = studydatetime;
msg.OBR['OBR.7'] = studydatetime;
msg.OBR['OBR.8'] = studydatetime;

HL7 Messsage output
...|2018121311120|20181213111200|20181213111200|.. .
Reply With Quote
  #2  
Old 12-27-2018, 12:48 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,176
agermano is on a distinguished road
Default

Are you able to post your entire channel? There's no reason why your example by itself would be dropping the last character of a string.

What gets logged from the following statement if placed immediately after you set the values in your example?

Code:
logger.info(SerializerFactory.getSerializer('HL7V2').fromXML(msg.OBR));
Reply With Quote
  #3  
Old 12-27-2018, 08:04 PM
siddharth siddharth is offline
Mirth Guru
 
Join Date: Feb 2013
Posts: 841
siddharth is on a distinguished road
Default

I think the problem is with this line

studydatetime = DateUtil.formatDate('yyyyMMddHHMMss', date);

yyyyMMddHHMMss is not a valid format but yyyyMMddHHmmss is a valid one.
__________________
HL7v2.7 Certified Control Specialist!
Reply With Quote
  #4  
Old 12-28-2018, 07:23 AM
interoneca interoneca is offline
What's HL7?
 
Join Date: Dec 2018
Posts: 5
interoneca is on a distinguished road
Default

Thanks for all the replies. Here I have changed the code to further illustrate the issue. Instead of the actually study date/time I assign '1234567890" to the variable then assign the variable to three different sequences.

// study date time
studydatetime = '1234567890';
logger.info(SerializerFactory.getSerializer('HL7V2 ').fromXML(msg.OBR));
msg.OBR['OBR.6'] = studydatetime;
msg.OBR['OBR.7'] = studydatetime;
msg.OBR['OBR.8'] = studydatetime;
logger.info(SerializerFactory.getSerializer('HL7V2 ').fromXML(msg.OBR));

Here's the message output and notice that only OBR.6 cuts off the string.

OBR|1|1000008|1000008|77067^Bilateral Screening Mammogram^||123456789|1234567890|1234567890||||||| |||^^^1234567890^^Routine^Screening

Here is the logger output:
[2018-12-28 08:11:50,637] INFO (js-connector:?): OBR|1|1000008|1000008|77067^Bilateral Screening Mammogram^||123456789|1234567890|1234567890
[2018-12-28 08:11:50,635] INFO (js-connector:?): OBR|1|1000008|1000008|77067^Bilateral Screening Mammogram

BTW I am running Mirth Connect Server 3.5.2.

Last edited by interoneca; 12-28-2018 at 07:26 AM.
Reply With Quote
  #5  
Old 12-31-2018, 07:29 AM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,176
agermano is on a distinguished road
Default

Try this:

Code:
// study date time
studydatetime = '1234567890';
logger.info(SerializerFactory.getSerializer('HL7V2').fromXML(msg.OBR));
msg.OBR['OBR.6']['OBR.6.1'] = studydatetime;
msg.OBR['OBR.7']['OBR.7.1'] = studydatetime;
msg.OBR['OBR.8']['OBR.8.1'] = studydatetime;
logger.info(SerializerFactory.getSerializer('HL7V2').fromXML(msg.OBR));
Reply With Quote
  #6  
Old 01-01-2019, 09:14 AM
interoneca interoneca is offline
What's HL7?
 
Join Date: Dec 2018
Posts: 5
interoneca is on a distinguished road
Default

Quote:
Originally Posted by agermano View Post
Try this:

Code:
// study date time
studydatetime = '1234567890';
logger.info(SerializerFactory.getSerializer('HL7V2').fromXML(msg.OBR));
msg.OBR['OBR.6']['OBR.6.1'] = studydatetime;
msg.OBR['OBR.7']['OBR.7.1'] = studydatetime;
msg.OBR['OBR.8']['OBR.8.1'] = studydatetime;
logger.info(SerializerFactory.getSerializer('HL7V2').fromXML(msg.OBR));
Yes this worked. Is this the proper way to reference a sequence?

Thank you
Reply With Quote
  #7  
Old 01-02-2019, 11:46 AM
ISLITM ISLITM is offline
Mirth Newb
 
Join Date: Jun 2016
Posts: 6
ISLITM is on a distinguished road
Default

There are a few ways to reference a segment but this is probably the easiest/safest:
msg['OBR']['OBR.6']['OBR.6.1'] = studydatetime;
msg['OBR']['OBR.6']['OBR.7.1'] = studydatetime;
msg['OBR']['OBR.6']['OBR.8.1'] = studydatetime;
If you just want the value in the segment then add a ".toString();", like this:
msg['OBR']['OBR.6']['OBR.6.1'].toString()
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:49 PM.


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