Hello Everybody
First timer on board. Just 14 days old in XtreamCalendar space.
I am populating calendar with a single "custom" DataProvider with multiple resources, as
//----------------------------------------------------------------------// CLASS V32Calendar
..
..
ENDCLASS
//----------------------------------------------------------------------// METHOD AddSchedules() CLASS V32Calendar Local i
// aSchedules := { { 'SUPER', 1 }, { 'MIDDLE', 2 } }
for i := 1 to len( ::aSchedules ) ::oResources:Add( CreateResource( self, ::aSchedules[ i,1 ], ::aSchedules[ i,2 ] ) ) next ::oCal:SetMultipleResources( ::oResources )
RETURN nil //----------------------------------------------------------------------// Static Function CreateResource( oV32Cal, cName, nScheduleID ) Local oResource := CreateObject( oV32Cal:ClsResource )
WITH OBJECT oResource :Name := cName :ScheduleIDs:Add( nScheduleID ) :SetDataProvider2( "Provider=custom", .f. ) //:DataProvider:CacheMode := xtpCalendarDPCacheModeOff :DataProvider:Create() END Return oResource //----------------------------------------------------------------------// METHOD OnDoRetrieveEvents( dtDay, oEvents )
// Here I populate the events based on my own tables
//
Return NIL
//----------------------------------------------------------------------//
Everything goes well. Calendar is populted properly. The problem is performance issue. As DoRetrieveDayEvents is fired for every resource for a single day, I have no clue how to filter database for events which belong to schedules contained in that resource. I have to pull all events to that day and set ScheduleID member.
This is double work on database engine. Not double, but as many times as many resources are set for the calendar.
Anybody with any idea how to determine to which resource oEvents belongs to?
Regards
------------- Pritpal Bedi
a student of software analysis & design
|