|
#1
|
|||
|
|||
|
I am new to Mirth and am in need of some help. My goal is to create an MDM from a PDF filename.
The filename has the following format LastName_FirstName_MRN_DOB_Date.pdf I created a source of FileReader to bring in the PDF and a destination of a FileWrite to export an HL7 message file. What I can't figure out is how to parse the filename into variable so I can build my HL7 message. Please help... Last edited by Noaeill13; 04-12-2012 at 04:59 PM. |
|
#2
|
|||
|
|||
|
If you're using a File Reader, then an "originalFilename" channel map variable will be available to you. Simply reference it with: $('originalFilename')
|
|
#3
|
|||
|
|||
|
I have the transformer with a variable for filename mapping the $('originalFilename'). I can't figure out how to breakdown the filename from there to create variables from the data inbetween the _ in the filename.
|
|
#4
|
|||
|
|||
|
Quote:
http://www.hunlock.com/blogs/The_Com...ings_Reference |
|
#5
|
|||
|
|||
|
Use the split function to split the filename into an array, then use the items in that array:
Code:
var file_name = $('originalFilename');
var parts = file_name.split('_');
var lastname = parts[0];
var firstname = parts[1];
etc.
__________________
JJ Mouris FFE Luxembourg IT-Department |
|
#6
|
|||
|
|||
|
This is great! I have my script working to parse the name. Thank you both!!!
I have a new problem, getting Mirth to identify the PDF. My source is a FileReader looking for *.PDF files. I am getting the following error... [2012-04-17 23:01:54,953] FATAL (org.mule.impl.DefaultComponentExceptionStrategy:8 4): The error is: org.mule.MuleException: Error happened while listing files java.lang.Exception: org.mule.MuleException: Error happened while listing files at com.mirth.connect.connectors.file.FileMessageRecei ver.poll(FileMessageReceiver.java:124) at org.mule.providers.PollingMessageReceiver.run(Poll ingMessageReceiver.java:97) at org.mule.impl.work.WorkerContext.run(WorkerContext .java:290) at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor.runWorker(ThreadPoolExecutor.java: 1061) at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :575) at java.lang.Thread.run(Unknown Source)Caused by: org.mule.MuleException: Error happened while listing files at com.mirth.connect.connectors.file.filesystems.File Connection.listFiles(FileConnection.java:136) at com.mirth.connect.connectors.file.FileMessageRecei ver.listFiles(FileMessageReceiver.java:416) at com.mirth.connect.connectors.file.FileMessageRecei ver.poll(FileMessageReceiver.java:104) ... 5 moreCaused by: java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0*.pdf^ at java.util.regex.Pattern.error(Unknown Source) at java.util.regex.Pattern.sequence(Unknown Source) at java.util.regex.Pattern.expr(Unknown Source) at java.util.regex.Pattern.compile(Unknown Source) at java.util.regex.Pattern.<init>(Unknown Source) at java.util.regex.Pattern.compile(Unknown Source) at com.mirth.connect.connectors.file.filters.RegexFil enameFilter.accept(RegexFilenameFilter.java:24) at java.io.File.listFiles(Unknown Source) at com.mirth.connect.connectors.file.filesystems.File Connection.listFiles(FileConnection.java:121) ... 7 more |
|
#7
|
|||
|
|||
|
looks like you have the regex checkbox ticked.. untick it on the file reader.
|
|
#8
|
|||
|
|||
|
Hi I have a similar requirement, can you please send the information how you parsed the file name information and constructed the hl7 mdm message. Appreciate all your help.
|
![]() |
| Tags |
| filename, hl7, mdm, pdf |
| Thread Tools | |
| Display Modes | |
|
|