pass dynamic value of a context variable in param file

One Star

pass dynamic value of a context variable in param file

HI

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 ?
Community Manager

Re: pass dynamic value of a context variable in param file

Would ...
context.archive+Talend.getDate("yyyy-MM-dd") 

...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.

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download