julierme.victor
25th March 2015, 18:41
Good afternoon,

I will start to receive my orders in the company through xml files , someone has already made the consumption of xml files in ERP LN version 6.1 ?

Regards,
Julierme

bhushanchanda
25th March 2015, 20:30
Hi,

Go through the programmers guide on how to do it.

http://www.baanboard.com/programmers_manual_baanerp_help_functions_xml_api

You can make your own parser to read the XML file using inbuilt XML functions.

Here is a thread where it has been used. Hope it guides you.


http://www.baanboard.com/baanboard/showthread.php?p=193243

julierme.victor
31st March 2015, 14:13
Good Morning Bhushan,

Thanks for the help!

Regards,
Julierme

julierme.victor
31st March 2015, 14:28
Although now I'm with the following problem:

I have the following xml:

<root>
<orderId>v531228scl-01</orderId>
<sequence>531228</sequence>
<marketplaceOrderId></marketplaceOrderId>
<marketplaceServicesEndpoint>http://lojascala.vtexcommercestable.com.br/api/oms</marketplaceServicesEndpoint>
<sellerOrderId>00-v531228scl-01</sellerOrderId>
<origin>Marketplace</origin>
<affiliateId></affiliateId>
<salesChannel>1</salesChannel>
<merchantName />
<status>handling</status>
<statusDescription>Preparando Entrega</statusDescription>
<value>10637</value>
<creationDate>2015-02-06T23:04:15.936902-02:00</creationDate>
<lastChange>2015-03-26T17:04:47.0808934-03:00</lastChange>
<orderGroup>v531228scl</orderGroup>
<totals>
<id>Items</id>
<name>Items Total</name>
<value>9980</value>
</totals>
<totals>
<id>Discounts</id>
<name>Discounts Total</name>
<value>0</value>
</totals>
<totals>
<id>Shipping</id>
<name>Shipping Total</name>
<value>657</value>
</totals>
<totals>
<id>Tax</id>
<name>Tax Total</name>
<value>0</value>
</totals>
</root>


As you can see, I tag <totals> <\ totals> that is repeated a few times in the file, with the attributes ID, NAME and VALUE, any suggestions to make this reading?

I've tried putting reading with xmlFindFirst and then put inside the while, but he always reads the first record.

bhushanchanda
31st March 2015, 15:10
Hi,

Have you checked the mentioned threads?

In one of them, I am having similar structured XML file with multiple <title> tags.

e.g.

<channel>
<title>
</title>
<title>
</title>
..
</channel>
So, what I do is,

fromId= xmlFindFirst("channel", fx)
i = xmlGetNumChilds (fromId)
newId= xmlFindFirst("title", fromId)
ret = xmlGetData(newId,data)
data = "*****************" & data & "***************" & "\n"
while i > 0
newId = xmlGetRightSibling(newId)
j = xmlGetNumChilds(newId)
while j > 1
newId1= xmlFindFirst("title", newId)
ret = xmlGetData(newId1,data)
data.final = data.final & "\n" & trim$(data)
break
endwhile
i = i - 1
endwhile

I guess, you are using the same id for every xmlFindFirst.

You can recheck the code at this thread (http://www.baanboard.com/baanboard/showthread.php?p=193243)

julierme.victor
31st March 2015, 16:47
Hi Bhushan,

Thanks for your help!

Regards,
Julierme