Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Support (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=6)
-   -   Batch processing edi 834 files (http://www.mirthcorp.com/community/forums/showthread.php?t=216644)

DragonQueen 11-09-2016 08:35 AM

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?

appsbyaaron 11-09-2016 11:38 AM

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

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

txt.split("INS");

DragonQueen 11-10-2016 11:21 AM

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.

DragonQueen 11-10-2016 11:49 AM

1 Attachment(s)
I have attached the test channel.
I am just trying to figure out the javascript code for split by batch

Thanks

DragonQueen 11-15-2016 06:47 AM

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

Thanks

narupley 11-15-2016 06:55 AM

1 Attachment(s)
I posted this on the public Slack channel. Should provide a good starting point.

rav 07-14-2017 06:20 PM

Quote:

Originally Posted by narupley (Post 257572)
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.

siddharth 07-17-2017 01:31 AM

Can you show how you are calling/using the script?

rav 07-17-2017 07:29 AM

Quote:

Originally Posted by siddharth (Post 260310)
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!

kirbykn2 07-17-2017 08:21 AM

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".


All times are GMT -8. The time now is 09:59 PM.

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