Sidebar

How do I avoid outputting null when using qie.evaluateTemplate()?

0 votes
76 views
asked Sep 10 by phil-d-8268 (190 points)
I am using the Evaluate Template function to pull data from a JSON file into a HL7 template. If a field in the source JSON is set to null, I end up with a value of null for that field in the output HL7, which I do not want; it should just be blank.

How do I achieve this?

1 Answer

0 votes

There are a few options, but if you wanted to use the Standard Mappings to accomplish this, you could add in a new mapping that sets the HL7 field to a blank string when it is 'null'.

For example, if the HL7 field is OBX-5, you would use a standard mapping to set OBX-5 to an empty string, and check the "Apply Condition" checkbox at the bottom of the Standard Mapping screen.  That will allow you to set a condition that checks to see if OBX-5 is 'null'.  If the return of that condition is true, OBX-5 would be replaced with an empty string.  Here's a screenshot:

There are other ways to do this as well via a Custom Mapping, in which case you would use an if..else to evaluate if the JSON field was null before setting the HL7 field.  If you'd like to look at that and other possible options, send an email in to support@qvera.com and we can help you with your specific situation.

answered Sep 10 by jon-t-7005 (8,110 points)
...