Session Events, onStartup and session.custom props

def onStartup(session):
	session.custom.sessChartDateSelect = system.date.midnight(system.date.now())

The code doesn’t seem to function as intended. My calendar which is bound to the session property is always initialised to the value that was last set in the designer preview. (I want the application to start on today’s date.)

Can anyone spot my error?

This might be a limitation of the timing of the startup and shutdown events, if I remember right they don’t have access to everything that might exist in a full fledged session?

But - couldn’t you just put a binding on session.custom.sessChartDateSelect of midnight(now(0))?

Oooh. I've used values > 0 but never used now(0). Does that just make it run once at startup?

Yes. It's even documented.

1 Like

I had looked that up after Paul's post, thanks, Phil. It wasn't quite clear when it would execute.