Extra char(s) found in EDI.ISASegment - biztalk

When I was inbounding trading partner's X12 file using biztalk. I am required to store the ISA segment of the file in a db table.
I am using the promoted property EDI.ISA_Segment to get the ISA string.
Recently, I noticed for one trading partner. There're extra chars found in the ISA segment:
The ISA segment shall look like this:
ISA*00* *00* *ZZ*######## *ZZ*##### *150105*0606*^*00501*000000936*1*P*>~
But the ISA_segment using the promoted property was:
ISA*00* *00* *ZZ*######## *ZZ*##### *150105*0606*^*00501*000000936*1*P*>~
G
There's extra < LF >+G in the ISA segment.
The trading partner do send the X12 file with segment suffix and it was also configed in the BizTalk Agreement correctly.
It looks BizTalk takes 2 extra chars to the ISA_segment after reached the "~", I am wondering if this is a bug or it is caused some mis-configuation?

You need to look at the original EDI using a good text editor such as Notepad++ so you can see exactly what those characters are.
The X12 spec allows the use of CR and/or LF as part of the Segment Terminator so it might be a side effect of changing encodings from EDI to the database.

Related

BizTalk Mapping EDI N2 field (in an outbound message)

What's the best practice for mapping decimals in EDI schemas?
The assembler seems to be flexible to allow them to be there or not.
I had one case on a QA system, where same map, but two customers were getting different results. I was thinking it had to be a party configuration option.
This is for outbound X12 EDI 210 (version 401)
Schema
Note on sample below: L102 is define as R, and L104-L106 are defined as N2.
L1*1*111.00*FR*11100****LHS~ (Correct)
L1*1*111.00*FR*111.00****LHS~ (Incorrect)
I was hoping the Party settings:
under Local Host Settings, checking the box for "Convert implied decimal format NN to base 10 numeric value" would fix, but later I read this is only for incoming EDI messages.
I did a test where I mocked up a 210 XML, just showing a fragment below with the results to the right side of L104-L106. This seems to show that if no decimal there, the two decimal places are implied, but if decimal is there, that overrides.
Sample1
<ns0:L1>
<L101>1</L101>
<L102>111.00</L102>
<L103>FR</L103>
<L104>111.00</L104> EDI Value 11100
<L105>111</L105> EDI Value 111
<L106>11100</L106> EDI Value 11100
<L108>LHS</L108>
</ns0:L1>
Sample 2
<ns0:L1>
<L101>1</L101>
<L102>111.00</L102>
<L103>FR</L103>
<L104>111</L104> EDI Value 111
<L105>111.0</L105> EDI Value 11100
<L106>111.00</L106> EDI Value 11100
<L108>LHS</L108>
</ns0:L1>
So two questions:
1) Is there a party setting to fix my issue where one customer is right and one is wrong?
2) What is the best practice for mapping decimal places in the BizTalk supplied XML/EDI schemas?

Adding elements in Biztalk Expression Editor

I have an orchestration that sends out emails and I'm trying to write out the email subject to include nodes from the XML. I want to write the following in the subject:
EDI 860 - PO Change Notification:(Buyer Name),(Buyer City),(Buyer State)
This is how I wrote it in the expression:
emailSubject = "EDI 860 - PO Change Notification:"+"/*[local-name()='Name' and namespace-uri()='']/*[local-name()='buyer_name' and namespace-uri()='']"+"/*[local-name()='Name' and namespace-uri()='']/*[local-name()='city' and namespace-uri()='']"+"/*[local-name()='Name' and namespace-uri()='']/*[local-name()='state' and namespace-uri()='']";
Is this correct? I'm pretty new to orchestrations and writing expressions. I didn't get any errors while writing and it seems like valid language, but I don't have a test environment to try it out on. I'm worried that the email will currently come out like this:
EDI 860 - PO Change Notification:(Buyer Name)+(Buyer City)+(Buyer State)
For starters. Get a test environment or at the very least test it in your dev environment. You should not release anything that has not been tested.
No, it would not work like that, see Using XPaths in Message Assignment
It would have to look like the below where you also tell it that it is an xpath and have the name of the message (msg)
myString = xpath(msg, "string(/*/book[1]/title)");
Even if it had worked it would look like the second one example, as you aren't adding the commas in the string concatenation.
Also rather than trying to use XPaths, you might want to look at using distinguished fields in your schema. This will make it a lot easier to refer to elements in your payload and make it easier for developers to read (it still uses XPaths under the hood).
To use the distinguished field you just refer to the message name & field name
e.g.
emailSubject = "EDI 860 - PO Change Notification:"+ msg.Name.buyer_name + "," + msg.Name.city + "," + msg.Name.state;

