| Subject |
Re: FALSE or <> or not |
| From |
Ken Mayer <dbase@nospam.goldenstag.net> |
| Date |
Wed, 30 Dec 2020 13:45:10 -0800 |
| Newsgroups |
dbase.getting-started |
On 12/30/2020 1:30 PM, rouke wrote:
> In dbase plus 8 with ADO I have a simple table with a few character, date, numeric fields and a logical field. The logical field (field name 'returned') is a tick box. I have double clicked some of the tick boxes and left some as they were. The double clicked tick boxes show a tick, the other ones don't. I assume the ones that do not show a tick are .F. or .N. and the ones that do show a tick are .T. or .Y.. If I 'set filter to returned', all records with ticked tick boxes show, when I 'set filter to not returned' only those records with unticked tick boxes show. But when I 'set filter to returned = .F.', a seemingly random and much smaller number (only 3) of records show, albeit with the tick boxes unticked. When I 'set filter to returned<>.T.', all records with an unticked tick box show. So I wonder, what's the difference between FALSE or <> or not?
By default a field is "null". The value "null" is a third state for a
logical field -- it means it wasn't touched by anyone, it is neither
true or false. (By the way, in dBASE Plus and going back to Visual dBASE
7, if not earlier, you can stop using .t. and .f. and so on, and use the
words true and false, which are easier to read and type ...)
If you want only the true items, then a filter for "true" is easy
enough, if you want it for ones that are not "true", just use NOT true
in the code, or as you are using it "not returned" will work. Basically
it means that no one set the value to true or false. The other solution
is to set a default value when adding a record, and setting it to false
that way. If you're using ADO, that implies you're using a back-end
server database, and you can set a default value for your logical fields
in those tables as well, you can set it to false and that would resolve
the issue.
Ken
--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
|
|