web stats
Batch processing JSON - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 08-01-2019, 11:14 AM
mothore mothore is offline
What's HL7?
 
Join Date: Aug 2019
Location: California
Posts: 2
mothore is on a distinguished road
Default Batch processing JSON

Using Connector Type: File Reader.

Have files that looks like:

Code:
{ id: 1, ... }
{ id: 2, ... }
{ id: 3, ... }
...
Tried going into Data Types and setting Inbound Properties to "Delimited Text" with Record Delimiter as "\n" and that kind of gets me closer to what I want but not there yet.

How do I send each line as JSON to other connectors?
Reply With Quote
  #2  
Old 08-02-2019, 12:00 AM
omnitux omnitux is offline
Mirth Newb
 
Join Date: Jan 2017
Posts: 15
omnitux is on a distinguished road
Default use batch processing

In Set Data Types you should use JSON as Inbound and click on Edit in the Inbound Properties/Batch/Javascript. Here you can use the following code:

Code:
var line = '';
while ((line = reader.readLine()) != null) {
	return line;
}
return null;
At last you have to activate "Process Batch" in the Source Connector Settings (second tab).

__________
Greetings
Reply With Quote
  #3  
Old 08-02-2019, 11:06 AM
mothore mothore is offline
What's HL7?
 
Join Date: Aug 2019
Location: California
Posts: 2
mothore is on a distinguished road
Default

This did the trick for me. Thank you!
Reply With Quote
  #4  
Old 08-02-2019, 10:34 PM
agermano agermano is online now
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 964
agermano is on a distinguished road
Default

For others that find this thread later, be aware this will only work if your JSON strings are always one line.
Reply With Quote
Reply

Tags
batch processing, file reader, json

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 06:28 PM.


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