Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Max function not working for date field

Featured Replies

I'm trying to get the most recent date in a particular field, across all my records. The field is Accessions:accession_date. The field is set to Date type. The date is not calculated, it's manually entered into the field when a new record is created (in some cases the field is empty when the accession date is unknown).

I tried Max (Accessions:accession_date) but every time I run the script, I get the date of the record I'm currently sitting on, not the max date of all records. What am I doing wrong?

You're expecting behavior from a function that isn't designed to work the way you want it to.

From help:

"Max(field{;field...})

Parameters

field - any related field, repeating field, or set of non-repeating fields; or an expression that returns a field, repeating field, or set of non-repeating fields.

Parameters in curly braces { } are optional."

One of Filemaker's glaring issues is that many functions don't work across found sets. Instead, you can use a Summary-type field which has an option for finding the Max of a found set.

There is no mentioning of a cartesian relation, and are we talking about Max( or the Summary function Maximum. You can have it either way - the cartesian with Max( over the relation, or the summary function which only will give the max for the found set.

--sd

One of Filemaker's glaring issues i

Why am I thinking of John Lennon here?:

Life is what happens when you are making other plans

Ehem, this is a database not a spreadsheet! Nowhere else in the RDBMS sphere exist nothing like calc'fields!

--sd

  • Author

Not trying to be dense but I don't understand what's meant by Cartesian, nor by a "summary-type field," and when I search the list of functions I find no mention of a "Maximum" function.

Edited by Guest

Perhaps it would be easier if you explained what are you actually trying to accomplish by this.

  • Author

Sure -- I have 2000+ records; each one has an accession date. I'm trying to find the most recent accession date across all records. I thought Max was the way to go but apparently not (and now I'm not even sure I understand what Max does LOL!). Thanks --

No, I meant why? What do you want to do with it after you have found it?

  • Author

Oh I see. Well, I want to then find the record(s) with that most-recent date, sort them based on a different field (in case there are more than one), get the last one in that sort order, and then display some info from it in a custom dialog.

Maybe I'm making it too hard. I suppose I could simply sort ALL the records by date and then just go to the last one. I thought of that but it seemed overkill to sort everything just to find one record. But maybe that would that be a better approach?

It may be a bit tedious, but any other approach would require adding either a summary field or a relationship.

For example, a summary field defined as Maximum of accession_date would return the last accession date in the found set (you'd still have to show all records before getting the value from the field).

OTOH, if you show all records and sort them by accession_date AND the other field, you don't need to do the find.

  • Author

OK, that makes sense. So in trying to make it easier I was actually making it harder! Will take a shot at doing it that way. Thanks.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.