在 NestedDataSet 字段上过滤 TClientDataSet

发布于 2024-07-12 02:07:00 字数 1355 浏览 22 评论 0原文

我正在开发一个小型应用程序,该应用程序即将完成,感谢 那些在这里帮助过我的人。 不过,我还有最后一项任务。 我需要能够在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雪化雨蝶 2024-07-19 02:07:00

尝试将 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文