I'm trying to preset the start and end date ranges on a Date Range Selector using the following code. I can't get the Date Range Selector's properties to change. The code framework works from within button scripting on the page, so there's something how I'm grabbing the component from visionWindowOpened script I don't have right.
btw I also tried this way: thisWindow.getRootContainer().getComponent('Date Range 1').endDate = rightEndDate
Thanks
import time
from java.util import Calendar, Date
thisWindow = system.gui.getWindow('Dashboards\Range Differences')
#read the Root Container's custom property: endDays
daysToSub = thisWindow.getComponentForPath('Root Container').endDays
#calculate the end date as the day with the most recent data by stubracting daystoSub
cal.add(Calendar.DATE, -daysToSub);
rightEndDate = cal.getTime()
thisWindow.getComponentForPath('Root Container.Date Range 1').endDate = rightEndDate
#calculate 7 days before the end date
cal.add(Calendar.DATE, -7);
rightStartDate = cal.getTime()
#system.gui.messageBox("7 days prior: " + dateFormat.format(cal.getTime()))
thisWindow.getComponentForPath('Root Container.Date Range 1').startDate = rightStartDate
thisWindow.getComponentForPath('Root Container.Date Range 1').setRange(rightStartDate, rightEndDate)