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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
BA621858188
Creator
Creator

Generate Header after creation of file

Hi Team,

I wanted to generate a custom header after the creation of a file and not before file creation. How can I achieve this?

Thanks in advance.

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

After the creation of a file, read the file content as a string using tFileInputRaw, pass it to tJavaRow and store the content string as a global variable, eg:

globalMap.put("content",input_row.content.toString());

 

In the next subjob, generate a head string on tFixedFlowInput, pass it to tJavaRow and concatenate the header string with the file content string, eg:

output_row.columnName=input_row.columnName+"\r\n"+(String)globalMap.get("content");

 

Generate a new file using tFileOutputRaw, the job design looks like:

tFileInputRaw--main--tJavaRow

|onsubjobok

tFixedFlowInput--main--tJavaRow--tFileOutputRaw.

 

Regards

Shong

 

View solution in original post

3 Replies
Anonymous
Not applicable

Hello,

Could you please elaborate your case with an example with input and expected output values?

Best regards

Sabrina

Anonymous
Not applicable

After the creation of a file, read the file content as a string using tFileInputRaw, pass it to tJavaRow and store the content string as a global variable, eg:

globalMap.put("content",input_row.content.toString());

 

In the next subjob, generate a head string on tFixedFlowInput, pass it to tJavaRow and concatenate the header string with the file content string, eg:

output_row.columnName=input_row.columnName+"\r\n"+(String)globalMap.get("content");

 

Generate a new file using tFileOutputRaw, the job design looks like:

tFileInputRaw--main--tJavaRow

|onsubjobok

tFixedFlowInput--main--tJavaRow--tFileOutputRaw.

 

Regards

Shong

 

BA621858188
Creator
Creator
Author

Thanks @Shicong Hong​  It worked.