web stats
Post file reader - Mirth Community

Go Back   Mirth Community > Mirth Connect > General Discussion

Reply
 
Thread Tools Display Modes
  #1  
Old 09-23-2019, 06:56 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,302
cory_cole is on a distinguished road
Default Post file reader

I have a channel that reads in all of the files in a folder and process them. After it has read all the files, I need to do another step. I have tried putting the code in the destination and in the post processor but it does it for each file. Where can I put the code to run after all files are processed?
Reply With Quote
  #2  
Old 09-24-2019, 12:23 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,009
agermano is on a distinguished road
Default

If you're on a current versionof mirth, the File Reader will set a sourceMap variable 'pollComplete' with a value of true for the last file read in.

You can do in your post-processor

Code:
if ($('pollComplete')) {
    // run your clean-up code.
}
Reply With Quote
  #3  
Old 09-27-2019, 10:38 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,302
cory_cole is on a distinguished road
Default

This looks like it works. It is not doing the code for each file. I will know if it does it at the end this weekend. We had over 400,000 files to process.
Reply With Quote
  #4  
Old 09-30-2019, 09:46 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,009
agermano is on a distinguished road
Default

It should work for mirth version 3.6 or higher.
Reply With Quote
  #5  
Old 10-07-2019, 02:57 AM
JosefiinaRautakorpi JosefiinaRautakorpi is offline
What's HL7?
 
Join Date: Oct 2019
Location: Finland
Posts: 1
JosefiinaRautakorpi is on a distinguished road
Default

Minulla on versio 3.6. Kaikki toimii oikein. Yritä päivittää.
Reply With Quote
  #6  
Old 10-30-2019, 10:37 AM
jonathanlent jonathanlent is offline
OBX.1 Kenobi
 
Join Date: Aug 2014
Location: Denton, TX
Posts: 43
jonathanlent is on a distinguished road
Smile

Be careful about the implementation. I think to do what you want to do (had something similar to do recently), you need to check this:

Code:
$('pollComplete') == true && $('batchComplete') == true
Checking the combined values was ultimately the only thing that produced a consistent boolean value for post-processing behavior.
Reply With Quote
  #7  
Old 11-08-2019, 06:00 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,009
agermano is on a distinguished road
Default

Quote:
Originally Posted by jonathanlent View Post
Be careful about the implementation. I think to do what you want to do (had something similar to do recently), you need to check this:

Code:
$('pollComplete') == true && $('batchComplete') == true
Checking the combined values was ultimately the only thing that produced a consistent boolean value for post-processing behavior.
Good point!
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 04:27 AM.


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