Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Support (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=6)
-   -   HL7V2 - NTE issue (http://www.mirthcorp.com/community/forums/showthread.php?t=219210)

ASIFM786 06-19-2019 02:01 PM

HL7V2 - NTE issue
i am a newbie here and wondered if i can get some help, i have managed to get NTE to appear in a list now using the following code :-

var DocumentText = "";

for each (documentLine in msg['NTE']['NTE.3']['NTE.3.1'])

DocumentText += "<br/>" + documentLine;
connectorMap.put('DocumentText', DocumentText);

but the problem i am having the PDF writer is crashjing out when there is special characters eg.g = <> signs

i have tried to ignore these in the preprocessor, but instead of ignoring it is stripping out the special characters?

does anyone have a HTML format for a Lab report as an example which has some example scripts?

thanks in advance

cory_cole 06-20-2019 06:41 AM

If you don't want them removed, instead of ignoring them, escape them.

agermano 06-20-2019 11:14 AM

Try this:

DocumentText += "<br/>" + org.apache.commons.lang3.StringEscapeUtils.escapeHtml4(documentLine);

ASIFM786 06-20-2019 11:55 PM

thanks for your help guys, i have sorted it by using this scroipt below :-

var reportTxt = "";

for each (seg in msg.children())

if (seg.name().toString() == "NTE")
reportTxt += "<tr>" + ['NTE.3']['NTE.3.1'].toString().replace("<", "&lt;") + "</tr>";

channelMap.put('text', reportTxt);

is there a way of just reading the specific NTE below instead of all NTE

NTE|1|EC|Specific IgE
NTE|2|EC|Grade 0=<0.35 Grade 1=0.35 - 0.70 Grade 2=0.70 - 3.50
NTE|3|EC|Grade 3=3.50 - 17.5 Grade 4=17.5 - 50.0 Grade 5=50.0 - 100.0
NTE|4|EC|Grade 6=>100.0

agermano 07-05-2019 05:56 AM

Not sure if I understand your requirement.

If you only want the first NTE segment, you can access it without a loop like:


If you build your output as xml it will be automatically escaped for you.

msg['NTE'] (or msg.NTE) will give you only the children which have names equal to 'NTE', so you don't need to check that either.


var reportTxt = <></>; // creates empty XMLList
var specific = 'Specific';
for each (var nte in msg.NTE) {
    var line = nte['NTE.3']['NTE.3.1'].toString();
    // add to text if line starts with specific
    if (line.slice(0,specific.length) == specific) {
        reportTxt =+ <tr>{line}</tr>;
channelMap.put('text', reportTxt.toXMLString());

All times are GMT -8. The time now is 02:02 AM.

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