Error: no value associated with the property ‘EDI.ISA_Segment’ in the message.

Had to fix some code today left by a prior BizTalk developer.

Error:

Shape name: CreateTableTypeLogMessage
ShapeId: 734241d3-f9aa-41da-8696-511010d815f7
Exception thrown from: segment 2, progress 102
Inner exception: There is no value associated with the property ‘EDI.ISA_Segment’ in the message.

Explanation:

When you drop an EDI file, all these fields will exist, and the code would work properly. I was testing by dropping an XML file (the same as created by the BizTalk EDI Receive Pipeline). When you drop an XML file, there are of course no promoted EDI fields. So the developer should check for this and handle accordingly (substituting some dummy/null values instead).

In this case, in Production the error wouldnot occur, becausse there we would presumably always be dropping EDI files. But it is nice to have the flexibility to drop an XML X12 file when needed.

See the “Code Before” shown below. This was in a catch exception block under a scope. The developer was logging almost all the fields in the ISA/GS headers. BizTalk provides promoted fields for some of them, but not all. So he had helper routine in C# which would return the nth item of header.

Code Before:

<pre>
isaSegment = msgInbound(EDI.ISA_Segment);
gsSegment = msgInboundEDI.GS_Segment);

xpath(msgError,"/*[local-name()='usp_InsertEDILogRecords']/*[local-name()='EDILogRecords']/*[local-name()='udtt_EDITransactionLog']/*[local-name()='ISASender']") = Inbound_CPChemX12(EDI.ISA06);

xpath(msgError,"/*[local-name()='usp_InsertEDILogRecords']/*[local-name()='EDILogRecords']/*[local-name()='udtt_EDITransactionLog']/*[local-name()='ISADate']") = CPChemHelpers.StringSplitter.SplitString(isaSegment,'*',9);

</pre>

After: Using the “exists” keword

You can make sure the promoted field is there by using the “exists” syntax.
“if (promotedField exists message)” is the syntax, where “exists” is the literal keyword, and the other two would be your values.

NOTE: You cannot use an “if” statement in a “message assignment shape”, only in an “expression shape”. So you would have to set some of these values in an expression shape in variables, and then use those variables in the message assignment shape. So the code below would NOT work as is.

The other alterantive is to use the BizTalk Decide Shape, and have two construct/message-assignment shapes, such that only the appropriate one would execute.

<pre>
if (EDI.ISA_Segment exists msgInbound)
  {
     isaSegment = msgInbound(EDI.ISA_Segment);
     gsSegment = msgInboundEDI.GS_Segment);

     xpath(msgError,"/*[local-name()='usp_InsertEDILogRecords']/*[local-name()='EDILogRecords']/*[local-name()='udtt_EDITransactionLog']/*[local-name()='ISASender']") = Inbound_CPChemX12(EDI.ISA06);

     xpath(msgError,"/*[local-name()='usp_InsertEDILogRecords']/*[local-name()='EDILogRecords']/*[local-name()='udtt_EDITransactionLog']/*[local-name()='ISADate']") = CPChemHelpers.StringSplitter.SplitString(isaSegment,'*',9);
  }
else 
  {
     // put blank or other values in those fields as desired. 
  }
</pre>

Decide Shape Solution

The rule itself can be set in the Properties window or by click on the Decide shape. There is a red exclamation here because I changed the message name when I took the screen shot.

Uncategorized  

Leave a Reply