Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Produce XLS file from XML file problem
Message
From
10/07/2019 06:30:24
 
 
To
10/07/2019 06:00:30
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01669410
Message ID:
01669491
Views:
46
>
>Hi António,
>
>I fully understand your point of view in the sense that I have to understand the behavior of the code that sent me, without this I always tread problems.
>I think I finally understood and attached your code that I changed.
>This is the change I made to the code:
>
>* this is just a subset of the line, just complete with the rest
>* NEW: added AddressDetail and TaxPercentage
>CREATE CURSOR xlsOutput (InvoiceNo Varchar(32), SystemEntryDate Datetime, ;
>	productCode Varchar(50), productDescription Varchar(200), ;
>	taxpayable Double, grosstotal Double, ;
>	taxpercentage Double, addressdetail Varchar(200), :
>	streetname varchar(100), City varchar(30), Postalcode varchar(60))
>
>
>
>I just wanted to ask you when I should use MSXML2.IXMLDOMNodeList, I think it will be when I have more than one row of the same document to be able to consider all rows belonging to it.
>This is the code t
>
>Thank you very much for your commitment and great help.

Luís,

Yes, that's the change you ought to make.

Regarding your (good!) question: when you SelectNodes() from the XML DOM, the method returns a list of nodes, even if it has only one member. When you expect one or more nodes, like invoices under SourceDocuments/SalesInvoices, or details under each Invoice, you'll have to consider all nodes (IXMLDOMNode) of the list (IXMLDOMNodeList). When you expect no more than one node, like the ShipTo address, or the Tax information, then you may extract directly the first item (base = 0) from list.

Since you want to flatten your data, you'll have to collect all information from the various points of the document and finally assemble it into a cursor row at the level you defined, in this case, at the detail line level.
----------------------------------
António Tavares Lopes
Previous
Reply
Map
View

Click here to load this message in the networking platform