在NestedDataSet字段上过滤TClientDataSet [英] Filtering A TClientDataSet On A NestedDataSet Field

查看:119
本文介绍了在NestedDataSet字段上过滤TClientDataSet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正在处理的小应用程序,几乎要完成了,这要归功于 那些在这里帮助过我的人.但是,我还有最后一项任务. 我需要能够在NestedDataSet字段上过滤TClientDataSet.

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

我需要过滤ClientDataset1以显示所有具有布鲁克鳟鱼的湖泊 在ClientDataset Species字段中.

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?

谢谢

账单

推荐答案

尝试向主数据集添加OnFilterRecord处理程序,并在处理程序内部的嵌套数据集上使用定位"以查看记录是否存在.

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.

这篇关于在NestedDataSet字段上过滤TClientDataSet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