Monday, October 22, 2012

Xpath to retrieve Group Attribute values from Oracle B2B message


It was on basic xpaths for retrieving the invoice id and other information based on segments.
//*[local-name()=' Element-143']/text()  -  This works for fetching data from the ST segment (Transaction Type– highlighted below in green).
B2B uses the information from edi file and agreement information to populate Group Information – Group Control Number (GS06) , Group Functional Identifier (GS01).
But for fetching the Group Information – Group Control Number (GS06) , Group Functional Identifier (GS01) XPath expression is bit complex and I am listing them below.

So for example to list GroupSenderId value::

//*[local-name()='Property' and 'GroupSenderID'=@*[local-name()='Name']]/text()

So for example to list GroupReceiverID value ::
//*[local-name()='Property' and 'GroupReceiverID'=@*[local-name()='Name']]/text()

 

B2B message snippet

-------------------------------------------
<?xml version = '1.0' encoding = 'UTF-8'?>
<Transaction-810  XDataVersion="1.0"  Standard="X12"  Version="5010"  GUID="{38353832-3932-3330-3134-323936313736}">
<ns1:Internal-Properties>
<ns1:Data-Structure  Name="Interchange">
<ns1:Lookup  Name="InterchangeSenderID">THO123</ns1:Lookup>
<ns1:Property  Name="InterchangeSenderID">THO123</ns1:Property>
<ns1:Lookup  Name="InterchangeReceiverID">GEO456</ns1:Lookup>
<ns1:Property  Name="InterchangeReceiverID">GEO456</ns1:Property>
<ns1:Data-Structure  Name="Group">
<ns1:Lookup  Name="GroupSenderID">THO123</ns1:Lookup>
<ns1:Property  Name="GroupSenderID">THO123</ns1:Property>
<ns1:Lookup  Name="GroupReceiverID">GEO456</ns1:Lookup>
<ns1:Property  Name="GroupReceiverID">GEO456</ns1:Property>
<ns1:Data-Structure  Name="Transaction"/>
</ns1:Data-Structure>
</ns1:Data-Structure>
</ns1:Internal-Properties>
<ns1:Segment-ST>
<ns1:Element-143>810</ns1:Element-143>
<ns1:Element-329>#ControlNumber#</ns1:Element-329>
</ns1:Segment-ST>
<ns1:Segment-BIG>
<ns1:Element-373_1>20120910</ns1:Element-373_1>
</ns1:Segment-BIG>

……………………………….
<ns1:Segment-TDS>
<ns1:Element-610_1>391262</ns1:Element-610_1>
</ns1:Segment-TDS>

……………………

<ns1:Segment-SE>
<ns1:Element-96>#SegmentCount#</ns1:Element-96>
<ns1:Element-329>#ControlNumber#</ns1:Element-329>
</ns1:Segment-SE>
</Transaction-810>

Thanks To Girish for the help.

No comments: