Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM Client/Server » View Thread |
Messages 1 to 6 of 6 total |
Scheduled Events |
Tue, Sep 12 2006 2:18 PM | Permanent Link |
"I Bruce" | No I am not stopping the server inside the event. I have included my code
below that is on the ScheduledEvent. The dmMainData is a datamodule that contains local connections to the database tables. I pass the path to the data from the server database path. Another problem I am having also is the event keeps firing until the end time is reached, so if I have an event set to daily at 3:30 to 3:32 it will fire like five times instead of just once. I set the Completed to True is there something else I must do? Does the last run time need to be set for it to stop? procedure TMainForm.ServerEngineServerScheduledEvent(Sender: TObject; const EventName: String; var Completed: Boolean); var srvList: TStrings; DataSetting: TDataSettings; sPath, sDescription: String; i: Integer; begin if (AnsiCompareText(EventName,'LOANSUMMARY')=0) or (AnsiCompareText(EventName,'DELINQUENCYSUMMARY')=0) then begin try DataSetting := TDataSettings.Create(ExtractFilePath(Application.EXEName)); srvList := TStringList.Create; ServerEngine.GetServerDatabaseNames(srvList); for i := 0 to srvList.Count -1 do begin ServerEngine.GetServerDatabase(srvList.Strings[i],sDescription,sPath); DataSetting.ReadDataSettings(srvList.Strings[i],sPath); try dmMainData := TdmMainData.Create(self); dmMainData.FDataPath := sPath; if (AnsiCompareText(EventName,'LOANSUMMARY')=0) then begin if DataSetting.DoLoanSummary and (srvList.Strings[i] <> 'TEA Common') then dmMainData.LoanSummaryRoutine(DataSetting.LogPath); end else (AnsiCompareText(EventName,'DELINQUENCYSUMMARY')=0) then begin if DataSetting.DoDelinquency and (srvList.Strings[i] <> 'TEA Common') then dmMainData.DelinquencyRoutine(DataSetting.LogPath); end finally FreeAndNil(dmMainData); end end; //end for loop finally FreeAndNil(srvList); FreeAndNil(DataSetting); Completed := True; end; end //end if else Completed := True; end; Thanks, Ian |
Tue, Sep 12 2006 4:13 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Ian, << No I am not stopping the server inside the event. I have included my code below that is on the ScheduledEvent. The dmMainData is a datamodule that contains local connections to the database tables. I pass the path to the data from the server database path. >> Is the dmMainData variable a global variable ? If so, then don't do that - scheduled event implementations must be thread-safe and must obey the DBISAM rules for thread-safety: http://www.elevatesoft.com/dbisam4d5_multi_threaded_applications.htm << Another problem I am having also is the event keeps firing until the end time is reached, so if I have an event set to daily at 3:30 to 3:32 it will fire like five times instead of just once. I set the Completed to True is there something else I must do? Does the last run time need to be set for it to stop? >> Are you sure that the Completed flag is getting set ? If there's an exception, possibly due to threading issues that I mention above, then it may not get set properly. You can check the server log for any exceptions that may have occurred during the scheduled event. -- Tim Young Elevate Software www.elevatesoft.com |
Fri, Sep 15 2006 10:03 AM | Permanent Link |
"I Bruce" | My disconnection problem has gone away however my events keep firing every
minute. The last run date is getting set now on the events screen, even though that is not the last run date and time that the log says. The log does say completed (I have incluede my server admin shots). Another question is the Ending Date, is it to specify the last date this event should be allowed to run ever, so for instances if I want a routine to run monthly for the next year my ending would be 9/15/2007? procedure TMainForm.ServerEngineServerScheduledEvent(Sender: TObject; const EventName: String; var Completed: Boolean); var srvList: TStrings; DataSetting: TDataSettings; sPath, sDescription: String; starttime, endtime, elapsedtime: TDateTime; i: Integer; LocalData: TdmMainData; begin if (AnsiCompareText(tmpEventName,'LOANSUMMARY')=0) or (AnsiCompareText(tmpEventName,'DELINQUENCYSUMMARY')=0) then begin try DataSetting := TDataSettings.Create(ExtractFilePath(Application.EXEName)); srvList := TStringList.Create; ServerEngine.GetServerDatabaseNames(srvList); for i := 0 to srvList.Count -1 do begin ServerEngine.GetServerDatabase(srvList.Strings[i],sDescription,sPath); DataSetting.ReadDataSettings(srvList.Strings[i],sPath); try LocalData := TdmMainData.Create(nil); LocalData.FDataPath := sPath; LocalData.DBISAMDatabase1.Connected := True; if tmpEventName = 'LOANSUMMARY' then begin if DataSetting.DoLoanSummary and (srvList.Strings[i] <> 'TEA Common') then LocalData.LoanSummaryRoutine(DataSetting.LogPath); Completed := True; end else if tmpEventName = 'DELINQUENCYSUMMARY' then begin if DataSetting.DoDelinquency and (srvList.Strings[i] <> 'TEA Common') then LocalData.DelinquencyRoutine(DataSetting.LogPath); Completed := True; end finally FreeAndNil(LocalData); end end; //end for loop finally FreeAndNil(srvList); FreeAndNil(DataSetting); Completed := True; end; end //end if else Completed := True; Completed := True; end; "Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message news:5332CCC6-3D4C-4704-BECE-74A247301FE7@news.elevatesoft.com... > > Ian, > > << No I am not stopping the server inside the event. I have included my > code > below that is on the ScheduledEvent. The dmMainData is a datamodule that > contains local connections to the database tables. I pass the path to the > data from the server database path. >> > > Is the dmMainData variable a global variable ? If so, then don't do > that - > scheduled event implementations must be thread-safe and must obey the > DBISAM > rules for thread-safety: > > http://www.elevatesoft.com/dbisam4d5_multi_threaded_applications.htm > > << Another problem I am having also is the event keeps firing until the > end > time is reached, so if I have an event set to daily at 3:30 to 3:32 it > will > fire like five times instead of just once. I set the Completed to True is > there something else I must do? Does the last run time need to be set for > it > to stop? >> > > Are you sure that the Completed flag is getting set ? If there's an > exception, possibly due to threading issues that I mention above, then it > may not get set properly. You can check the server log for any exceptions > that may have occurred during the scheduled event. > > -- > Tim Young > Elevate Software > www.elevatesoft.com > > Attachments: clip_image002.jpg |
Fri, Sep 15 2006 10:42 AM | Permanent Link |
"I Bruce" | A few more things to add
If we set the run type to monthly we get the events firing multiple times in the time period. If we set an event to hourly then it only fires once, however, it will not fire again in an hour. If we set an event to daily then it fires correctly once everyday. If we set an event to Weekly then it fires correctly once every week. I have attached which I meant to in the previous post the events tab set up Attachments: clip_image002.jpg |
Fri, Sep 15 2006 3:27 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Ian,
<< My disconnection problem has gone away however my events keep firing every minute. The last run date is getting set now on the events screen, even though that is not the last run date and time that the log says. The log does say completed (I have incluede my server admin shots). >> The timestamp for the last run is the start time of the last run. It won't correspond to the completion time shown in the log. As for the event continually firing, the only way that would occur is if the scheduled event is not being marked as completed. You are using version 4.24, correct ? << is the Ending Date, is it to specify the last date this event should be allowed to run ever, so for instances if I want a routine to run monthly for the next year my ending would be 9/15/2007? >> Correct. -- Tim Young Elevate Software www.elevatesoft.com |
Fri, Sep 15 2006 3:31 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Ian,
<< If we set the run type to monthly we get the events firing multiple times in the time period. >> At what intervals is it firing - once per minute like before ? << If we set an event to hourly then it only fires once, however, it will not fire again in an hour. >> You need to make sure that you set the begin and end times to encompass the range of hours in the day that you want the event to fire. By your screen shot, you've got it specified that it should only run between a 3-minute period in a given day. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Friday, March 29, 2024 at 03:30 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |