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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] How to read the same file twice in a flow ?

I have a scenario in which I need to do the following:
1) Read File A - Based upon some data contained in the file create a record of type "PI01"
2) Read File A (Same File)- Based upon some data contained in the file create a record of type "AL01"
3) merge data of (1) and (2) and create an output XML
When I tried to map it as a Job, for (1) and (2), I used FielName: ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")) as per my Job diagram but when I run it,
get a run time exception saying that the (2) cannot get the FileName and is unable to read the record, There is no problem with (1)
Do you know how to achieve this scenario where I have to read the same file again and again, create several types of record and then merge all the records together
Thanks
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hello
Put your tFileInputDelimited, tMap, tFileOutputXML component in a child job.
eg:
On father job:
tFileList--iterate-->tRunJob(run the child job)
On child job:
tFileInputDelimited_1-->tmap-->tFileOutputxml
|
tFileInputDelimited_2
Define a context var called filename in child job.
On tRunJob, select the child job, add a parameter: filename on the 'context param' table and set the value as: ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))
on tFileInputDelimited_1, tFileInputDelimited_2, set the 'File Name' field with context var: context.filename
Best regards

shong

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Hello
Put your tFileInputDelimited, tMap, tFileOutputXML component in a child job.
eg:
On father job:
tFileList--iterate-->tRunJob(run the child job)
On child job:
tFileInputDelimited_1-->tmap-->tFileOutputxml
|
tFileInputDelimited_2
Define a context var called filename in child job.
On tRunJob, select the child job, add a parameter: filename on the 'context param' table and set the value as: ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))
on tFileInputDelimited_1, tFileInputDelimited_2, set the 'File Name' field with context var: context.filename
Best regards

shong
Anonymous
Not applicable
Author

thank you shong.. it works...