
Anonymous
Not applicable
2011-08-02
09:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
File name with a timestamp
Hi,
I have one question.
I want to give my file's name with a time stamp
It will be like "filename_yyyyMMdd_HHmm.dat"
But I have to find this file again in the job so, I want to store the "yyyyMMdd_HHmm" value in a context or variable.
and assign that context or variable to the file name.
Can you direct me how it can be done???
I've tried making a context of type string whose value is TalendDate.formatDate("yyyyMMdd_HHmm",TalendDate.getCurrentDate())
But when i run it i got a file not found exception (I'm to create a file not find for the first time).
and I think the context returns as a string of "TalendDate.formatDate("yyyyMMdd_HHmm",TalendDate.getCurrentDate())" not the actural date time value.
Thank You.
I have one question.
I want to give my file's name with a time stamp
It will be like "filename_yyyyMMdd_HHmm.dat"
But I have to find this file again in the job so, I want to store the "yyyyMMdd_HHmm" value in a context or variable.
and assign that context or variable to the file name.
Can you direct me how it can be done???
I've tried making a context of type string whose value is TalendDate.formatDate("yyyyMMdd_HHmm",TalendDate.getCurrentDate())
But when i run it i got a file not found exception (I'm to create a file not find for the first time).
and I think the context returns as a string of "TalendDate.formatDate("yyyyMMdd_HHmm",TalendDate.getCurrentDate())" not the actural date time value.
Thank You.
1,748 Views
- « Previous Replies
-
- 1
- 2
- Next Replies »
18 Replies

Anonymous
Not applicable
2011-08-02
09:56 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Kyaw,
you have to set the content of the context variable in the running job by using the "Context Load" component.
At the start of the job insert a tFixedFlowInput Component and a "Context Load" Component.
Establish a "main" link from fixedFlowInput to the ContextLoad and set the schema of the fixedFlowInput equal to the ContextLoad.
In the fixedflowInput enter one row. In the "key" Field enter a String with the name of your context variable. In the value field enter the Expression TalendDate.formatDate("yyyyMMdd_HHmm",TalendDate.getCurrentDate()).
When you run the job, the context will be set dynamically with the actual time in the given format.
you have to set the content of the context variable in the running job by using the "Context Load" component.
At the start of the job insert a tFixedFlowInput Component and a "Context Load" Component.
Establish a "main" link from fixedFlowInput to the ContextLoad and set the schema of the fixedFlowInput equal to the ContextLoad.
In the fixedflowInput enter one row. In the "key" Field enter a String with the name of your context variable. In the value field enter the Expression TalendDate.formatDate("yyyyMMdd_HHmm",TalendDate.getCurrentDate()).
When you run the job, the context will be set dynamically with the actual time in the given format.
1,177 Views

Anonymous
Not applicable
2011-08-02
10:17 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Or you could make a context variable - I called it filename (String).
and before you save the file add a tjava component. In this component paste the following Code
and whenever you need to use the name simply just use it as you would a normal context by typing context.filename
Or you could make a context variable - I called it filename (String).
and before you save the file add a tjava component. In this component paste the following Code
context.filename = "filename_"+TalendDate.getDate("yyyyMMdd_HHmm")+".dat";
and whenever you need to use the name simply just use it as you would a normal context by typing context.filename
1,177 Views

Anonymous
Not applicable
2011-08-02
10:24 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Kyaw Lwin Phyo,
so first of all I created tLoop, context variable named timeStamp, then somewhere in process I asigned it the value of current time using tJava component and connected it to the first iteration
then I just used tRowGenerator to generate random ascii values for the tFileOutputDelimited and that's it.
Ladislav
so first of all I created tLoop, context variable named timeStamp, then somewhere in process I asigned it the value of current time using tJava component and connected it to the first iteration
context.timeStamp = TalendDate.formatDate("yyyyMMdd_HHmmssSSS",TalendDate.getCurrentDate());
then I just used tRowGenerator to generate random ascii values for the tFileOutputDelimited and that's it.
Ladislav
1,177 Views

Specialist III
2015-01-29
02:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Instead, No need of Context Variable or Context load component.
Directly provide the expression in the filename property - it works
"D:/filedirectory/fileout_"+TalendDate.formatDate("yyyyMMdd_HHmm",TalendDate.getCurrentDate())+".csv"
Directly provide the expression in the filename property - it works
"D:/filedirectory/fileout_"+TalendDate.formatDate("yyyyMMdd_HHmm",TalendDate.getCurrentDate())+".csv"
1,177 Views

Specialist III
2015-04-14
11:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Instead, No need of Context Variable or Context load component.
Directly provide the expression in the filename property - it works
"D:/filedirectory/fileout_"+TalendDate.formatDate("yyyyMMdd_HHmm",TalendDate.getCurrentDate())+".csv"
A W E S O M E !
1,177 Views

Anonymous
Not applicable
2015-04-14
01:38 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if u want ur output file with time stamp try this one:
1,177 Views

Anonymous
Not applicable
2016-03-30
03:21 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Instead, No need of Context Variable or Context load component.
Directly provide the expression in the filename property - it works
"D:/filedirectory/fileout_"+TalendDate.formatDate("yyyyMMdd_HHmm",TalendDate.getCurrentDate())+".csv"
It worked perfectly. Thank You
1,177 Views

Anonymous
Not applicable
2016-04-20
08:41 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do we have any option for giving regular expression in file path
1,177 Views

Anonymous
Not applicable
2019-02-21
05:32 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you please let me know how can we append the date to the file name in cst format?
1,178 Views

- « Previous Replies
-
- 1
- 2
- Next Replies »