Skip to content

Commit 5c8eb81

Browse files
committed
Thanks to Med Hanza, added dbfilter_subform demo.
1 parent 7fa326d commit 5c8eb81

29 files changed

+3777
-0
lines changed

filter.zip

-156 KB
Binary file not shown.

samples/db/dbfilter_subform/DMAIN.mfm

Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
object DMAINmo: tDMAINmo
2+
bounds_cx = 174
3+
bounds_cy = 313
4+
left = 114
5+
top = 306
6+
moduleclassname = 'tmsedatamodule'
7+
object tfb3connection1: tfb3connection
8+
Connected = True
9+
DatabaseName = 'EMPLOYEE.FDB'
10+
Transaction = tmsesqltransaction1
11+
Password = 'masterkey'
12+
UserName = 'sysdba'
13+
Role = '3'
14+
left = 24
15+
top = 8
16+
end
17+
object tmsesqltransaction1: tmsesqltransaction
18+
Active = True
19+
Database = tfb3connection1
20+
left = 16
21+
top = 48
22+
end
23+
object tmsesqlquery1: tmsesqlquery
24+
beforebeginfilteredit = BeforeFilterEdit
25+
afterfilterchanged = afterFilterChanged
26+
Active = True
27+
params = <>
28+
SQL.data = (
29+
'select * from department'
30+
)
31+
IndexDefs = <
32+
item
33+
Name = 'BUDGETX'
34+
end
35+
item
36+
Name = 'RDB$4'
37+
end
38+
item
39+
Name = 'RDB$FOREIGN10'
40+
end
41+
item
42+
Name = 'RDB$FOREIGN6'
43+
end
44+
item
45+
Name = 'RDB$PRIMARY5'
46+
end>
47+
tablename = 'department'
48+
database = tfb3connection1
49+
OnFilterRecord = filterRec
50+
Transaction = tmsesqltransaction1
51+
FieldDefs = <
52+
item
53+
Name = 'DEPT_NO'
54+
DataType = ftString
55+
Size = 3
56+
end
57+
item
58+
Name = 'DEPARTMENT'
59+
DataType = ftString
60+
Size = 25
61+
end
62+
item
63+
Name = 'HEAD_DEPT'
64+
DataType = ftString
65+
Size = 3
66+
end
67+
item
68+
Name = 'MNGR_NO'
69+
DataType = ftSmallint
70+
end
71+
item
72+
Name = 'BUDGET'
73+
DataType = ftBCD
74+
end
75+
item
76+
Name = 'LOCATION'
77+
DataType = ftString
78+
Size = 15
79+
end
80+
item
81+
Name = 'PHONE_NO'
82+
DataType = ftString
83+
Size = 20
84+
end>
85+
left = 24
86+
top = 88
87+
streamingversion = 1
88+
end
89+
object tmsesqlquery2: tmsesqlquery
90+
beforebeginfilteredit = BeforeFilterEdit
91+
afterfilterchanged = afterFilterChanged
92+
Active = True
93+
params = <
94+
item
95+
DataType = ftUnknown
96+
Name = 'n'
97+
ParamType = ptInput
98+
end>
99+
SQL.data = (
100+
'select * from employee where DEPt_no=:n'
101+
)
102+
IndexDefs = <
103+
item
104+
Name = 'NAMEX'
105+
end
106+
item
107+
Name = 'RDB$FOREIGN8'
108+
end
109+
item
110+
Name = 'RDB$FOREIGN9'
111+
end
112+
item
113+
Name = 'RDB$PRIMARY7'
114+
end>
115+
tablename = 'employee'
116+
database = tfb3connection1
117+
OnFilterRecord = filterRec
118+
Transaction = tmsesqltransaction1
119+
FieldDefs = <
120+
item
121+
Name = 'EMP_NO'
122+
DataType = ftSmallint
123+
end
124+
item
125+
Name = 'FIRST_NAME'
126+
DataType = ftString
127+
Size = 15
128+
end
129+
item
130+
Name = 'LAST_NAME'
131+
DataType = ftString
132+
Size = 20
133+
end
134+
item
135+
Name = 'PHONE_EXT'
136+
DataType = ftString
137+
Size = 4
138+
end
139+
item
140+
Name = 'HIRE_DATE'
141+
DataType = ftDateTime
142+
end
143+
item
144+
Name = 'DEPT_NO'
145+
DataType = ftString
146+
Size = 3
147+
end
148+
item
149+
Name = 'JOB_CODE'
150+
DataType = ftString
151+
Size = 5
152+
end
153+
item
154+
Name = 'JOB_GRADE'
155+
DataType = ftSmallint
156+
end
157+
item
158+
Name = 'JOB_COUNTRY'
159+
DataType = ftString
160+
Size = 15
161+
end
162+
item
163+
Name = 'SALARY'
164+
DataType = ftBCD
165+
end
166+
item
167+
Name = 'FULL_NAME'
168+
DataType = ftString
169+
Size = 37
170+
end>
171+
left = 16
172+
top = 120
173+
streamingversion = 1
174+
end
175+
object tmsedatasource1: tmsedatasource
176+
DataSet = tmsesqlquery1
177+
left = 16
178+
top = 160
179+
end
180+
object tmsedatasource2: tmsedatasource
181+
DataSet = tmsesqlquery2
182+
left = 40
183+
top = 184
184+
end
185+
object tfieldparamlink1: tfieldparamlink
186+
fieldname = 'DEPT_NO'
187+
datasource = tmsedatasource1
188+
destdataset = tmsesqlquery2
189+
paramname = 'n'
190+
left = 48
191+
top = 232
192+
end
193+
object tifistringlinkcomp1: tifistringlinkcomp
194+
left = 24
195+
top = 264
196+
end
197+
object timagelist1: timagelist
198+
width = 4
199+
height = 4
200+
count = 8
201+
cornermask_topleft = #2#1
202+
cornermask_bottomleft = #2#1
203+
cornermask_bottomright = #2#1
204+
cornermask_topright = #2#1
205+
left = 160
206+
top = 144
207+
image = {
208+
00000000020000000C0000000C00000000010000000000000000000000000000
209+
000000000000000000000000000000000000000000000002A5A5A50300000003
210+
A5A5A5010000000486868601DCDCDC01FFFFFF01A5A5A50100000003A5A5A501
211+
000000037C7C7C0100000003A5A5A50100000003A5A5A50100000003A5A5A501
212+
00000003A5A5A50100000003A5A5A5010000000AA5A5A50100000003A5A5A501
213+
00000006E8E8E801A5A5A50100000002E8E8E801A5A5A50100000006E5E5E501
214+
A5A5A50100000002E5E5E501A5A5A50100000005DCDCDC0100000001A5A5A501
215+
00000001DCDCDC0100000001A5A5A503CCCCCC0100000001A5A5A50400000004
216+
FFFFFF01DCDCDC019494940100000004FFFFFF0100000005FFFFFF0100000001
217+
8C8C8C010000000ADCDCDC01A5A5A501000000081CF1FFFF1EF1FFFF11F1FFFF
218+
11F1FFFF80F8FFFFC0FCFFFFC0FCFFFFA0FAFFFFF7F0FFFF87F0FFFF0AF0FFFF
219+
0CF0FFFF
220+
}
221+
end
222+
end

samples/db/dbfilter_subform/DMAIN.pas

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
unit DMAIN;
2+
{$ifdef FPC}{$mode objfpc}{$h+}{$endif}
3+
interface
4+
uses
5+
msetypes,mseglob,mseapplication,mseclasses,msedatamodules,msedatabase,
6+
msefb3connection,msqldb,sysutils,mdb,msebufdataset,msedb,mseifiglob,msesqldb,
7+
msewidgets,mseificomp,mseificompglob,msebitmap;
8+
9+
type
10+
tDMAINmo = class(tmsedatamodule)
11+
tfb3connection1: tfb3connection;
12+
tmsesqltransaction1: tmsesqltransaction;
13+
tmsesqlquery1: tmsesqlquery;
14+
tmsesqlquery2: tmsesqlquery;
15+
tmsedatasource1: tmsedatasource;
16+
tmsedatasource2: tmsedatasource;
17+
tfieldparamlink1: tfieldparamlink;
18+
tifistringlinkcomp1: tifistringlinkcomp;
19+
timagelist1: timagelist;
20+
procedure BeforeFilterEdit(const sender: tmsebufdataset;
21+
const akind: filtereditkindty);
22+
procedure filterRec(DataSet: TDataSet; var Accept: Boolean);
23+
procedure afterFilterChanged(const sender: tmsebufdataset);
24+
end;
25+
var
26+
DMAINmo: tDMAINmo;
27+
implementation
28+
uses
29+
DMAIN_mfm;
30+
31+
procedure tdmainmo.BeforeFilterEdit(const sender: tmsebufdataset;
32+
const akind: filtereditkindty);
33+
begin
34+
tmsebufdataset(sender).tag:=ord(akind);
35+
end;
36+
37+
procedure tdmainmo.filterRec(DataSet: TDataSet; var Accept: Boolean);
38+
begin
39+
accept:=tmsebufdataset(dataset).checkfiltervalues();
40+
end;
41+
42+
procedure tDMAINmo.afterFilterChanged(const sender: tmsebufdataset);
43+
begin
44+
with (sender) do
45+
if filtered then tifistringlinkcomp1.controller.value:=inttostr(countvisiblerecords())
46+
end;
47+
end.

0 commit comments

Comments
 (0)