We are using the Ad-hoc trends template in our vision project. It’s working great except we get an error in the duration component when we select a time of 1 month or larger. The error is in the script at the cal.add syntax:
File “event:propertyChange”, line 13, in
TypeError: add(): 2nd arg can’t be coerced to int
Code:
from java.util import Calendar
from java.util import Date
if event.propertyName == “selectedValue”:
seconds = long(event.newValue)
if seconds > 0:
cal = Calendar.getInstance()
chart = event.source.parent.getComponent('Easy Chart')
endDate = Date()
cal.setTime(endDate)
cal.add(Calendar.MILLISECOND, seconds * -1000)
startDate = cal.getTime()
chart.endDate = endDate
chart.startDate = startDate