Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
lec86042
Contributor
Contributor

Spreadsheet merge header row with body row

Hello Everyone,

 

This is my first time here so I apologize if this is not the right place to ask this question.  I am looking for help to merge several rows into a single row in a spreadsheet.  Here is an example of the input and the desired output:

 

InputFile.xlsx

0683p000009M9FR.png

OUTPUT.xlsx (or csv)

0683p000009M9FW.pngOutput

What components can I use to split the header which is the company ID and Name then use the ID with each invoice that starts each row with "IN".

 

Any help or suggestion is much appreciated.

(using talend studio 7.2)

Thank you in advance.

 

Labels (2)
1 Reply
Anonymous
Not applicable

Hi
To merge the company ID with the body content, my idea is to use one tFileInputExcel to read only the first two cells first, details:
tFileInputExcel--main(row1)-->tFlowToIterate--iterate--tJavaFlex--runIf--tFixedFlowInput--main--tHashOutput
on tJavaFlex:
in the begin part:
String c1="";
in the main part:
c1=(String)globalMap.get("row1.c1");
if(c1.startsWith("IN"){
globalMap.put("writeData",true);
}else{
globalMap.put("company_id",c1);
}

Set the condition of runIf as:
(Boolean)globalMap.get("writeData")

on tFixedFlowInput: generate the current flow with three columns:
company_id: (String)globalMap.get("company_id")
Document: IN
Type number: (String)globalMap.get("row1.c2")

tHashOutput: write the data in memory for used later. In next subjob, you can read back the data using tHashInput.

Hope it helps!

Regards
Shong