I have an FME workspace (FME 2015.1) that creates an output file, let's say result.xslx. What I would like to do is to build up the output file name from various parameters, e.g. the project name and the creation date like myprojectname_result_20161017.xlsx.

Obviously, the DestDataset_... published parameters cannot be built in such way using the TextEditor like $(project)_result_@timestamp(yyyymmmdd).xlsx. Promising approach is to build up a text published parameter and use this as a source for the DestDataset_... published parameter.

Where the project name is no problem to achieve, I am not able to access the actual date like described in the above way in creating published parameters. So the problem can be reduced to the question:

In FME, how to automaticaly insert the actual date (timestamp) into a text format published parameter?


A TimeStamper will create an attribute with yyyymmdd. Next you can fanout on both filename and sheetname:

enter image description here enter image description here

| improve this answer | |

The Fanouts are a great idea - probably the easiest way. However, you can also use parameters.

The FME advanced training manual has a section (Shared Parameters) that shows how to embed one parameter inside another, like so:

Output File: $(OutputFolder)\$(Username).txt

To get the date you would use a Scripted Parameter. That can be a TCL or Python script that carries out an action and returns a value.

For example, here's a code snippet that returns a path depending on which platform you are running on:

if {[string match 'C:*' $FME_MacroValues(FME_HOME)]} {
    set realname 'C:\Output\'+$FME_MacroValues(UserFileName)
} else {
    set realname '/Output/'++$FME_MacroValues(UserFileName)

return realname

You would just need to use some sort of Python/TCL function to capture the current date and time. I don't know what it would be off hand, but I'm sure there is such a function.

That way you can build up quite a complex output path, perhaps using a combination of embedded parameters and scripted parameters - plus any other sort of parameter you like. For example:

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.