Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
vvazza10
Contributor III
Contributor III

Combining multiple tXMLMap output values to a single snowflake table

Hi ! I have the below XML structure as input

<dataexport>

<header>

<companyinfo>

<companyid> 100 </companyid>

<companyname>ABC Corp</companyname>

</companyinfo>

</header>

<deptinfo>

<electrical>

<response>

<deptid> 1 </deptid>

<totalemp> 200 </totalemp>

<totalunits> 20 </totalunits>

</response>

</electrical>

<mechanical>

<response>

<deptid> 2 </deptid>

<totalemp> 150 </totalemp>

<totalunits> 40 </totalunits>

</response>

</mechanical>

<chemical>

<response>

<deptid> 3 </deptid>

<totalemp> 100 </totalemp>

<totalunits> 20 </totalunits>

</response>

</chemical>

The output that i am expecting is

Company ID | Company name | Dept | Dept ID | Total emp

100 | ABC Corp | Electrical | 1 | 200

100 | ABC Corp | Mechanical | 2 | 150

100 | ABC Corp | Chemical | 3 | 100

The job design that i tried was

tFileInputXML -> tXMLMap -> tUnite -> tDBRow

 

 

 

0695b00000DuyNEAAZ.png 

How to combine outputs from deptinfo_electrical, deptinfo_mechanical, deptinfo_chemical to tUnite to have them all loaded to one single snowflake table?

2 Replies
tnewbie
Creator II
Creator II

Your ask will kind of defeat the purpose of XML, but to answer your question, Your best bet can be to have repeated instances of same target table, which means you will have 4 different pipe lines, each pipelines going to a target definition, but each of these target definitions will point to the same table.

vvazza10
Contributor III
Contributor III
Author

Thank you ! This is the approach I have decided to test with. Would it be possible to set up a generic job that will load a particular table by executing a particular part in tXMLMap based on parameter that was passed from the parent job?

 

Say I setup few tRunJob components that will take different Context param. The first tRunJob has context param as deptinfo and target table name as deptinfo_sf, and based on what parameter was set, I would want deptinfo in tXMLMap to get executed and load the target snowflake table. Is this achievable?