A catch 22 in generating 999 file

Well, I have to say it is kind of funny when I meet this situation:
I am inbounding HIPPA 837 files and I am suppose to create 999 ACK files once received the 837 file. BizTalk will generate the 999 message if I setup the trading partner agreement to do so. And it works fine so far.
Today, I received a 837 file with some structure error: there are some leading space character in an element. Then the 999 was created, but when my send port subscribe this 999 message try to save it as a file, I got an validation error complains the 999 message itself is invalid cause its element have leading space characters.....
Error: 3 (Field level error)
SegmentID: IK4
Position in TS: 18
Data Element ID: IK44
Position in Segment: 4
Data Value:
6: Leading or trailing space found
It looks for me like a catch 22: your 999 files are suppose to report structure error of the inbound file,it will include the wrong element value as part of the report (in my case, it's in IK4 segment) , but the wrong element value itself make the 999 file invalid too.
I just want to know if anyone have meet the same situation? And what's your suggestion on this issue?
I have not seen this, and really, I'm a bit surprised it hasn't come up before, if it's a real catch-22 :)
Try this, in the You->Them tab of the Agreement, set the Default row in the Validation section to have Leading and trailing spaces = Allowed.
You may have to explicitly set all other tx to Not Allowed since the 999 is not on the Transaction Type list.
I would try #Johns-305's suggestion, but I know I've had issues with using the allow leading/trailing spaces before in the agreement (some fields just seem to blow up on this for me even with it on).
I would try capturing the 999 message before it gets to the EDI send and using normalize-space() (in XSLT) or .Trim() (in C#) on the node(s) in question. You can do this by creating a send port that filters on the 999 BTS.MessageType.
This may not fully satisfy your trading partner's expectations though, because the segment might be valid without a space (leading to confusion about why a perhaps otherwise valid segment was rejected).
You also might take this up with Microsoft, although it might be a limitation of using XML (where leading whitespace may be treated as insignificant) to represent EDI (where leading whitespace is bad news).

HL7 to SQLite with Mirth Connect

I'm trying to build a channel to read an HL7 ADT text file, extract an MRN and write output to a SQLite table (Database Writer).
My SQLite table contains my data but all my PatientIDs are appearing as a concatenated string in one very wide column. As opposed to a PatientID per row/record.
I'm noticing some weird illegal(?) characters in my HL7 file (which come from a Meditech EMR). In QuickViewHL7 they appear in the MSH-22 and MSH-30.
In the VIM editor -
My question is, are these supposed to be delimiters? If so, what are they? Carriage Returns?
I've posted this question on the Mirth Connect forums but seen little but tumbleweeds. I'm hoping someone here might have seen this before and tell me what's going on.
UPDATE: Hex dump suggests it's a 0x7f (0111 1111). This looks like a backspace character. Should I simply strip it or substitute it with something?
This illegal character should be a line feed carriage return to delimit the start of the next HL7 segment.
Using VIM, highlight the illegal character and press 'ga'. This will tell you the hex value of the character. In my case 0xfa (which appears to be a back space!?).
Again in Vim, do a global substitute for a \r
:%s/\%x7f/\r/g
Then save the file.
Everything parses out nicely now.

Some special characters are added in the BizTalk output file

I have put an XML into a receive location using the Microsoft BizTalk default pipeline "XMLReceive" and then use PassThroughTransmit to output the file to a directory.
However, if hex editor to check the output file, I found that there are three special characters  are found at the beginning of the output file.
The ASCII of  is EF BB BF.
Is there any idea why there are 3 control characters are added at the beginning of the output file?
Those characters are the Byte Order Mark which tell the receiving application how to interpret the text stream. They are not junk but are optional.
I recommend you always send the BOM unless the recieving system cannot accept them (which is really their problem ;).
I have googled the solution myself and shared to others.
Removing the BOM from Outgoing BizTalk Files
http://mindovermessaging.com/2013/08/06/removing-the-bom-from-outgoing-biztalk-files/
The three special characters are BOM (Byte Order Mark), set the PreserveBOM to false in sendport XMLTransmit pipeline will remove these three characters.

Resources