I keep getting the following error when first opening a window with an equipment schedule:
I get eight of them in a row and only when the window is opened initially. This started happening when I tried populating the scheduled event data set. The data in it appears to be valid and the specified colors show correctly. Anyone have any idea what's going on? Following is the code I'm using to populate the data set:
[code]def getRollFormerScheduledEvents() :
# this returns a dataset for the Equipment Schedule object....
# build a dataset....
from java.util import Calendar
pd = system.db.runQuery("SELECT LineID,StandardRate FROM APLineStatus WHERE Enabled = 1","CHI_MES")
lineStatusDs = system.dataset.toDataSet(pd)
headers = ["EventId","ItemId","Label","StartDate","EndDate","Foreground","Background","LeadTime","LeadColor","PctDone"]
data = []
for i in range(lineStatusDs.rowCount) :
sel = "SELECT SUM(LinFt * 12) AS LinIn, ScheduleDate FROM APSchedule GROUP BY ScheduleDate"
scheduleDs = system.dataset.toDataSet(system.db.runQuery(sel,"CHI_MES"))
for r in range(scheduleDs.rowCount) :
startDate = scheduleDs.getValueAt(r,"ScheduleDate")
startCal = Calendar.getInstance()
startCal.setTime(startDate)
endCal = startCal.clone()
min = int(scheduleDs.getValueAt(r,"LinIn") / lineStatusDs.getValueAt(i,"StandardRate"))
endCal.add(Calendar.MINUTE,min)
fg = '(0,0,0,255)'
bg = '(90,200,200,255)'
lc = '(0,0,0,255)'
# making eventID a unique number...
eventID = system.db.dateFormat(startCal.getTime(),"yyyy-MM-dd")
data.append([eventID,1,"",startCal.getTime(),endCal.getTime(),fg,bg,0,lc,-1])
ds = system.dataset.toDataSet(headers,data)
return ds
[/code]
I've tried setting the colors as strings and tuples with the same results. I tried string because I noticed that's what happens when a 'tuple' is returned from a query which is what I'm doing for the Items data set and that works fine with no errors.
Kurt