Skip to main content

Hi all,

in a SDF file, i have a date field and I would like filter/extract the record(s) with the latest date. What transformer/parameter should I use?

eg.

ID, DATE

1, 12-13-15

2, 12-13-15

3, 12-01-15

4, 08-01-14

5, 04-01-13

--------------------------

I would like to extract/filter ID 1 and 2 (records with the latest date) in this case.

thank you!!!

W

I would use the StatisticsCalculator to get the max_date in an attribute. Make sure you connect to the complete output port. You may have to use DateFormatter if the date fileld is of a string type instead of an actual date.

Then you can use a Tester to test if data = max_date.

That should give you all features that carry max_date as a date.


I would use the StatisticsCalculator to get the max_date in an attribute. Make sure you connect to the complete output port. You may have to use DateFormatter if the date fileld is of a string type instead of an actual date.

Then you can use a Tester to test if data = max_date.

That should give you all features that carry max_date as a date.

Two minor reminders:

- DateFormater over writes the original date so you might want to use AttributeCreator to copy the date first.

- make sure you create the format YYYYMMDD

(format string %Y%m%d) so that StatisticsCalculator actually finds the correct maximum date.


Reply