web stats
Help with FileReader and writer - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 04-12-2019, 03:00 PM
Mits87 Mits87 is offline
OBX.2 Kenobi
 
Join Date: Nov 2016
Posts: 59
Mits87 is on a distinguished road
Default Help with FileReader and writer

I am receiving a text file. The first three lines of the file are patient information and after that, it contains the patient test result which is tab delimited (/t). I need to save the patient information from the top and then delete the first 3 lines and save the file as is.

I created one file reader and was able to store the first three line values in a variable for later use but it's not deleting the line 2. In addition to that, it's also removing /n after each line and in the output file, it saves the entire file as a single line instead of keeping the file as is. I need the file as is in the tab-delimited format after deleting the top three lines.

Can someone point out my mistake? I did try to play around with set data type options under summery but no luck so far.

I am using 3.7.0. Please see the attached channel and the sample test file.
Attached Files
File Type: xml FileReader.xml (33.6 KB, 5 views)
File Type: txt new 1.txt (166 Bytes, 10 views)
Reply With Quote
  #2  
Old 04-12-2019, 09:04 PM
lbittle lbittle is offline
Mirth Newb
 
Join Date: Sep 2018
Posts: 21
lbittle is on a distinguished road
Default

Suggest that you might find it easier to do this with a shell script and then run that script from the channel.

I would use either the sed or awk commands in the script.
Reply With Quote
  #3  
Old 04-12-2019, 10:54 PM
Mits87 Mits87 is offline
OBX.2 Kenobi
 
Join Date: Nov 2016
Posts: 59
Mits87 is on a distinguished road
Default

This is windows environment running windows 10.
Reply With Quote
  #4  
Old 04-15-2019, 07:41 AM
schillert schillert is offline
OBX.1 Kenobi
 
Join Date: Jul 2012
Posts: 30
schillert is on a distinguished road
Default

Hi,

this should do it.
Attached Files
File Type: xml SplitFile.xml (11.1 KB, 11 views)
Reply With Quote
  #5  
Old 04-15-2019, 11:59 PM
Mits87 Mits87 is offline
OBX.2 Kenobi
 
Join Date: Nov 2016
Posts: 59
Mits87 is on a distinguished road
Default

You are awesome works perfectly. The only question I have is I use encoding as Default for the file but you used ISO-8859-15 can you explain why and how to determine which to use.

Last edited by Mits87; 04-16-2019 at 01:19 AM.
Reply With Quote
  #6  
Old 04-17-2019, 02:18 AM
schillert schillert is offline
OBX.1 Kenobi
 
Join Date: Jul 2012
Posts: 30
schillert is on a distinguished road
Default

If you use default encoding Mirth will use the charset the java vm is running with. Under Linux this is mostly UTF-8 - under Windows this is most likely Windows 1272(in western Europe).
Choosing a charset depends on the encoding of your messages - in Germany this is nearly always ISO-8859-15.
So if you know the charset of your messages - that's the one to use.
Reply With Quote
  #7  
Old 04-17-2019, 10:57 PM
Mits87 Mits87 is offline
OBX.2 Kenobi
 
Join Date: Nov 2016
Posts: 59
Mits87 is on a distinguished road
Default

Thanks for the explanation. I think this will help me a lot in the future.
Reply With Quote
Reply

Tags
file read, file reader, file write

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 08:36 PM.


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