diff --git a/components/tvplanit/examples/datastores/flex/access/readme.txt b/components/tvplanit/examples/datastores/flex/access/readme.txt index c5dd07b2f..8f10d62a9 100644 --- a/components/tvplanit/examples/datastores/flex/access/readme.txt +++ b/components/tvplanit/examples/datastores/flex/access/readme.txt @@ -76,10 +76,6 @@ Step-by-step instructions for creating a new application - In OnDestroy set ODBCConnection.Connected := false -- Write an event handler for the datastore's OnSetFilterCriteria. Copy the - code used in the demo. In case of date-filtering it is important to use - the dbf syntax DTOS(dateField). - - Double-click on the VpFlexDatastore in Form1 to open the field mapper. - Select "Resources" in the combobox. Click a database field in the left listbox @@ -98,7 +94,11 @@ Step-by-step instructions for creating a new application - Close the field mapper. +- After the field mappings have been established the absolute database path can + be removed from the Params of the ODBCConnection and replaced by a relative + path or can be set at runtime. + - Done. - \ No newline at end of file + diff --git a/components/tvplanit/examples/datastores/flex/access/unit1.lfm b/components/tvplanit/examples/datastores/flex/access/unit1.lfm index 753ef3369..b86d85857 100644 --- a/components/tvplanit/examples/datastores/flex/access/unit1.lfm +++ b/components/tvplanit/examples/datastores/flex/access/unit1.lfm @@ -367,7 +367,6 @@ object Form1: TForm1 DataSources.ContactsDataSource = DsContacts DataSources.TasksDataSource = DsTasks ResourceID = 0 - OnSetFilterCriteria = VpFlexDataStore1SetFilterCriteria left = 136 top = 101 ResourceFieldMappings = ( diff --git a/components/tvplanit/examples/datastores/flex/access/unit1.pas b/components/tvplanit/examples/datastores/flex/access/unit1.pas index 5dee5fca2..eeece5914 100644 --- a/components/tvplanit/examples/datastores/flex/access/unit1.pas +++ b/components/tvplanit/examples/datastores/flex/access/unit1.pas @@ -65,9 +65,6 @@ type procedure FormDestroy(Sender: TObject); procedure PageControl1Change(Sender: TObject); procedure TabControl1Change(Sender: TObject); - procedure VpFlexDataStore1SetFilterCriteria(aTable: TDataset; - aUseDateTime: Boolean; aResourceID: Integer; aStartDateTime, - aEndDateTime: TDateTime); private { private declarations } public @@ -177,31 +174,5 @@ begin Grid.Columns[i].Width := 100;; end; -{ This event handler is used by the planner to filter those records from the - specified table which belong to the requested resource ID and are within - the requested time interval. - Note that SQLDB uses the DBF syntax for filtering dates, i.e. - - Convert DateTime field values to strings using DTOS() - - Date parameters must be formatted as yyyymmdd and quoted. - See: http://forum.lazarus.freepascal.org/index.php?topic=23077.0 } -procedure TForm1.VpFlexDataStore1SetFilterCriteria(ATable: TDataset; - AUseDateTime: Boolean; AResourceID: Integer; AStartDateTime, - AEndDateTime: TDateTime); -begin - if AUseDateTime then - ATable.Filter := Format( - '(ResourceID = %d) AND (' + - '((DTOS(StartTime) >= "%s") and (DTOS(EndTime) <= "%s")) OR ' + - '((RepeatCode > 0) and (DTOS(RepeatRangeEnd) >= "%s")) )', [ - AResourceID, - FormatDateTime('yyyymmdd', AStartDateTime), - FormatDateTime('yyyymmdd', AEndDateTime), - FormatDateTime('yyyymmdd', AStartDateTime) - ]) - else - ATable.Filter := Format('ResourceID = %d', [AResourceID]); - ATable.Filtered := true; -end; - end. diff --git a/components/tvplanit/examples/datastores/flex/sqlite3/unit1.lfm b/components/tvplanit/examples/datastores/flex/sqlite3/unit1.lfm index a83f56d9a..9083c43e4 100644 --- a/components/tvplanit/examples/datastores/flex/sqlite3/unit1.lfm +++ b/components/tvplanit/examples/datastores/flex/sqlite3/unit1.lfm @@ -307,7 +307,6 @@ object Form1: TForm1 DataSources.ContactsDataSource = DsContacts DataSources.TasksDataSource = DsTasks ResourceID = 0 - OnSetFilterCriteria = VpFlexDataStore1SetFilterCriteria left = 136 top = 101 ResourceFieldMappings = ( diff --git a/components/tvplanit/examples/datastores/flex/sqlite3/unit1.pas b/components/tvplanit/examples/datastores/flex/sqlite3/unit1.pas index 1ac1d3ba1..1d84685ac 100644 --- a/components/tvplanit/examples/datastores/flex/sqlite3/unit1.pas +++ b/components/tvplanit/examples/datastores/flex/sqlite3/unit1.pas @@ -51,9 +51,6 @@ type procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); - procedure VpFlexDataStore1SetFilterCriteria(aTable: TDataset; - aUseDateTime: Boolean; aResourceID: Integer; aStartDateTime, - aEndDateTime: TDateTime); private procedure CreateContacts; procedure CreateDB(AFileName: String); @@ -298,31 +295,5 @@ begin Sqlite3Connection1.Connected := false; end; -{ This event handler is used by the planner to filter those records from the - specified table which belong to the requested resource ID and are within - the requested time interval. - Note that SQLDB uses the DBF syntax for filtering dates, i.e. - - Convert DateTime field values to strings using DTOS() - - Date parameters must be quoted and formatted as "yyyymmdd". - See: http://forum.lazarus.freepascal.org/index.php?topic=23077.0 } -procedure TForm1.VpFlexDataStore1SetFilterCriteria(ATable: TDataset; - AUseDateTime: Boolean; AResourceID: Integer; AStartDateTime, - AEndDateTime: TDateTime); -begin - if AUseDateTime then - ATable.Filter := Format( - '(ResourceID = %d) AND (' + - '((DTOS(StartTime) >= "%s") and (DTOS(EndTime) <= "%s")) OR ' + - '((RepeatCode > 0) and (DTOS(RepeatRangeEnd) >= "%s")) )', [ - AResourceID, - FormatDateTime('yyyymmdd', AStartDateTime), - FormatDateTime('yyyymmdd', AEndDateTime), - FormatDateTime('yyyymmdd', AStartDateTime) - ]) - else - ATable.Filter := Format('ResourceID = %d', [AResourceID]); - ATable.Filtered := true; -end; - end.