date and time format on created files
I have a requirement for a process to create a file with a date and time stamp in this format:
client_orders_YYYYMMDDHHMMSS.xls
but with the settings I can see, I can only create a file that also includes dashes and underscores, like this:
client_orders_06-18-2013_12-03-49.xls
Can you please tell me how I can further customize the file name format to the exclude the dashes and underscores?
-
There are certain predefined time stamp standard formats that we can use in the name of File Target activity but this Format of Time Stamp is not available. This scenario can be achieved by using a Custom Plugin activity. Below are the high level steps that you have to perform in Custom plugin to achieve this File Target Name:
Get the current date in any Standard Time Stamp format and convert it into the desired Time Stamp by using string functions. Then fetch the value of the file name in the context and append the converted timestamp to it and store this in any context variable.
Now use a Put-Context-Var activity just before the File Target and over-ride the File Name of the Target with that newly created variable in the Plugin.
0 -
Instead of a custom plugin, I created a context variable in my datamap that has the filename I want. So:
In my datamap, I created a global variable dateForFilename as:
Current-date('ddMMyyyyHHmmss')and then a Context Variable:
concat('ferring_hms_hcp_data_', $dateForFilename, '.txt')I have a PutContextVariable object after the schema for my text file with a variable defined as:
Activity: the Target File
Variable Name: fileName
Variable Value: $$contextFilename$$0
Post is closed for comments.
Comments
2 comments