web stats
Channel receiving both XML and PDF message Like to bypass transformer - Page 2 - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #11  
Old 03-14-2016, 08:52 AM
jackwhaines jackwhaines is offline
 
Join Date: May 2011
Location: Kansas City, Missouri
Posts: 168
jackwhaines is on a distinguished road
Send a message via Skype™ to jackwhaines
Default

See if this helps. Might get you close...

Code:
var fileId = msg['MSH']['MSH.5']['MSH.5.1'].toString();

var origPath = "D:/WhereMyFilesAre/";
var origFilename = sourceMap.get('originalFilename').toString();

var newPath = "D:/WhereMyFilesShouldBe/";
var newFilename = fileId + ".pdf";

var file1 = new Packages.java.io.File(origPath + origFilename);
var file2 = new Packages.java.io.File(newPath + newFilename);

file1.renameTo(file2);
__________________

-= Jack Haines : Healthcare Integrations, LLC
-= jack.haines@HealthcareIntegrations.com
-= Mirth Connect (Advanced)-certified
-= Gold member of HL7.org
-= Available for Mirth Connect channel development and consultation! Schedule a call with me at https://integrations.as.me
Reply With Quote
  #12  
Old 03-16-2016, 09:25 AM
tmcdevitt tmcdevitt is offline
OBX.3 Kenobi
 
Join Date: Oct 2014
Posts: 125
tmcdevitt is on a distinguished road
Default

Thanks Jake for the help with this one question, how do I set the file name for both the PDF and XML to be the same time stamp?
Reply With Quote
  #13  
Old 03-16-2016, 10:35 AM
jackwhaines jackwhaines is offline
 
Join Date: May 2011
Location: Kansas City, Missouri
Posts: 168
jackwhaines is on a distinguished road
Send a message via Skype™ to jackwhaines
Default

Quote:
Originally Posted by tmcdevitt View Post
Thanks Jake for the help with this one question, how do I set the file name for both the PDF and XML to be the same time stamp?
The same timestamp in the filename or like the modified time of the file?
__________________

-= Jack Haines : Healthcare Integrations, LLC
-= jack.haines@HealthcareIntegrations.com
-= Mirth Connect (Advanced)-certified
-= Gold member of HL7.org
-= Available for Mirth Connect channel development and consultation! Schedule a call with me at https://integrations.as.me
Reply With Quote
  #14  
Old 03-16-2016, 12:05 PM
tmcdevitt tmcdevitt is offline
OBX.3 Kenobi
 
Join Date: Oct 2014
Posts: 125
tmcdevitt is on a distinguished road
Default

Last question and I should be all set. In my testing when I drop the files some times the XML writes faster then the PDF message can you please explain what you mean by using a filter to not process XML until the PDF is in the folder. Is it in the filter I will look in the folder for the PDF and then process if not I will write the XML file again to the input folder?
Reply With Quote
  #15  
Old 03-16-2016, 12:26 PM
jackwhaines jackwhaines is offline
 
Join Date: May 2011
Location: Kansas City, Missouri
Posts: 168
jackwhaines is on a distinguished road
Send a message via Skype™ to jackwhaines
Default

Quote:
Originally Posted by tmcdevitt View Post
Last question and I should be all set. In my testing when I drop the files some times the XML writes faster then the PDF message can you please explain what you mean by using a filter to not process XML until the PDF is in the folder. Is it in the filter I will look in the folder for the PDF and then process if not I will write the XML file again to the input folder?
Option 1) You could add an age timer to the Source of the channel. There is an option called "File Age (ms)" that if you set to say, 60 seconds, it won't pick up that XML file until the xml is at least 60 seconds old. Plenty of time to get your PDF written.

Option 2) If that's not always the case, you could add another filter to the XML processing, to check for the existence of the PDF file and set the message as queued or something until the PDF exists. If it doesn't, keep the message queued and retry every 60 seconds or something.
__________________

-= Jack Haines : Healthcare Integrations, LLC
-= jack.haines@HealthcareIntegrations.com
-= Mirth Connect (Advanced)-certified
-= Gold member of HL7.org
-= Available for Mirth Connect channel development and consultation! Schedule a call with me at https://integrations.as.me
Reply With Quote
Reply

Tags
filter, router

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 09:31 PM.


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