Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
microstratege
Contributor
Contributor

How to create dynamic filename from a tMap output field?

Hi all,

I use tWaitForFile to start processing files in a directory. But how can I refer the found files? I read that the filename is saved in the global Variable (CREATED_FILE), but how should I use that in the next step (tFileInputXML) ?

Up to now each try results in an error.

Hope you have an idea, because I think that is a normal usage of processing the files found in tWaitFor File.

Kind regards, Detlev

Labels (3)
4 Replies
microstratege
Contributor
Contributor
Author

Sorry, title should refer to tWaitForFile. I just want to use the created file for a tMap.

Anonymous
Not applicable

Hi,

 

Could you please try below method?

0683p000009M3su.png

 

The component screenshots are as below.

0683p000009M4CO.pngtWaitForFile1

 

0683p000009M4CT.pngIf Condition

 

0683p000009M4CY.pngtFileInputFullRow1

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

microstratege
Contributor
Contributor
Author

Hi Nikhil,

thanks for your answer. After some tries I got a run without errors. I think the "Run if"-Component with the condition can be exchanged by the "OnSubjobOk"-link. The result is the same, but I mustn't use the condition.

Because the files I'm looking for are XML-Files I use the tFileInputXML instead of tFileInputFullRow. Hope that is still ok, because then I got the content in tLogRow as expected.

The problem I looked for a solution is to process all new files created in the directory. So I hope the usage of "continue loop" is the appropriate change. But after changing that parameter the process didn't create any output. Hope you can advice.

Kind regards,

Detlev

Anonymous
Not applicable

This is a slight modification of @nthampi's answer which solve your problem.

 

You will need a tWaitForFile connect via a Row link to a tFlowToIterate. Then connect your file component via an iterate link. If the Row connecting your tWaitForFile to the tFlowToIterate component is called "row1", then your tFlowToIterate will add your filename to the globalMap with a key of "row1.FILENAME". This can be used to call the file using ((String)globalMap.get("row1.FILENAME")).

 

Regarding "continue loop" I believe you have the right idea there.