Tinderbox Forum

That pesky Date attribute in sorting when it's empty

I have a fair amount of my data that has dates. I often use dates for sorting. This is fine, unless the date attribute is not set. When I sort by date I can go from oldest to newest or vice versa. However, in my use case scenario never usually means older than the oldest date set. But, never never sorts that way. It always sorts never separately.

Is there a way to change this behaviour?

Let me give an example.

I have a list of people that I need to call regularly. I can sort this list by my DateCalled attribute and set it so that those who were called less recently appear at the top of that list. There are also people that I have not yet even called. They have no DateCalled attribute set and should ideally be right at the top of the list, but sort does not allow that. It seems that never is listed by the most recently contacted. TBX sorts like the below:

Call List
- Fred [60 days ago]
- Jane [45 days ago]
- Harold [30 days ago]
- Jill [never]

Why isn’t Jill at the top and more importantly can I put her there somehow?

For the time being those not yet called get an arbitrary old date set in the attribute.

Lots of people regard missing dates as missing data, and want them sorted separately; there was a long forum discussion about date comparison and never a few years ago.

One common approach to your sorting conundrum is to choose a sentinel value — a date which is well into the past or well into the future, and which you intend semantically to mean “long ago” or “long from now”.

In your case, I might have a numeric attribute $LastPhoneCall, which is typically set to days($DateCalled,date("today")). If $DateCalled is ‘never’, we can set $LastPhoneCall to 1000.

1 Like

Thank you sir! I have done something smilar with a stamp. I also appreciate than an unfilled date can have different meanings depending on context. Might be nice though, to have an option in the sort panel to allow never to sort both ways.

1 Like