Calendar Popup Fallback Value

How do you set a fallback value of null or none for a calendar popup in SQL query binding? This is on Vision

This is an interesting question. If the date is nonsense, then it would be better to have the calendar's textfield blank, and a null value makes that happen.

Unfortunately, the closest the binding fallback value can get to being null is blank, but this results in the Unix epoch being displayed in the calendar. My first idea would be to use the propertyChange event to drive a null value into the date property any time the date changes to January 1st 1970:

if event.propertyName == 'date' and event.newValue == system.date.parse('Jan 1, 1970 00:00', 'MMM d, yyyy hh:mm'):
	event.source.date = None

...but the date change event doesn't get detected when it's driven by a SQL binding, so I'm guessing that whatever parameters are used in the supply the SQL binding will have to be used to drive the null value. Perhaps to accomplish this, the binding will have to be abandoned and the whole thing will need to be driven by scripting.

Example:

if event.propertyName == 'drivingProperty':
	query = 'SELECT dateColumn FROM dateTable WHERE ID = ?'
	queryResult = system.db.runPrepQuery(query, [event.newValue], 'myDatabase')
	if queryResult:
		event.source.date = queryResult.getValueAt(0, 0)
	else:
		event.source.date = None