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.

Sorting dates, ignoring empty fields

Featured Replies

  • Newbies

I am trying to sort my database in a list view by a date field. But not all the fields are populated and not all of them necessarily will be.

Is there a way to sort the list by date (ascending order) and ignore the empty fields?

Do you need the records that don't have the dates?

If not, you could simply do your find on a range in the date field.

i.e.

>3/1/2006

Or

3/1/2006...3/31/2006

HTH

Lee

Another option is to set a calculation field if you want the empty fields to go to the end of the list (and not at the default of the beginning) and then you can sort on the calculation field (without actually displaying the Calc field)

Let's call it "DateCalc"

DateCalc =

If(DateField = ""; "1/1/2999"; DateField)

...and that way the empty dates go to the end of the date range.

Martha

  • Author
  • Newbies

Lee, that works better than what I was thinking. Thanks for the suggestion.

Brian

Please note that I'm fully with Lee, validations ought to have caught the empties

DateCalc =

If(DateField = ""; "1/1/2999"; DateField)

Provided the datefields are stored in textfields, but the advice has it's caveats, such sorting behave a tad more correctly in europe, where the format is DD/MM/YY ...but textfields sorts the opposite direction. So if you attempt's this are you bound to remember the reverse logic in descending being ascending.

Being honest would I not break out of the fieldtype if I were to choose. The idea of putting an incredible large date in the sort field however a good idea. But it ought to be done this way:

Case ( IsEmpty ( DateField );Date ( 1 ; 1 ; 2999 );Datefield )

Now previously have we made measures to mix dates, textfields and numbers, byt means of calcfields and perhaps even scripting to uniform the sortorder for these different kinds. But a clever chap has found a much better way to handle this:

http://www.filemakerpros.com/LessSort.sit (Macs)

http://www.filemakerpros.com/LessSort.zip (Windows)

--sd

  • 3 months later...

This is a great suggestion - thanks! I've been trying to solve this for a while now.

Thank you.

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.