web stats
Help TXT to PDF - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 07-26-2018, 06:34 PM
Mits87 Mits87 is offline
OBX.2 Kenobi
 
Join Date: Nov 2016
Posts: 59
Mits87 is on a distinguished road
Default Help TXT to PDF

I have one tab delimited text file and need to convert to PDF. The entire file is for 1 patient and need to include all the test result record in one PDF file. My channel works fine when i have only 1 line if the txt file but wont work if I remove /n as record delimiter. I need to read entire file and need to generate only one PDF file out of it.

My date in Txt file is
Code:
Record Type	Record Number	Month	Date	Year	Hour	Minute	Temperature Range	Battery Level	Meal Taken Time	Glucose Result	Ketone Result	Smart Tag Number	Table Number	None	None	None	None	None	None	None	None	Manual Insulin Type	Long-Acting Insulin	Bolus Insulin	
2	20715	6	18	18	23	11	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	1	42	0
0	20714	6	18	18	22	10	0	0	2	119	0	0	0	0	0	0	0	0	0	0	0	0	0	0
2	20713	6	18	18	19	14	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	16
0	20712	6	18	18	19	14	0	0	1	308	0	0	0	0	0	0	0	0	0	0	0	0	0	0

I need report like the one in attached picture.

I have attached my channel and sample file if that helps. I am using Mirth 3.5.2 but can switch to different version.
Attached Images
File Type: png report.png (34.6 KB, 16 views)
Attached Files
File Type: xml Experiment3PDFReport.xml (26.8 KB, 8 views)
File Type: txt LName_FName_1234567890.txt (500 Bytes, 2 views)
Reply With Quote
  #2  
Old 07-27-2018, 01:18 AM
siddharth siddharth is offline
Mirth Guru
 
Join Date: Feb 2013
Posts: 832
siddharth is on a distinguished road
Default

The thing is you would need to create a Javascript array of objects. The properties of this object would be column of the file. Something like

Code:
object.Record=6;
object.Number=18;
// and so on.
array.push(object)
Then push this array inside a channelMap.

It would be easier for you to iterate over this array inside the template section of your document writer using velocity iteration, that is the keyword.

So search for delimited text to JSON on the forum.
__________________
HL7v2.7 Certified Control Specialist!
Reply With Quote
  #3  
Old 07-27-2018, 05:30 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 967
agermano is on a distinguished road
Default

Leave the record delimiter as \n. Turn off 'Process Batch' on your source tab if you want all rows in a single message.

I agree with all of siddharth's suggestions.
Reply With Quote
  #4  
Old 07-28-2018, 09:37 AM
Mits87 Mits87 is offline
OBX.2 Kenobi
 
Join Date: Nov 2016
Posts: 59
Mits87 is on a distinguished road
Default

Thanks siddharth for your help actually am not too familier with scripting/programming still taking my baby steps but i will playaround and see if i can make it work. I tried to search forum as you suggested but dont see any thread for that.
Reply With Quote
  #5  
Old 07-28-2018, 11:15 AM
Mits87 Mits87 is offline
OBX.2 Kenobi
 
Join Date: Nov 2016
Posts: 59
Mits87 is on a distinguished road
Default

I removed the batch process as you suggested but now am not able to ignore my first line as its the column name any suggestion ?

UPDATE - I used the delete function to delete the first line not sure if this is best way of doing so but its working for me for the time being

Last edited by Mits87; 07-29-2018 at 07:54 AM.
Reply With Quote
  #6  
Old 07-29-2018, 09:30 PM
siddharth siddharth is offline
Mirth Guru
 
Join Date: Feb 2013
Posts: 832
siddharth is on a distinguished road
Default

I got 20 hits for csv to JSON as keyword in search box, what is that you are not able to find?

You need to use ignore header in the data type setting.
__________________
HL7v2.7 Certified Control Specialist!
Reply With Quote
  #7  
Old 08-01-2018, 01:57 PM
Mits87 Mits87 is offline
OBX.2 Kenobi
 
Join Date: Nov 2016
Posts: 59
Mits87 is on a distinguished road
Default

never mind i was searching with txt to json and delimited text to json.

Thanks for the help.
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 09:49 PM.


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