Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating a Purchase Order in XML
Message
De
10/06/2003 00:30:16
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Web Services
Divers
Thread ID:
00798079
Message ID:
00798218
Vues:
20
To just expand a bit regarding your cursor and XML... use normalization to the fullest exent... a general rule to use in generating XML is to never go more than two 'indents' deep in a single cursor... more than that means you should be checking you data duplication.

Using your sample XML below, I see instances of several cursors you will need to effectively handle this task:

1. OrderHeader - Base Cursor
'POIssuedDate
'RequestedDeliveryDate
'
'

2. Order Party - Supplier (Can be in the cursor as above in that most order party info is unique to the above BuyerRefNum)
'
'

3. Order Party - Ship To Party (I recommend you keep this separate in that shipto may not
etc....


So you can see that the breakdown of 'indents' can help you structure your cursors....

HTH

Ric

>XMLTOCURSOR and CURSORTOXML will all all flexibility to convert
>XML to Cursor or Cursor to XML.
>
>Though with the mentioned example the data of both the file will come in one cursor.
>You need to apply normalization to divide in two tables or two cursors.
>
>Aashish
>
>>I need to add XML functionality to my application. I want to start by creating a purchase order via xml so my customers can send the PO elecronically to the vendor. I have a vendor that is willing to work with me as I develop this feature.
>>
>>The vendor sent me a sample xml document they receive from a client:
>>
>>
>><?xml version="1.0" encoding="utf-8"?>
>><PurchaseOrder>
>>	<OrderHeader>
>>		<POIssuedDate>20030318T193435</POIssuedDate>
>>		<RequestedDeliveryDate>20030318T193435</RequestedDeliveryDate>
>>		<OrderReference>
>>			<AccountCode>
>>				<Reference>
>>					<RefNum>1212909801</RefNum> (our trading partner’s ID)
>>				</Reference>
>>			</AccountCode>
>>			<BuyerRefNum>
>>				<Reference>
>>					<RefNum>Z78740</RefNum> (PO#)
>>				</Reference>
>>			</BuyerRefNum>
>>		</OrderReference>
>>		<OrderParty>
>>			<SupplierParty>
>>				<Party PartyID="18-710-1399"/> (our trade ID)
>>				<NameAddress>
>>					<Name1>Kaman Music Corporation</Name1>
>>				</NameAddress>
>>			</SupplierParty>
>>			<ShipToParty>
>>				<Party PartyID="2"/> (ID assigned to this location)
>>				<NameAddress>
>>                                <Identifier>
>>                                <Ident>DROP SHIP</Ident>
>>                                </Identifier>
>>                                <Attention>Mike Smith</Attention>
>>					<Name1>Mike’s Music</Name1>
>>					<Address1>2114 Tech Drive</Address1>
>>					<Address2/>
>>					<City>South Bend</City>
>>					<StateOrProvince>IN</StateOrProvince>
>>					<PostalCode>46628</PostalCode>
>>					<Country>United States</Country>
>>				</NameAddress>
>>			</ShipToParty>
>>		</OrderParty>
>>		<Payment>
>>			<PaymentTerm>Other</PaymentTerm>
>>			<PaymentTermOther>21</PaymentTermOther> (previously agreed upon terms – will discuss later)
>>		</Payment>
>>		<SpecialHandlingNote>4% FREIGHT ALLOWANCE  </SpecialHandlingNote>
>>		<Transport>
>>			<Carrier>Other</Carrier>
>>			<CarrierOther>1</CarrierOther> (carrier code. Ex: 1 = UPS)
>>		</Transport>
>>	</OrderHeader>
>>	<ListOfOrderDetail>
>>		<OrderDetail>
>>			<BaseItemDetail>
>>				<LineItemNum>1</LineItemNum>
>>				<BuyerPartNum>
>>					<PartNum>
>>						<PartID>17740</PartID> (your item id)
>>					</PartNum>
>>				</BuyerPartNum>
>>				<ManufacturerPartNum>
>>					<PartNum>
>>						<Agency AgencyID="Other">UPC</Agency>
>>						<PartID>00731201528238</PartID> (Item UPC code)
>>					</PartNum>
>>				</ManufacturerPartNum>
>>				<BackOrderItem>Y</BackOrderItem>
>>				<ItemDescription>LP LP637</ItemDescription>
>>				<Quantity>
>>					<Qty>3</Qty>
>>				</Quantity>
>>			</BaseItemDetail>
>>			<BuyerExpectedUnitPrice>
>>				<Price>
>>					<UnitPrice Currency="USD">123.45</UnitPrice>
>>				</Price>
>>			</BuyerExpectedUnitPrice>
>>		</OrderDetail>
>>		<OrderDetail>
>>			<BaseItemDetail>
>>				<LineItemNum>2</LineItemNum>
>>				<BuyerPartNum>
>>					<PartNum>
>>						<PartID>56600</PartID>
>>					</PartNum>
>>				</BuyerPartNum>
>>				<ManufacturerPartNum>
>>					<PartNum>
>>						<Agency AgencyID="Other">UPC</Agency>
>>						<PartID>00622537350054</PartID>
>>					</PartNum>
>>				</ManufacturerPartNum>
>>				<BackOrderItem>Y</BackOrderItem>
>>				<ItemDescription>Sabian 35005</ItemDescription>
>>				<Quantity>
>>					<Qty>1</Qty>
>>				</Quantity>
>>			</BaseItemDetail>
>>			<BuyerExpectedUnitPrice>
>>				<Price>
>>					<UnitPrice Currency="USD">123.45</UnitPrice>
>>				</Price>
>>			</BuyerExpectedUnitPrice>
>>		</OrderDetail>
>>	</ListOfOrderDetail>
>></PurchaseOrder>
>>
>>
>>It seems to me their are 2 major components: OrderHeader and ListOfOrderDetail.
>>
>>With my purchase order program the info that would go into orderheader is on the form in text boxes (Po#, Date, Address info, etc) and the info that would go into listorderdetail would be in a cursor (the line items to be ordered).
>>
>>The Vendor also sent me a list of the minimum requirements...but I won't display them here unless it would help.
>>
>>Will I be able to produce a document like this with CursorToXml()?
>>
>>It seems to me I would need to put all of the info in the cursor. However if I include the vendor#, date, etc in the cursor then it will be repeated for every lineitem?
>>
>>Can you point me in the right direction?
>>
>>Thank you in advance
>>
>>Paul Acton
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform