Skip to main content

date and time format on created files

Comments

2 comments

  • David Paras

    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
  • David Paras

    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.