Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts,
I have the ff. components:
tMap -> tAdvanceFileOutputXML and here's the set-up:
How can I achieve the output below?
Current Output:
<textTabs> <text> <tabLabel>Hardware - Dell (Computers) Precision text</tabLabel> <value>Hardware - Dell (Computers) Precision</value> <locked>true</locked> </text> <text> <tabLabel>Computer text</tabLabel> <value>Computer</value> <locked>true</locked> </text> </textTabs> <textTabs> <text> <tabLabel>Hardware - Headset, Plantronics Other text</tabLabel> <value>Hardware - Headset, Plantronics Other </value> <locked>true</locked> </text> <text> <tabLabel>Headset text</tabLabel> <value>Headset</value> <locked>true</locked> </text> </textTabs>
Expected Output:
<textTabs> <text> <tabLabel>Hardware - Dell (Computers) Precision text</tabLabel> <value>Hardware - Dell (Computers) Precision</value> <locked>true</locked> </text> <text> <tabLabel>Computer text</tabLabel> <value>Computer</value> <locked>true</locked> </text> <text> <tabLabel>Hardware - Headset, Plantronics Other text</tabLabel> <value>Hardware - Headset, Plantronics Other </value> <locked>true</locked> </text> <text> <tabLabel>Headset text</tabLabel> <value>Headset</value> <locked>true</locked> </text> </textTabs>
Can you help me achieve the Expected Output?
Thank you.
Hi,
Unfortunately your current XML structure is not in a recommended way. You are trying to add both Asset type and Sub Asset type under same XML element "text" as sub elements. When your target system is trying to read the data, how will they differentiate the values of the data based on XML elements. In the current data structure everything is revolving under same XML element "text".
Similarly you need to name all the sub elements according to the data it is containing. Once the rename is correct, you will get more flexibility to read them. Without doing that, if you are trying to merge them, your target systems will have tough time to manage the data.
Also when the code is moved to production, your support team will find it very difficult to support the XML structure as every element is being same structure and name. I would highly recommend you to make these changes else it will create issues during later stages of your project.
Coming to the grouping part, you can convert the data to single XML layer format and read them as input to one more tXMLmap. In the second xml map, you can chnage the grouping at higher level. In this way, you can merge all data to single record.
Warm Regards,
Nikhil Thampi
Hi,
Could you please provide 10 input records with column headers in a csv file format so that we will get better understanding of data and testing also will be easy? Since at target side, you are planning to loop the input data from same row, it would be a good idea to bring them as separate records before converting them to XML.
Warm Regards,
Nikhil Thampi
Hi nikhilthampi,
Thank you for your feedback. Please see attached sample records and the full XML structure.
<!--expected XML output-->
<envelopeDefinition> <accountId></accountId> <status></status> <templateId></templateId> <templateRoles> <templateRole> <roleName>Employee</roleName> <tabs> <textTabs> <text> <tabLabel>Employee's First Name</tabLabel> <!--from 1st XML file--> <value>Jerome,</value> <locked/> </text> <text> <tabLabel>HKG2333 text</tabLabel> <!--from appended XML file--> <value>HKG2333</value> <locked>true</locked> <required>false</required> <senderRequired>true</senderRequired> <xPosition>73</xPosition> <yPosition>91</yPosition> </text> <text> <tabLabel>USA2222 text</tabLabel> <!--from appended XML file--> <value>USA2222 </value> <locked>true</locked> <required>false</required> <senderRequired>true</senderRequired> <xPosition>73</xPosition> <yPosition>107</yPosition> <documentId>1</documentId> <pageNumber>2</pageNumber> <font>arial</font> <fontSize>Size8</fontSize> <shared>true</shared> </text> <text> <tabLabel>Computer text</tabLabel> <!--from appended XML file--> <value>Computer</value> <locked>true</locked> <required>false</required> <senderRequired>true</senderRequired> <xPosition>130</xPosition> <yPosition>91</yPosition> </text> <text> <tabLabel>Headset text</tabLabel> <!--from appended XML file--> <value>Headset </value> <locked>true</locked> <required>false</required> <senderRequired>true</senderRequired> <xPosition>130</xPosition> <yPosition>107</yPosition> <documentId>1</documentId> <pageNumber>2</pageNumber> <font>arial</font> <fontSize>Size8</fontSize> <shared>true</shared> </text> <text> <tabLabel>Hardware - Computer - Dell (Computers) Precision, 5520 text</tabLabel> <!--from appended XML file--> <value>Hardware - Computer - Dell (Computers) Precision, 5520</value> <locked>true</locked> <required>false</required> <senderRequired>true</senderRequired> <xPosition>211</xPosition> <yPosition>91</yPosition> </text> <text> <tabLabel>Hardware - Headset, Plantronics Other, Voyager Focus UC text</tabLabel> <!--from appended XML file--> <value>Hardware - Headset, Plantronics Other, Voyager Focus UC </value> <locked>true</locked> <required>false</required> <senderRequired>true</senderRequired> <xPosition>211</xPosition> <yPosition>107</yPosition> <documentId>1</documentId> <pageNumber>2</pageNumber> <font>arial</font> <fontSize>Size8</fontSize> <shared>true</shared> </text> </textTabs> </templateRole> </templateRoles> </envelopeDefinition>
Also,I already tried the separate records before converting, but it only considered the last XML file that was generated.
Hi,
Unfortunately your current XML structure is not in a recommended way. You are trying to add both Asset type and Sub Asset type under same XML element "text" as sub elements. When your target system is trying to read the data, how will they differentiate the values of the data based on XML elements. In the current data structure everything is revolving under same XML element "text".
Similarly you need to name all the sub elements according to the data it is containing. Once the rename is correct, you will get more flexibility to read them. Without doing that, if you are trying to merge them, your target systems will have tough time to manage the data.
Also when the code is moved to production, your support team will find it very difficult to support the XML structure as every element is being same structure and name. I would highly recommend you to make these changes else it will create issues during later stages of your project.
Coming to the grouping part, you can convert the data to single XML layer format and read them as input to one more tXMLmap. In the second xml map, you can chnage the grouping at higher level. In this way, you can merge all data to single record.
Warm Regards,
Nikhil Thampi