Hi everyone, please check out our new discussion forum located in our GitHub site: https://github.com/nextgenhealthcare/connect/discussions. Let us know your feedback as we try out this new part of GitHub! Don't worry, the content in these forums won't be going away and will at a minimum be preserved for historical reference.
I have an HL7 message consisting of the following OBX segments. How do I extract the data from OBX-2 (foo2) without extracting the previous or next values?
OK, I figured that question out. I made my Transformation Mapping look like this
msg['OBX'][1]['OBX.5']['OBX.5.1'].toString() and that returned 'foo2'.
The only problem with this approach is that I don't know how many OBX segments there are. Is there a way to determine how many OBX there are and then return the value of each segment on a seperate line?
Sample code below uses shows how to process multiple patient insurance. Similar code should work for multiple OBX segments too.
Hope it helps!
Code:
var i = 0;
// Check if the InsuranceCarrierID exist
while (msg['ADT_A01.INSURANCE']['IN1']['IN1.3']['CX.1'][i] != null) {
// Get the insurance carrier id
tempInsuranceCarrierID = msg['ADT_A01.INSURANCE']['IN1']['IN1.3']['CX.1'][i].toString();
if (tempInsuranceCarrierID.length > 0) {
...
}
// increment index to process the next patient insurance, if any
i = i + 1;
}
You need to create JavaScript Transformer step. In the Transformer screen, when you do "Add Step", you see a row with "newVar0" under column "Name" and "Mapper" under column "Type". Double click under "Type" it should show a list box with "Mapper" and "JavaScript" dropdown. Select "JavaScript".
Thanks, that worked like a charm. I still wondering if I am trying to over complicate things. Here is my scenario:
I want to open an HL7 message from the file system (File Reader Source) and write the message to a PDF (document writer). I want to extract segment 5 into the PDF template (which works) but I want to put blank lines where segment 5 contains no data (right now, it prints the entire HL7 message onto the template with no line breaks or carriage returns). Is there an easy way to do this?
If I create a Transformer with a variable ${Test}and a mapping of msg['OBX']['OBX.5']['OBX.5.1'].toString(), and then drag the variable ${Test} from the Destination Mapping section on the Channel, the message gets created on the PDF as
testingsegment1 testingsegment 3 testing segment 4 (All on the same line)
What I want it to look like is:
Testing segment 1 (New line)
(blank line since segment 2 has no data)
Testing segment 3 (New Line)
Testing segment 4 (New Line)
Thanks for all your help so far. I feel like I am starting to really learn the product and already came up with quite a number of future uses.
You can format and layout your PDF documents by using HTML in your template. Just layout your report using tables and put in the testing segment variables where you would like them (see nshaik's links for examples).
I have a feeling i'm not explaining myself well. If you look at my previous post, you will see that I am only creating one transformer variable (${Test}). That one variable contains the value "testingsegment1 testingsegment 3 testing segment 4" (All on the same line).
What I really need to do is break out those values into multiple variables so that I can format them in tables correctly. However, I can't figure out how to break them out in seperate variables since "msg['OBX']['OBX.5']['OBX.5.1'].toString()" returns all the OBX values mentioned above.
And I can't specify "msg['OBX']['OBX.5']['OBX.5.1'][i].toString()" without doing some javascript function since I don't know what "i" could be.
If I do attempt to use javascript, I can't figure out how to return a var to the template to be printed????
I am sure I am just missing something and it is a very easy fix to do what I need.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, personalize advertising, and to analyze site activity. We may share certain information about our users with our advertising and analytics partners. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment