Skip to main content

I have files in a folder. I want to select the files with a path_modified_date from the year prior. Example, if the path_modified_date contains "prior year" then zip these files. I know how to do the zip files part.

 

It is the If the path_modified_date contains "prior year" part that I am having trouble with. The files in question accumulate every year and I would like to set up an automation in FME Flow that runs every March and zips the files from the previous year. I know how to set up an automation.

 

Here is what I have done so far in FME Form. The Tester passed if @Value(path_modified_date) Contains 2022; If I use this workbench as is, every year I want to run the workspace I would need to go in and manually change the Right Value in the Tester to the prior year. I want to know if there is a way where I can automate this portion?

FME_Workbench_Screenshot_5I added a Year field to Attribute Manager takes the left 4 digits (the year) from the path_modified_date field. Then I changed the Right Value of the Tester Parameters to arithmetic, @Value(Year)-1), but it does not seem to work, maybe I am on the right track?

 FME_Workbench_Screenshot_6

If you want to keep using the Tester like you have, you could automate it this way:

 

Right Value would need to be set to arithmetic calculator and then just copy paste in:

@DateTimeFormat(@DateTimeNow(),%Y)-1

###@DateTimeNow() is the fme command to get the current Date and time based on the machine fme is being ran.

### %Y gets just the year date from DateTimeNow()

###@DateTimeFormat() makes it a datetime format

### then just subtract 1 year to get previous

image 

Example:

image


Would you happen to know a link that would show a list and explanation of FME Commands, like the @@DateTimeNow()?

 

It would be a great resource for me to refer to.


DateTime help panes

 

Arithmetic Editor

 

Text Editor - FME

 

All documentation from safe: https://community.safe.com/s/documentation

 

 


Reply