Subject:XQuery sort & extract data Author:M Kline Date:25 Oct 2006 07:08 PM
Hello -
I'm new to XQuery but I was able to extract data from my existing XML document. The resulting XML is good, however because the Customer sends the XML with all <Value> elements, I'm not sure how to extract/pick...sorry for wrong terminology...only the elements that I want, then sort them because they're all <Value>.
I really only want the "Shipper's ID# for Shipment" value, the "Pay Item" value, the "Purchase Order Number" value, "Sellers Inv #" value, the "Invoice" value (which includes a date, quantity, piece price and part number), "Order Number" value, "Check Number" value, "Received" which is a date Value.....then sort that by the "Shipper ID Number".
Also, once I can get this done, can I somehow put this in a Word document so our Accounting Department can use it?
Here's an example of the resulting XQuery in hopes it makes more sense:
<xqr:xpath-query-result xmlns:xqr="http://www.stylusstudio.com/xpath-query-result">
<!-- Query Result: Element(s) -->
<Value Display="Remittance Information Only">I</Value>
<Value>60214.59</Value>
<Value Display="Credit">C</Value>
<Value Display="Automated Clearing House (ACH)">ACH</Value>
<Value Display="Vendor Payment">VEN</Value>
<Value Display="Current Transaction Trace Numbers">1</Value>
<Value>2006102053094</Value>
<Value Display="Transaction Creation" Function="UnknownItem">097</Value>
<Value>20061020</Value>
<Value>50039</Value>
<Value Display="Payer">PR</Value>
<Value>MYCUSTOMER</Value>
<Value Display="D-U-N-S Number, Dun & Bradstreet">1</Value>
<Value>123456789</Value>
<Value Display="Accounts Payable Department">AP</Value>
<Value>ACCOUNTING PERSON</Value>
<Value Display="Telephone">TE</Value>
<Value>1-555-555-5555</Value>
<Value Display="Electronic Mail">EM</Value>
<Value>blahblahblah@customer.com</Value>
<Value>1</Value>
<Value Display="Shipper's Identifying Number for Shipmen">SI</Value>
<Value>090838</Value>
<Value Display="Pay Item">PI</Value>
<Value>26.8</Value>
<Value Display="Purchase Order Number" Function="PONum">PO</Value>
<Value>00300000</Value>
<Value Display="Seller's Invoice Number" Function="UnknownItem">IV</Value>
<Value>ERS Invoice37209</Value>
<Value Display="Invoice" Function="UnknownItem">003</Value>
<Value>20061019</Value>
<Value>2000</Value>
<Value>0.0134</Value>
<Value>0001072000</Value>
<Value Display="Order Number" Function="UnknownItem">OQ</Value>
<Value>3725789</Value>
<Value Display="Check Number">CK</Value>
<Value>1166481</Value>
<Value Display="Received" Function="ReceivedDate">050</Value>
<Value>20061004</Value>
<Value Display="Shipper's Identifying Number for Shipmen">SI</Value>
<Value>090838</Value>
<Value Display="Pay Item">PI</Value>
<Value>5</Value>
<Value Display="Purchase Order Number" Function="PONum">PO</Value>
<Value>00300000</Value>
<Value Display="Seller's Invoice Number" Function="UnknownItem">IV</Value>
<Value>ERS Invoice37209</Value>
<Value Display="Invoice" Function="UnknownItem">003</Value>
<Value>20061019</Value>
<Value>1000</Value>
<Value>0.005</Value>
<Value>0001087000</Value>
<Value Display="Order Number" Function="UnknownItem">OQ</Value>
<Value>3725789</Value>
<Value Display="Check Number">CK</Value>
<Value>1166481</Value>
<Value Display="Received" Function="ReceivedDate">050</Value>
<Value>20061004</Value>
<Value Display="Shipper's Identifying Number for Shipmen">SI</Value>
<Value>090835</Value>
<Value Display="Pay Item">PI</Value>
<Value>132</Value>
<Value Display="Purchase Order Number" Function="PONum">PO</Value>
<Value>00300000</Value>
<Value Display="Seller's Invoice Number" Function="UnknownItem">IV</Value>
<Value>ERS Invoice37209</Value>
<Value Display="Invoice" Function="UnknownItem">003</Value>
<Value>20061019</Value>
<Value>500</Value>
<Value>0.264</Value>
<Value>0001134000</Value>
<Value Display="Order Number" Function="UnknownItem">OQ</Value>
<Value>3725786</Value>
<Value Display="Check Number">CK</Value>
<Value>1166481</Value>
<Value Display="Received" Function="ReceivedDate">050</Value>
<Value>20061004</Value>
<Value Display="Shipper's Identifying Number for Shipmen">SI</Value>
<Value>090835</Value>
<Value Display="Pay Item">PI</Value>
<Value>73.32</Value>
<Value Display="Purchase Order Number" Function="PONum">PO</Value>
<Value>00300000</Value>
<Value Display="Seller's Invoice Number" Function="UnknownItem">IV</Value>
<Value>ERS Invoice37209</Value>
<Value Display="Invoice" Function="UnknownItem">003</Value>
<Value>20061019</Value>
<Value>50</Value>
<Value>1.4664</Value>
<Value>0001140000</Value>
<Value Display="Order Number" Function="UnknownItem">OQ</Value>
<Value>3725786</Value>
<Value Display="Check Number">CK</Value>
<Value>1166481</Value>
<Value Display="Received" Function="ReceivedDate">050</Value>
<Value>20061004</Value>
<Value Display="Shipper's Identifying Number for Shipmen">SI</Value>
<Value>090833</Value>
<Value Display="Pay Item">PI</Value>
<Value>6.57</Value>
<Value Display="Purchase Order Number" Function="PONum">PO</Value>
<Value>00300000</Value>
<Value Display="Seller's Invoice Number" Function="UnknownItem">IV</Value>
<Value>ERS Invoice37209</Value>
<Value Display="Invoice" Function="UnknownItem">003</Value>
<Value>20061019</Value>
<Value>140</Value>
<Value>0.0469</Value>
<Value>0003035000</Value>
<Value Display="Order Number" Function="UnknownItem">OQ</Value>
<Value>3725784</Value>
<Value Display="Check Number">CK</Value>
<Value>1166481</Value>
<Value Display="Received" Function="ReceivedDate">050</Value>
<Value>20061004</Value>
<Value Display="Shipper's Identifying Number for Shipmen">SI</Value>
<Value>090833</Value>
..........then repeats with the next Shipper ID Number information, etc. until the end of the XML
--
To reply:stylus-studio-xquery.17322@stylusstudio.com
To start a new topic:stylus-studio-xquery@stylusstudio.com
To login:http://www.stylusstudio.com/SSDN/
To (un)subscribe:stylus-studio-xquery.list-request@stylusstudio.com