Print Page | Close Window

DoRetrieveDayEvents - How to know about Resouce

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=10375
Printed Date: 21 December 2024 at 8:52pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: DoRetrieveDayEvents - How to know about Resouce
Posted By: pritpal
Subject: DoRetrieveDayEvents - How to know about Resouce
Date Posted: 27 April 2008 at 9:52pm

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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net