If I call my project library script def shiftGenerator(startDate, shiftPattern):
from the Script Console like this,
startDate = system.date.addDays(system.date.now(), -1) # Yesterday for testing.
shiftPattern = [ ... ]
shiftCalcs.shiftCalcs.shiftGenerator(startDate, shiftPattern)
it works.
When I call it from an Expression Binding like this,
runScript(
"shiftCalcs.shiftCalcs.shiftGenerator",
2000, // 2 second update for testing.
{session.custom.datePicker},
{view.params.config.shiftPattern}
)
The problem seems to be caused by whatever format the datePicker session variable is stored in. datePicker is generated by a DateTime Input component which has a simple (bidirectional) property binding from it’s props.value
to the session custom property session.custom.datePicker
.
It seems to choke with an Error_ExpressionEval
error when startDate
is passed to this function:
def addShiftStartTime(timestamp, time_str, nextDay):
# First shift usually starts at 7 a.m. or 8 a.m.
# timestamp is midnight of the calendar start day.
# time_str is the shift start in "hh:mm" format.
# nextDay signals if the start of the third shift is after midnight.
h, m = time_str.split(':')
newDate = system.date.addHours(timestamp, int(h)) # Add on the hours,
newDate = system.date.addMinutes(newDate, int(m)) # and the minutes,
if nextDay:
newDate = system.date.addDays(newDate, 1) # and another 24 hours.
return newDate
Can anyone suggest some debug procedures?