Hello,
I am preparing an integration with an external application based on the XML files (one direction, import only) and I thought that it will be possible to use the Data Management and Composite Entity, but now I have doubts about it.
First thing is that the XML structure is not always the same, some tags are optional and if they are empty the XML is generated without them. So <CustomerRef> can exist, but there can be files without it. I found THIS topic where Martin explained that the tag must be in the file once it is in the mapping. Anything changed in that kind of case or I have to prepare an XSLT file to transform the file before the import?
The second question is about handling the "empty" sections like in the example below. The <Lines> section has no value itself, it only contains multiple <Line> elements. What is the best practice to handle that case? I could create the "Lines" entity with only the "SalesNumber" field related to the parent's element value, but then it will want me to map this field in the source file (where it doesn't exist) and I don't want that at it should be populated based on the relation. But it will require having at least one field mapped, so I could create another field with mapping to the default value. So it is getting messy.
Should I still try to get this working using the Composite Entities, should I prepare a custom import function for this or there is any other option to recommend?
I have no impact on how the generated files look like and they won't be changed/adjusted by the vendor.
Thank you in advance.
<?xml version="1.0" encoding="utf-8"?>
<Document>
<SalesOrder>
<SalesNumber>SO-0001</SalesNumber>
<SalesDetails>
<OrderType>Journal</OrderType>
<CustomerRef>Note</CustomerRef>
</SalesDetails>
<Lines>
<Line>
<LineNum>1</LineNum>
<PackDetails>
<Weight>10</Weight>
</PackDetails>
</Line>
<Line>
<LineNum>2</LineNum>
<PackDetails>
<Weight>10</Weight>
</PackDetails>
</Line>
</Lines>
</SalesOrder>
</Document>