If you’re working with Talend Open Studio and would like to dynamically specify the name of a file you’re attempting to consume or output, refer to the following.
- Create a new tSetGlobalVar object
- Double-click the tSetGlobalVar object to open the Component tab.
- Within the Component tab, create a new key with the value “timestamp” and set the value to: TalendDate.getDate(“yyyy-MM-dd KK.mm.ss a”) // This will create a string with a value similar to “2012-01-04 04;06;54 PM”
- Double-click the file you wish to input/output.
- Under “File Name”, enter somwething similar to “C:/Talend/Projects/MYProject/My File ” + ((String)globalMap.get(“timestamp”)) + “.txt” // Obviously, replace the path, filename and file extension with whatever you’re working with. If requested, I will post some screen shots.
- That’s it!