One Star

tFileOutputMSDelimited -> can it exclude key columns in the output

Is there a way for the tFileOutputMSDelimited component to be configured in a way so that it excludes the key columns (used in matching with parent key columns) in the output.
see images attached.
1 - 6
Current Output
-----------------
OrderHeader,1,Warren
OrderDetailQty,1,1,wLf,92
OrderDetailQty,3,1,Z4U,38
OrderDetailQty,4,1,IrV,8
OrderDetailQty,7,1,OTo,98
OrderNotes,1,1,q2wwDthXWn
OrderNotes,3,1,ecZJtARKbB
OrderHeader,2,Ronald
OrderDetailQty,2,2,4Sw,17
OrderDetailQty,5,2,HKl,13
OrderDetailQty,6,2,jTh,39
OrderNotes,2,2,gq3cR7gC0b
Desired Output
-----------------
OrderHeader,1,Warren
OrderDetailQty,1,wLf,92
OrderDetailQty,3,Z4U,38
OrderDetailQty,4,IrV,8
OrderDetailQty,7,OTo,98
OrderNotes,1,q2wwDthXWn
OrderNotes,3,ecZJtARKbB
OrderHeader,2,Ronald
OrderDetailQty,2,4Sw,17
OrderDetailQty,5,HKl,13
OrderDetailQty,6,jTh,39
OrderNotes,2,gq3cR7gC0b
4 REPLIES
Community Manager

Re: tFileOutputMSDelimited -> can it exclude key columns in the output

Hi
It is impossible to exclude the parent key by configuring the tFileOutputMSDemilted component, you need to read the current output file again, regards it as a temp file, parse the file and output the result to a final desired file, here I show you how to do it:
in.csv:
OrderHeader,1,Warren
OrderDetailQty,1,1,wLf,92
OrderDetailQty,3,1,Z4U,38
OrderDetailQty,4,1,IrV,8
OrderDetailQty,7,1,OTo,98
OrderNotes,1,1,q2wwDthXWn
OrderNotes,3,1,ecZJtARKbB
OrderHeader,2,Ronald
OrderDetailQty,2,2,4Sw,17
OrderDetailQty,5,2,HKl,13
OrderDetailQty,6,2,jTh,39
OrderNotes,2,2,gq3cR7gC0b
out.csv:
OrderHeader,1,Warren
OrderDetailQty,1,wLf,92
OrderDetailQty,3,Z4U,38
OrderDetailQty,4,IrV,8
OrderDetailQty,7,OTo,98
OrderNotes,1,q2wwDthXWn
OrderNotes,3,ecZJtARKbB
OrderHeader,2,Ronald
OrderDetailQty,2,4Sw,17
OrderDetailQty,5,HKl,13
OrderDetailQty,6,jTh,39
OrderNotes,2,gq3cR7gC0b
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: tFileOutputMSDelimited -> can it exclude key columns in the output

Dear Shong: thanks for a quick response. I think it does exactly what I needed.
Your solution is a great workaround for a quite useful option which can be a part of the tFileOutputMSDelimited component itself.
In future, there could be an option or *feature* to choose the schema of the different output rows, thereby incorporating the filter column option within the component itself.
my 2 cents.
Pankul
One Star

Re: tFileOutputMSDelimited -> can it exclude key columns in the output

Hi,
i am new to talend, could anyone help me about the below task,
My Input is :
<?xml version="1.0" encoding="UTF-8"?>
<COMPANY>
<COMPANY_DETAILS>
<COMPANY_HEADER>
<COMPANYNAME>IBM</COMPANYNAME>
<COMPANYADDRESS>HYDERABAD</COMPANYADDRESS>
<COMPANYPHONE>9988776655</COMPANYPHONE>
</COMPANY_HEADER>
<EMPLOYEES>
<EMPLOYEE>
<EMP_ID>101</EMP_ID>
<EMP_NAME>SAN</EMP_NAME>
<EMP_DESIGNATION>SW</EMP_DESIGNATION>
<EMP_SALARY>50000</EMP_SALARY>
</EMPLOYEE>
<EMPLOYEE>
<EMP_ID>102</EMP_ID>
<EMP_NAME>SHAN</EMP_NAME>
<EMP_DESIGNATION>SW</EMP_DESIGNATION>
<EMP_SALARY>20000</EMP_SALARY>
</EMPLOYEE>
<EMPLOYEE>
<EMP_ID>103</EMP_ID>
<EMP_NAME>SANTH</EMP_NAME>
<EMP_DESIGNATION>SW</EMP_DESIGNATION>
<EMP_SALARY>8000</EMP_SALARY>
</EMPLOYEE>
</EMPLOYEES>
</COMPANY_DETAILS>
<COMPANY_DETAILS>
<COMPANY_HEADER>
<COMPANYNAME>CAP</COMPANYNAME>
<COMPANYADDRESS>BANGALORE</COMPANYADDRESS>
<COMPANYPHONE>9988776655</COMPANYPHONE>
</COMPANY_HEADER>
<EMPLOYEES>
<EMPLOYEE>
<EMP_ID>104</EMP_ID>
<EMP_NAME>SHIV</EMP_NAME>
<EMP_DESIGNATION>SW</EMP_DESIGNATION>
<EMP_SALARY>10000</EMP_SALARY>
</EMPLOYEE>
<EMPLOYEE>
<EMP_ID>105</EMP_ID>
<EMP_NAME>SHAKE</EMP_NAME>
<EMP_DESIGNATION>SW</EMP_DESIGNATION>
<EMP_SALARY>8000</EMP_SALARY>
</EMPLOYEE>
</EMPLOYEES>
</COMPANY_DETAILS>
<COMPANY_DETAILS>
<COMPANY_HEADER>
<COMPANYNAME>IMBPVT</COMPANYNAME>
<COMPANYADDRESS>CHENNAI</COMPANYADDRESS>
<COMPANYPHONE>9908778965</COMPANYPHONE>
</COMPANY_HEADER>
<EMPLOYEES>
<EMPLOYEE>
<EMP_ID>107</EMP_ID>
<EMP_NAME>SYDN</EMP_NAME>
<EMP_DESIGNATION>SW</EMP_DESIGNATION>
<EMP_SALARY>9000</EMP_SALARY>
</EMPLOYEE>
</EMPLOYEES>
</COMPANY_DETAILS>
</COMPANY>

i am excepting the below Output :
IBM,HYDERABAD,9988776655
101,SAN,SW,50000
102,SHAN,SW,20000
103,SANTH,SW,8000
3
CAP,BANGALORE,9988776655
104,SHIV,SW,10000
105,SHAKE,SW,8000
2
IBM PVT,CHENNAI,9908778965
107,SYDN,SW,9000
1
3,2,1 are the total records.
Thanks,
RK
Community Manager

Re: tFileOutputMSDelimited -> can it exclude key columns in the output

Hi rkalla
In order to get the expected output as you described, you need to store the COMPANY_HEADER data and EMPLOYEES data to memory or a temporary file first, and then iterate each COMPANY_HEADER data, I have created a demo job to achieve this:
IBM;HYDERABAD;9988776655
101;SAN;SW;50000
102;SHAN;SW;20000
103;SANTH;SW;8000
3
CAP;BANGALORE;9988776655
104;SHIV;SW;10000
105;SHAKE;SW;8000
2
IMBPVT;CHENNAI;9908778965
107;SYDN;SW;9000
1

if you would like to take a look at the demo job, please send me an email.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business