Skip to main content

I'm trying to develop a workbench that will only return records from Excel spreadsheets that are within 90 days from the current date when I run the workbench. I'd like to not have to enter the current date every time I run the workbench. Is there an expression I can use or a transformer to perform this.

Any help is greatly appreciated.

My dates are formatted as seen below.

20170525

20170624

20170708

20170902

dates.fmwt

Hi @ngstoke

you should be able to do this using relative dates and testing your dataset using a tester to extract your data that is within 90days of your request. I have attached a sample workflow that you can review

dates.fmwt


Use the TimeStamper transformer to get the current date and feed that to the FeatureReader to read the data based on that date. You need to trigger the TimeStamper with a Creator transformer.


dates.fmwt

Hi @ngstoke

you should be able to do this using relative dates and testing your dataset using a tester to extract your data that is within 90days of your request. I have attached a sample workflow that you can review

dates.fmwt

Thank you @ciarab I was able to modify your workflow and get the answers I was after.

 

Much appreciated

 


Hi @ngstoke

are you using FME 2017? With FME 2017 new datetime functionality, your workflow can be as simple as this:

If you are working with FME 2017.0 you will only have old TimeStamper - which will still do the job for you. In FME 2017.1 we have added new DateTimeStamper which is more powerful and user friendly. You can download FME 2017.1 beta from https://www.safe.com/support/support-resources/fme-downloads/beta/


@ngstoke

You can of course do it in a single transformer, just bit of tcl datecalcing needed...

In a tester test for

@abs(

[clock format [clock scan today] -format {%j}] - [clock format [clock scan {YourAttribute}] -format {%j}]

)<=90

Format you posted is basic format for cloc scan.

-format %j is days counting in 3 digits (which you could also use as input if needed )


Reply