tvplanit: Remove OnSetFilterCriteria handler from FlexDatastore examples (not needed any more).

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5035 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-07-26 09:44:21 +00:00
parent 58c1cdc162
commit 0f2858fb37
5 changed files with 5 additions and 65 deletions

View File

@ -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.

View File

@ -367,7 +367,6 @@ object Form1: TForm1
DataSources.ContactsDataSource = DsContacts
DataSources.TasksDataSource = DsTasks
ResourceID = 0
OnSetFilterCriteria = VpFlexDataStore1SetFilterCriteria
left = 136
top = 101
ResourceFieldMappings = (

View File

@ -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.

View File

@ -307,7 +307,6 @@ object Form1: TForm1
DataSources.ContactsDataSource = DsContacts
DataSources.TasksDataSource = DsTasks
ResourceID = 0
OnSetFilterCriteria = VpFlexDataStore1SetFilterCriteria
left = 136
top = 101
ResourceFieldMappings = (

View File

@ -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.