在 NestedDataSet 字段上过滤 TClientDataSet
我正在开发一个小型应用程序,该应用程序即将完成,感谢 那些在这里帮助过我的人。 不过,我还有最后一项任务。 我需要能够在 NestedDataSet 字段上过滤 TClientDataSet。
ClientDataset1
Field0: Name (Lake Name)
ClientDataset2
Field0: Species (Fish Species)
type
TDataModule1 = class( TDataModule )
ClientDataSet1: TClientDataSet;
ClientDataSet2: TClientDataSet;
ClientDataSet1Name: TStringField;
ClientDataSet1County: TStringField;
ClientDataSet1Town: TStringField;
ClientDataSet1Area: TStringField;
ClientDataSet1MaximumDepth: TStringField;
ClientDataSet1MeanDepth: TStringField;
ClientDataSet1MapFilename: TStringField;
ClientDataSet1Species: TDataSetField;
ClientDataSet2Species: TStringField;
procedure DataModuleDestroy( Sender: TObject );
private
{ Private declarations }
public
{ Public declarations }
end;
Data:
Nate Pond
Brook trout
Creek chub
Golden shiner
Black Pond
Brook trout
Brown bullhead
Common shiner
Lake Placid
Lake trout
Smallmouth bass
Yellow perch
我需要过滤 ClientDataset1 以显示所有有布鲁克鳟鱼的湖泊 在 ClientDataset Species 字段中。
Filtered:
Nate Pond
Brook trout
Creek chub
Golden shiner
Black Pond
Brook trout
Brown bullhead
Common shiner
如何创建过滤器(或其他方式)来实现此目的? 有没有第三方组件可以做到这一点?
谢谢,
比尔
I have a small application I am working on that is almost finished thanks to
those who have assisted me here. I have one last task however.
I need to be able to Filter a TClientDataSet on a NestedDataSet field.
ClientDataset1
Field0: Name (Lake Name)
ClientDataset2
Field0: Species (Fish Species)
type
TDataModule1 = class( TDataModule )
ClientDataSet1: TClientDataSet;
ClientDataSet2: TClientDataSet;
ClientDataSet1Name: TStringField;
ClientDataSet1County: TStringField;
ClientDataSet1Town: TStringField;
ClientDataSet1Area: TStringField;
ClientDataSet1MaximumDepth: TStringField;
ClientDataSet1MeanDepth: TStringField;
ClientDataSet1MapFilename: TStringField;
ClientDataSet1Species: TDataSetField;
ClientDataSet2Species: TStringField;
procedure DataModuleDestroy( Sender: TObject );
private
{ Private declarations }
public
{ Public declarations }
end;
Data:
Nate Pond
Brook trout
Creek chub
Golden shiner
Black Pond
Brook trout
Brown bullhead
Common shiner
Lake Placid
Lake trout
Smallmouth bass
Yellow perch
I need to to filter ClientDataset1 to show all lakes that have Brook trout
in the ClientDataset Species field.
Filtered:
Nate Pond
Brook trout
Creek chub
Golden shiner
Black Pond
Brook trout
Brown bullhead
Common shiner
How can a filter (or other means) be created to accomplish this?
Are there any third-party componets that will do this?
Thanks,
Bill
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将 OnFilterRecord 处理程序添加到主数据集,并在处理程序内的嵌套数据集上使用 Locate 来查看记录是否存在。
Try adding an OnFilterRecord handler to the master dataset and use Locate on the nested dataset inside the handler to see if the record exists.