|
FOROS PROFESIONALES WINDEV, WEBDEV y WINDEV Mobile |
| | | | | |
| Iniciado por kel, 20,dic. 2019 01:34 - 2 respuestas |
| |
| | | |
|
| |
| Publicado el 20,diciembre 2019 - 01:34 |
Hi I am having trouble with XML. I have imported and xsd file (All good) -<MainRoot> -<Consignment> <ConsignmentNumber>CPA3AY0080235</ConsignmentNumber> <ConsignmentDate>2019-12-17</ConsignmentDate> <SenderName>Coty Australia Pty Ltd - CB</SenderName> <SenderStreetAddress>LEVEL 31</SenderStreetAddress> <SenderStreetAddress1/> <SenderSuburb>SYDNEY</SenderSuburb> <SenderState>NSW</SenderState> <SenderPostcode>2000</SenderPostcode> <Pickup>No</Pickup> <Delivery>Yes</Delivery> <DangerousGoods>YES</DangerousGoods> <ReceiverName>Chemist WH Vic Point B157</ReceiverName> <ReceiverStreetAddress>Shopj02 Victoria Point Lakesid</ReceiverStreetAddress> <ReceiverStreetAddress1>11-13 Bunker Road</ReceiverStreetAddress1> <ReceiverSuburb>VIC POINT</ReceiverSuburb> <ReceiverState>QLD</ReceiverState> <ReceiverPostcode>4165</ReceiverPostcode> <TimeSlotDate>2019-12-11</TimeSlotDate> <TimeSlotDate2>2019-12-20</TimeSlotDate2> <Comments>2019-12-11 To 2019-12-20</Comments> <ChargeTo/> <CarrierService>BEP</CarrierService> <TotalWeight>57.626</TotalWeight> -<LoadDetails> <ItemReference>26498223512</ItemReference> <NumberOfUnits>1</NumberOfUnits> <LogisticUnit>CARTON</LogisticUnit> <Weight>7.992</Weight> <Length>0.275</Length> <Width>0.380</Width> <Height>0.245</Height> <Cubic>0.026</Cubic> </LoadDetails> -<LoadDetails> <ItemReference>264982235</ItemReference> <NumberOfUnits>1</NumberOfUnits> <LogisticUnit>CARTON</LogisticUnit> <Weight>2.564</Weight> <Length>0.275</Length> <Width>0.380</Width> <Height>0.245</Height> <Cubic>0.026</Cubic> </LoadDetails> -<LoadDetails> <ItemReference>2649822356</ItemReference>
I use the following code FOR EACH LoadDetails OF xmldocumnentone.MainRoot detcons.LineNumber = nCurrentlinenumber nCurrentlinenumber ++ detcons.id = sTempid detcons.Reference = Consignment.LoadDetails.ItemReference detcons.Items = Consignment.LoadDetails.NumberOfUnits detcons.Description = Consignment.LoadDetails.LogisticUnit detcons.weight = Consignment.LoadDetails.Weight rSLenstring = Consignment.LoadDetails.Length rSWidthstring = Consignment.LoadDetails.Width rSHeightstring = Consignment.LoadDetails.Height detcons.Length = (rSLenstring * 1000) detcons.Width = (rSWidthstring * 1000) detcons.Height = (rSHeightstring * 1000) detcons.LineCubic = Consignment.LoadDetails.Cubic detcons.LabelsPrinted = 1 Cons.CUBIC += detcons.LineCubic HAdd(detcons) The problem is it keeps reading the same record over and over any help would be grate |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 52 mensajes |
|
| Publicado el 20,diciembre 2019 - 09:56 |
after the last line "<ItemReference>2649822356</ItemReference>" you must "close" the XML, so you must have
<ItemReference>2649822356</ItemReference> </LoadDetails> </Consignment> </MainRoot>
also I think you can not use:
FOR EACH LoadDetails OF xmldocumnentone.MainRoot
because MainRoot doesn't owns a node "LoadDetails", but "Consignment" so you must use
for each Consignment OF xmldocumnentone.MainRoot
or
for EACH LoadDetails OF xmldocumnentone.MainRoot.ConsignmentMensaje modificado, 20,diciembre 2019 - 10:20 |
| |
| |
| | | |
|
| | |
| |
| Publicado el 23,diciembre 2019 - 09:33 |
hi it takes the same record again and again . Walk through it withthe debeugger and you will see that
use : Consignment.LoadDetails[ counter ].ItemReference
in your case I guess ===> nCurrentlinenumber ==> Consignment.LoadDetails[ nCurrentlinenumber ].ItemReference
regards |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|