web stats
Moving MSH-7 DateTime to IN1-29 Policy Date - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 01-15-2020, 05:35 PM
rwerner2 rwerner2 is offline
Mirth Newb
 
Join Date: Feb 2012
Location: Toledo
Posts: 20
rwerner2 is on a distinguished road
Unhappy Moving MSH-7 DateTime to IN1-29 Policy Date

Hi

I'm trying to put the value of MSH-7 (Datetime) stamp into the IN1-29 Policy date field. We usually have a paired insurance segments IN1, IN2, IN1, IN2.
I get all the IN1 fields to populate correctly with the exception of the date move to the IN1-29 field .

I'm hoping someone can look at my mess (of logic) below and point me in right direction as to what I'm doing wrong. I appreciate any help provided.



* IN1, IN2 and IN3 Segments
*/
var inputIN2Index = 0;
var mshdate;

for each (seg in msg.children()) {
/*
* IN1 Segment
*/
if (seg.name().toString() == "IN1") {
tmp.appendChild(seg);
// seg['IN1']['IN1.29']['IN1.29.1'] = msg['MSH']['MSH.7']['MSH7.1'].toString();
// tmp['IN1']['IN1.29']['IN1.29.1'] = "ROBW";
// RDW 09/09/19 - Change to put date/time stamp into the IN1.29.1 field per Melodie R. Request.
//TEMP COMMENT tmp['IN1'][inputIN2Index]['IN1.29']['IN1.29.1'] = msg['MSH']['MSH.7'];

var today = DateUtil.getDate('yyyyMMdd',DateUtil.formatDate('y yyyMMdd',new java.util.Date())).getTime();
var messageDateTime = DateUtil.getDate('yyyyMMddHHmm',msg['MSH']['MSH.7']['MSH.7.1'].toString()).getTime();

seg['IN1']['IN1.29']['IN1.29.1'] = messageDateTime; - All fields below this line work fine. Its only the IN1.29 field I can not get to populate.
seg['IN1']['IN1.30']['IN1.30.1'] = msg['IN1']['IN1.30']['IN1.30.1'].toString();
seg['IN1']['IN1.30']['IN1.30.2'] = msg['IN1']['IN1.30']['IN1.30.2'].toString();
seg['IN1']['IN1.31']['IN1.31.1'] = msg['IN1']['IN1.31']['IN1.31.1'].toString();
seg['IN1']['IN1.32']['IN1.32.1'] = msg['IN1']['IN1.32']['IN1.32.1'].toString();
seg['IN1']['IN1.33']['IN1.33.1'] = msg['IN1']['IN1.33']['IN1.33.1'].toString();
seg['IN1']['IN1.34']['IN1.34.1'] = msg['IN1']['IN1.34']['IN1.34.1'].toString();
seg['IN1']['IN1.35']['IN1.35.1'] = msg['IN1']['IN1.35']['IN1.35.1'].toString();
seg['IN1']['IN1.36']['IN1.36.1'] = msg['IN1']['IN1.36']['IN1.36.1'].toString();
/
Reply With Quote
  #2  
Old 01-16-2020, 05:29 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,346
cory_cole is on a distinguished road
Default

What is the format for MSH.7 and what format do you want?
Reply With Quote
  #3  
Old 01-16-2020, 05:43 AM
rwerner2 rwerner2 is offline
Mirth Newb
 
Join Date: Feb 2012
Location: Toledo
Posts: 20
rwerner2 is on a distinguished road
Default

The format of the MSH-7 from our registration system is YYYYMMDDHHHHss .
Reply With Quote
  #4  
Old 01-16-2020, 05:48 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,346
cory_cole is on a distinguished road
Default

And what do you want in IN1.29?
Reply With Quote
  #5  
Old 01-16-2020, 05:57 AM
rwerner2 rwerner2 is offline
Mirth Newb
 
Join Date: Feb 2012
Location: Toledo
Posts: 20
rwerner2 is on a distinguished road
Default

Hi Cory,

Sorry , I should have mentioned that. We just want the date really so YYYYMMDD. I should also mention when I installed my original change back in December timeframe it looked like the code below:

tmp['IN1'][inputIN2Index]['IN1.29']['IN1.29.1'] = msg['MSH']['MSH.7'];

It was only one line of code that I added to nested if for the IN1 segment. The problem that we found was the date was then showing in the IN1-29.1 field but every data field from IN1-30 to IN1-44 was then empty. So I was removing PROD data from everything after the IN1.29 field. Thanks for your help.
Reply With Quote
  #6  
Old 01-16-2020, 06:04 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,346
cory_cole is on a distinguished road
Default

tmp['IN1'][inputIN2Index]['IN1.29']['IN1.29.1'] = msg['MSH']['MSH.7']['MSH.7.1'].toString().substring(0,8);

Should work.
Reply With Quote
  #7  
Old 01-16-2020, 10:06 AM
rwerner2 rwerner2 is offline
Mirth Newb
 
Join Date: Feb 2012
Location: Toledo
Posts: 20
rwerner2 is on a distinguished road
Thumbs up

Hi Cory,

That worked great ! I was able to get the end-user to test it and approved that the date worked in their receiving system. I appreciate your help and quick response .

Thanks
Rob Werner
The University of Toledo Medical Center
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 12:58 AM.


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