Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6173343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:33:20+00:00 2026-05-23T23:33:20+00:00

I think I already know the answer, but I’m going to ask the question

  • 0

I think I already know the answer, but I’m going to ask the question anyway…

I have a table where I’m sorting rows by dueDate ascending. Some records have due dates, some don’t (nil). I prefer to show all the rows with due dates before those that don’t.
Example: Jan 1, 2011; Feb 1, 2011; June 1, 2011; nil; nil; nil

However, the default sorting puts the nil values first, as expected:
nil; nil; nil; Jan 1, 2011; Feb 1, 2011; June 1, 2011

I tried using an NSComparisonResult block in a sort descriptor and besides having some difficulty actually getting it to fire (probably due to some logic elsewhere – I am toggling different sorts in the same view), I can’t get it to actually compare the null key values to the ones with dates. I think this makes sense, as the managed objects whose @”dueDate” keys are null are more or less skipped over by the comparison for those where there are actually objects to compare.

At this point, I believe my only option is to hack through this and make the “no due date” records set to have a date far into the future, eg Jan 1, 3000. Anywhere that 1/1/3000 date might be shown, hide the value as if it were actually null.

Does this sound right and reasonable?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T23:33:21+00:00Added an answer on May 23, 2026 at 11:33 pm

    I solved this problem as I suggested in the above comment: [NSDate distantFuture]. So far it has been working in my app consistently, and I have no reason to believe it will stop working this way in the future… or even distant future.

    In places where I would normally use a nil value, I set the dat to distantFuture and filtered by that value as appropriate in the app.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think I already know the answer to this but thought I would ask
I think I already know the answer to this question is No, but I
I think i already know the answer to this, but i cannot find anything
I've been doing some research and I think I know the answer already, but
I think I might already know the answer to this one but I need
I think I already know the answer to this, but I'm currently working on
I think I already know the answer to this question because it seems, uh,
I think I already know the answer, but just to make sure. I am
I think I might already know the answer, but here goes. I want to
I have this question you probably know the answer... My app is already functional

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.