Board index » delphi » How to filter on blank fields in D2?

How to filter on blank fields in D2?

How do I do a filter on a TTable in Delphi 2, where I only get the fields
that are NULL or blank? I.e. the fields with no contents.

In SQL I would say

WHERE FieldName IS NULL

But that won't work in the filter. I get an error stating

) expected, found IS

--

CUL8R dude!                       \|/
                                  @ @
Jens  +-----------------------oOO-(_)-OOo-----------------------+
      | Internet   jb...@image.dk     CompuServe    100437,2475 |
      | FidoNet         2:235/142     VirNet          9:451/238 |
      | OS2Net          81:445/49     Fax     +45 - 3537 - 7006 |
      +---------------------------------------------------------+
      streaming tape: party decorations

 

Re:How to filter on blank fields in D2?


Quote
On Wed, 26 Feb 1997 00:54:00 +0100, jb...@image.dk (Jens Bang) wrote:
>How do I do a filter on a TTable in Delphi 2, where I only get the fields
>that are NULL or blank? I.e. the fields with no contents.

>In SQL I would say

>WHERE FieldName IS NULL

>But that won't work in the filter. I get an error stating

Try something like this:

Define OnNullVal as a global Boolean var

procedure TMyForm.MyTableFilterRecord(DataSet: TDataSet;
  var Accept: Boolean);
begin
     if OnNullVal then
     Accept :=
      (MyTable.FieldByName(FilterField1).isNull)
end;

Set OnNullVal on and off to activate...

Hope this helps

TTFN
Mike
J. M. Blevins CACI/IMSS, Inc. I work for cheap, I drink a lot, and I don't sleep.
In other words, I'm a model programmer.

Re:How to filter on blank fields in D2?


Quote
Jens Bang (jb...@image.dk) wrote:

: How do I do a filter on a TTable in Delphi 2, where I only get the fields
: that are NULL or blank? I.e. the fields with no contents.
:
: In SQL I would say
:
: WHERE FieldName IS NULL
:
: But that won't work in the filter. I get an error stating
:
: ) expected, found IS
:
: --
:
: CUL8R dude!                       \|/
:                                   @ @
: Jens  +-----------------------oOO-(_)-OOo-----------------------+
:       | Internet   jb...@image.dk     CompuServe    100437,2475 |
:       | FidoNet         2:235/142     VirNet          9:451/238 |
:       | OS2Net          81:445/49     Fax     +45 - 3537 - 7006 |
:       +---------------------------------------------------------+
:       streaming tape: party decorations
I have the same problem, and would like to know the answer as well
--
Trajano Roberto <t...@melbourne.dialix.oz.au>
74 Pasadena Crescent
Bentleigh East, Vic 3165 - Australia
Phone +61 3 9570 2026

Re:How to filter on blank fields in D2?


Quote
Jens Bang (jb...@image.dk) wrote:

: How do I do a filter on a TTable in Delphi 2, where I only get the fields
: that are NULL or blank? I.e. the fields with no contents.
:
: In SQL I would say
:
: WHERE FieldName IS NULL
:
: But that won't work in the filter. I get an error stating
:
: ) expected, found IS
:
: --
:
: CUL8R dude!                       \|/
:                                   @ @
: Jens  +-----------------------oOO-(_)-OOo-----------------------+
:       | Internet   jb...@image.dk     CompuServe    100437,2475 |
:       | FidoNet         2:235/142     VirNet          9:451/238 |
:       | OS2Net          81:445/49     Fax     +45 - 3537 - 7006 |
:       +---------------------------------------------------------+
:       streaming tape: party decorations
Where FieldName = ""
--
Trajano Roberto <t...@melbourne.dialix.oz.au>
74 Pasadena Crescent
Bentleigh East, Vic 3165 - Australia
Phone +61 3 9570 2026

Other Threads