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, 32 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,123
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, 71 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
  #7  
Old 07-14-2017, 06:20 PM
rav rav is offline
Mirth Guru
 
Join Date: Oct 2012
Posts: 258
rav is on a distinguished road
Default

Quote:
Originally Posted by narupley View Post
I posted this on the public Slack channel: EDI/X12 Batch Script

Should provide a good starting point.
I am working on a similar use case and used the script provided on Slack. The channel is taking a lot of time to process just one message and after a while, I see a java heap space error. Any help is appreciated.
Reply With Quote
  #8  
Old 07-17-2017, 01:31 AM
siddharth siddharth is offline
Mirth Guru
 
Join Date: Feb 2013
Posts: 832
siddharth is on a distinguished road
Default

Can you show how you are calling/using the script?
Reply With Quote
  #9  
Old 07-17-2017, 07:29 AM
rav rav is offline
Mirth Guru
 
Join Date: Oct 2012
Posts: 258
rav is on a distinguished road
Default

Quote:
Originally Posted by siddharth View Post
Can you show how you are calling/using the script?
I changed the data types to raw and under batch, I have used the script provided by Nick and on the source, I selected process batch. It's a huge file close to 70MB. Any thoughts!
Reply With Quote
  #10  
Old 07-17-2017, 08:21 AM
kirbykn2's Avatar
kirbykn2 kirbykn2 is offline
Mirth Guru
 
Join Date: Sep 2014
Location: Michigan
Posts: 577
kirbykn2 is on a distinguished road
Default

I did something similar for an X12 file. I set "Process Batch" to yes on the summary tab, then configured the "Batch Delimiter" in "Set Data Types".
__________________
Kirby

Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

Appliance Version 3.11.2
Mirth Connect Version 3.6.1
Java Version 1.6.0_45-b06
Java (64 bit) Version 1.6.0_45-b06
Java 7 (64 bit) Version 1.7.0_151-b15
Java 8 (64 bit) Version 1.8.0_121-b13
PostgreSQL Version 9.6.3
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 05:10 PM.


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