AnsweredAssumed Answered

Find most recent date in a scripted find

Question asked by Stu412 on Dec 22, 2015
Latest reply on Dec 22, 2015 by Extensitech

Hi there

 

I'm putting together a find routine which needs to return the most recent records based on a date that each one of them has.  The date is typically an annual anniversary and therefore is the same for many records, but with a different year.

 

I need to find only the most recent records, whatever the quantity.  So far, my find script is pretty simple:

 

  • Enter find mode
  • Set field [Customers::CustomerID_PK; $Variable1]
  • Set field [Customers::SaleCategory; $Variable2]
  • Perform find

 

This would return the following data:

 

CustomerID_PK          SaleCategory     AnniversaryDate

1217                           Fabrics               31/01/2014

1217                           Fabrics               31/01/2014

1217                           Dyes                  31/01/2014

1217                           Fabrics               31/01/2013

1217                           Fabrics               31/01/2013

1217                           Dyes                  31/01/2013

1217                           Fabrics               31/01/2015

1217                           Fabrics               31/01/2015

1217                           Dyes                  31/01/2015

 

How would I get this to return ONLY the 31/01/2015 data?  This cannot be a set value as these dates will vary between customers and could be any point in the year, so it needs to be the most recent (maximum?) date in this found set.

 

Thanks in advance guru's

Outcomes