web stats
Batch processing edi 834 files - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 11-09-2016, 08:35 AM
DragonQueen DragonQueen is offline
OBX.1 Kenobi
 
Join Date: Aug 2016
Posts: 37
DragonQueen is on a distinguished road
Default Batch processing edi 834 files

I am trying to parse a huge EDI 834 file which come in one single line to be split into different messages whenever the segment 'INS' is encountered.
Does anyone have sample javascript code they are willing to share?
Reply With Quote
  #2  
Old 11-09-2016, 11:38 AM
appsbyaaron's Avatar
appsbyaaron appsbyaaron is offline
Mirth Guru
 
Join Date: Nov 2011
Location: Florida, USA
Posts: 377
appsbyaaron is on a distinguished road
Default

Can't you split the string on 'INS'?

http://www.w3schools.com/js/js_string_methods.asp

txt.split("INS");

Last edited by appsbyaaron; 11-09-2016 at 11:40 AM.
Reply With Quote
  #3  
Old 11-10-2016, 11:21 AM
DragonQueen DragonQueen is offline
OBX.1 Kenobi
 
Join Date: Aug 2016
Posts: 37
DragonQueen is on a distinguished road
Default

Thanks. I did try that. I am probably missing something but it only returns the string before the first encountered 'INS'. I need it to keep looing through the line and return messages each time it encounters 'INS'.

This is the code I have right now:

var line="";
var message="";

if (reader.read() != -1) {
while (line = reader.readLine())
{
message = line.split("INS");
for (i = 0; i < message.length; i++){
return message[i];
}
break;
}


//return message;
}
else
return '';

What am I missing here?
Than you again for responding.
Reply With Quote
  #4  
Old 11-10-2016, 11:49 AM
DragonQueen DragonQueen is offline
OBX.1 Kenobi
 
Join Date: Aug 2016
Posts: 37
DragonQueen is on a distinguished road
Default

I have attached the test channel.
I am just trying to figure out the javascript code for split by batch

Thanks
Attached Files
File Type: xml Test File Import2.xml (86.1 KB, 31 views)
Reply With Quote
  #5  
Old 11-15-2016, 06:47 AM
DragonQueen DragonQueen is offline
OBX.1 Kenobi
 
Join Date: Aug 2016
Posts: 37
DragonQueen is on a distinguished road
Default

Does anyone have any suggestions? I am currently stuck on this.

Thanks
Reply With Quote
  #6  
Old 11-15-2016, 06:55 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,116
narupley is on a distinguished road
Default

I posted this on the public Slack channel. Should provide a good starting point.
Attached Files
File Type: txt EDI X12 Batch Script.js.txt (1.1 KB, 62 views)
__________________
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.

Last edited by narupley; 05-16-2018 at 08:24 AM.
Reply With Quote
Reply

Tags
batch process, edi 834, javascript

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 10:27 PM.


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