Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Produce XLS file from XML file problem
Message
From
10/07/2019 01:44:14
 
 
To
09/07/2019 19:20:29
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01669410
Message ID:
01669487
Views:
47
>>>>I urgently need an help to generate an excel file from the XML file I attached.
>>>>The problem is when the same invoice in XML has more than one row.
>>>>I do not know how to write in the current code a While loop so that while the invoice does not change it adds a new line.
>>>>I ask for your help and attach the XML file and the current excel file it produce, and also the excel i need to produce.
>>>>
>>>
>>>Luís,
>>>
>>>Without using transformations or schemas, you can peek the different pieces of the invoice information and assemble them to produce the final XLS lines.
>>>
>>>The SELECTs and BROWSEs are for checking purposes only. Replace them with code that will mount the line.
>>>
>>Hello António,
>>
>>I have a problem because i need to pass to my excel file the content of TAG :
>>ShipTo/Address
>>I need information for TAGs, StreetName + AddressDetail + City + PostalCode + Region + Country.
>>And Also the content of TAG Tax With information of : TaxCountryRegion + TaxPercentage.
>>
>>I try to do some changes on your code but without sucess.
>>
>
>Luís,
>
>What was inserted to gather the information that you require is preceded by a "NEW" comment.
>
>You must understand what is being done or else you'll need to come back here whenever you require extra data from the XML, and that does not make much sense.
>
>I hope that this extended version will help you with that. In any case, I prefer to discuss the process and help you understand how to extend and adapt to your requirements.
>

>
>Hello António,
>
>Your are almost there Tax is OK, but Address are in one column :
>Rua dos Barbeitos n 335 Hab 1.1 4400-377 Vila Nova de Gaia
>i need to create these columns in Excel:
> StreetName + AddressDetail + City + PostalCode + Region + Country
>Theses columns are chields of Address TAG.
>
>Please save my day..!!
>
>Best regards,
>Luis

Luís,

I'm almost there?

As I said, you have to make an effort to understand what the code is doing.

It fetches whatever data is stored in specific compost elements of the XML document at the invoice and detail levels with a DOM SelectNodes() method call, transfers the data to a temporary cursor with XMLTOCURSOR(), and SCATTERs to a buffer which is only a memory representation of the cursor and, by extension, of the XML element.

When all the required information is retrieved, it can be GATHERed into a row of the final cursor.

The other address components you require are already in the address buffer. As soon as you create the fields in the cursor, at the first statement of the code (quote; "just complete with the rest"), they too will be transferred to the final result as addressdetail already was.

Do that, and you'll get there...
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform