Announcement

Collapse
No announcement yet.

Help TXT to PDF

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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 Files

  • #2
    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!

    Comment


    • #3
      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.

      Comment


      • #4
        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.

        Comment


        • #5
          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, 07:54 AM.

          Comment


          • #6
            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!

            Comment


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

              Thanks for the help.

              Comment

              Working...
              X