pass dynamic value of a context variable in param file
I've one job which creates a file and puts into output folder. After that I calls other job to move file from output to archive folder. It works fine. My requirement is for moving the file from output to archive folder I'm using tfilecopy component. And in that tfilecopy the destination field path is coming from param file.
For example: File Name: ((String)globalMap.get(tfilelist_1_CURRENT_FILEPATH)) Destination: context.archive
Value of context variable archive in param file is like this archive=D:/Files/Archive/
Upto this point file comes in output folder and after that moved into archive folder. The job runs daily and creates some files in output folder. I want to store every day files in their respective folders with the date name into archive folder.
For example..Let say my job runs on 1 Sept 2016 and generates two files in output folder. I want to move that files from output folder to folder with folder name "1-09-2016" that should be created at run time in archive folder. And so on..
I know that can be done in if I pass value in Destination filed in tfilecopy like this "D:/Files/Archive/"+Talend.getDate("yyyy-MM-dd")+" My question is that possible I could pass this value from param file ? like this archive=D:/Files/Archive/"+Talend.getDate("yyyy-MM-dd")+" Any suggestion ?
Re: pass dynamic value of a context variable in param file
...be acceptable in your tFileCopy component? The getDate function in your flat file will just be handled as a String when you import it as a context variable. But, unless there is a reason for not generating the date part in your job, using the code above should work for you.