Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
I have generated 3 csv files and the issue is that these files should have the same timestamp (currentTimeMillis) attached to them.
I have build 3 job for each of these files.
Example of file name should be :
Customers_EN_1512484811837.csv
Adresses_EN_1512484811837.csv
Dependants_EN_1512484811837.csv
Is there a way to save the timestamp and use them when defining the filename?
Also what is the syntax to get to timestamp millisecond?
Thank you for your help.
Best regards,
asadasing
At the beginning of your job place a tJava component. In that component, put the following code.....
String timeInMillis = routines.TalendDate.getCurrentDate().getTime()+""; globalMap.put("timeInMillis", timeInMillis);
Then, when you want to name your files, use the following code....
"Filename_"+((String)globalMap.get("timeInMillis"))+".txt"
Obviously change the hardcoded parts to match your requirement.
EDIT: Just noticed this is essentially what @TRF said. We seem to keep replying at the same time. Sorry, didn't see you had commented.
At the beginning of your job place a tJava component. In that component, put the following code.....
String timeInMillis = routines.TalendDate.getCurrentDate().getTime()+""; globalMap.put("timeInMillis", timeInMillis);
Then, when you want to name your files, use the following code....
"Filename_"+((String)globalMap.get("timeInMillis"))+".txt"
Obviously change the hardcoded parts to match your requirement.
EDIT: Just noticed this is essentially what @TRF said. We seem to keep replying at the same time. Sorry, didn't see you had commented.
Thank you for the quick reply.
Can you provide me the syntax for milisecond to insert inthe value field?
Regards,
asadasing
There is a subtle difference between what I showed and what @TRF is suggesting. The code I gave will return milliseconds after 1 Jan 1970, 00:00:00. The code @TRF has given will return a number representing years, months, days, hours, minutes, seconds, and milliseconds. Both are equally unique, but not the same.