Hi
I am having a problem displaying scheduled events on a Perspective Equipment Schedule component. Events do not appear on the component
Items are populated via polling from database with named query . The query returns Json format and has a transform to filter only the items I want displayed. The transform is:
lst = [i for i in value if i['displayed'] == 1]
return lst
and query is:
SELECT itemId , label, displayed
FROM gantt_resources
WHERE site = :site
AND scenario = :scenario
The scheduled events are also populated via polling database with named query, also in Json format. Query is:
SELECT
gantt_scheduled_events.itemId ,
gantt_scheduled_events.eventId ,
gantt_scheduled_events.startDate,
gantt_scheduled_events.endDate,
gantt_scheduled_events.label
,
gantt_scheduled_events.backgroundColor
FROM gantt_scheduled_events
WHERE site = :site
AND scenario = :scenario
Can anyone shed some light on why the events do not appear?
What format are the startDate and endDate variables? If you add a database event manually (i.e. disable the polling binding and just add an object to scheduledEvents) does it show up in the schedule? Also, are your itemIDs from your events query matching an of the itemIds in your items query?
Those are the most common things I've seen before, especially the date formats. I would drag on a new Equipment Schedule component into a view somewhere and look how the scheduleEvents objects are formatted and just copy that.
Can you try renaming itemId to id in the items list? I have an almost identical setup and it displays for me, but I believe the key should be called id and not itemId (in the items list - in the scheduledItems list, they need to be called itemId, confusingly)
One last thing I noticed in your screenshots: the eventID should be eventId (the docs are wrong). That's the last thing I'll have you try because in my testing just now, it didn't show events with eventID.
My understanding is that the startDate etc should be in millis? Is that correct?
I have stored these in mySql in DATETIME formatted columns, and it does appear to return millis.
But there is an obvious difference.
That date format should work... as I said above, at least one problem you're having is that it should indeed be called eventId (note the capitalization) in scheduledEvents
The fact that it's coming from the database should not affect anything... I had a years worth of orders in the component and they showed up fine once I figured out the formatting...
Phew glad that was it as I was all out of ideas! If you can, mark the post as complete so that it displays on the forums homepage with this checkbox icon: