Hi ,
I am working on clover etl tool need to write an output into an xml file , currently i am using XMLWriter to do it but it is not solving my purpose i want the xml output in below fashion
<?xml version="1.0" encoding="ISO-8859-1"?>
<TranxRequest>
<NetworkID>50427</NetworkID>
<Details>
<CustomerName>XXXX</CustomerName>
<CustomerId>YYYY</CustomerId>
</Details>
<Details>
<CustomerName>aaaaa</CustomerName>
<CustomerId>asasada</CustomerId>
</Details>
</TransRequest>
But I am getting an output like
<?xml version="1.0" encoding="ISO-8859-1"?>
<TranxRequest>
<NetworkID>50427</NetworkID>
<Details>
<CustomerName>XXXX</CustomerName>
<CustomerId>YYYY</CustomerId>
</Details>
<NetworkID>50427</NetworkID>
<Details>
<CustomerName>aaaaa</CustomerName>
<CustomerId>asasada</CustomerId>
</Details>
</TransRequest>
The Network ID is repeating and i want it in my output xml onle single time
Looking forward for your advice
I am working on clover etl tool need to write an output into an xml file , currently i am using XMLWriter to do it but it is not solving my purpose i want the xml output in below fashion
<?xml version="1.0" encoding="ISO-8859-1"?>
<TranxRequest>
<NetworkID>50427</NetworkID>
<Details>
<CustomerName>XXXX</CustomerName>
<CustomerId>YYYY</CustomerId>
</Details>
<Details>
<CustomerName>aaaaa</CustomerName>
<CustomerId>asasada</CustomerId>
</Details>
</TransRequest>
But I am getting an output like
<?xml version="1.0" encoding="ISO-8859-1"?>
<TranxRequest>
<NetworkID>50427</NetworkID>
<Details>
<CustomerName>XXXX</CustomerName>
<CustomerId>YYYY</CustomerId>
</Details>
<NetworkID>50427</NetworkID>
<Details>
<CustomerName>aaaaa</CustomerName>
<CustomerId>asasada</CustomerId>
</Details>
</TransRequest>
The Network ID is repeating and i want it in my output xml onle single time
Looking forward for your advice
-
Hello,
can you show your graph? -
Hello Karan,
You can get the desired output:<?xml version="1.0" encoding="ISO-8859-1"?>
<TranxRequest>
<NetworkID>50427</NetworkID>
<Details>
<CustomerName>XXXX</CustomerName>
<CustomerID>YYYY</CustomerID>
</Details>
<Details>
<CustomerName>aaaaa</CustomerName>
<CustomerID>asasada</CustomerID>
</Details>
</TranxRequest>
with the following mapping:<Mapping element="TranxRequest" inPort="0">
<Mapping element="Details" inPort="1" key="NetworkID" parentKey="NetworkID" fieldsIgnore="NetworkID"/>
</Mapping>
In other words:
You need to have two edges, the first will contain only the NetworkID values, the second will contain NetworkID, CustomerName, and CustomerID values.
The values from both edges will be joined using parentKey="NetworkID", but the NetworkID value from the second edge will be hidden by specifying fieldsIgnore="NetworkID".
And, you also need to set useRootElement="false" (simply uncheck the default true value of the Use root element attribute.
Best regards,
Please sign in to leave a comment.
Comments 2