Skip to main content
Question

Find Min and Max values

  • November 5, 2025
  • 3 replies
  • 39 views

fblades
Contributor
Forum|alt.badge.img+1

I have a list of client records with a start-date and an end-date. In some cases there are multiple lines for a client, identical except for start-date and end-date. I need to somehow either concatenate them into one client record which contains the minimum start-date and the maximum end-date from each of those client’s records, or create a new client record for each client with the minimum start-date and the maximum end-date. All other data can be discarded in the process.

For example, I start with:
JohnDoe, startdate: 1 Jan 2024, enddate: 1 August 2024
JohnDoe, startdate: 3 Mar 2024, enddate: 31 August 2024

JohnDoe, startdate: 3 Mar 2024, enddate: 15 Dec 2024

DavidSmith, startdate: 1 Feb 2024, enddate: 15 Oct 2024

DavidSmith, startdate: 3 Mar 2024, enddate: 18 Oct 2024

 

And I want to end up with:

JohnDoe, startdate_min: 1 Jan 2024, enddate_max: 15 Dec 2024

DavidSmith, startdate_min: 1 Feb 2024, enddate_max: 18 Oct 2024

 

I have managed to create a really intricate and clunky solution which kinda works - but I would like a slick reliable solution which can cope with multiple clients each with multiple dates.

Any ideas?

 

 

3 replies

liamfez
Influencer
Forum|alt.badge.img+44
  • Influencer
  • November 5, 2025

The Aggregator paired with a ListRangeExtractor may do what you are wanting. You can aggregate based on some client ID/Name and then build a list of the dates. The ListRangeExtractor then outputs minimum and maximum.

You will want to check what type the attribute that stores the date is (is it string or date?) and may need the DateTimeConverter.


geomancer
Evangelist
Forum|alt.badge.img+60
  • Evangelist
  • November 6, 2025

The StatisticsCalculator seems to work as well:

  • GroupBy: Name
  • Attribute StartDate: Min
  • Attribute EndDate: Max

hkingsbury
Celebrity
Forum|alt.badge.img+65
  • Celebrity
  • November 6, 2025

I find dealing with comparing date times to be much easier when converted to epochs. You can then numerically sort them, and even ‘map’ them and use spatial operations on them!