Boolean Field Problem

Boolean Field Problem

Post by David O Smi » Thu, 10 Jul 2003 06:33:27



Please forgive me if this is an FAQ, but I've just come over to
Filemaker. I have version 6.2 running under OS X.

I have a boolean field, in which I want to enter data either by a check
box or by simply typing "y" "yes" "n" or "no". But a boolean field is
numeric, and a check box only seems to work with a value list. Entering
a text value in the field causes an error, too.

What I wanted to do was have a check box where "checked" related to
"True" and "unchecked" gave "False".

Is this possible, and if so, how?

TIA,

Dave
--
David O Smith
Commercial & Fine Art Photographer
"Using my pictures to enhance your image"

 
 
 

Boolean Field Problem

Post by John Weinshe » Thu, 10 Jul 2003 06:52:56


Define the field as a number field, format it with a checkbox using a 1/0
value list, and only display the first ('1') box. Checkboxes-- indeed any
kind of field formatting using a value list-- will accept all the main data
types (save for containers).

--
John Weinshel
Datagrace
Vashon Island, WA
(206) 463-1634
Associate Member, Filemaker Solutions Alliance



Quote:> Please forgive me if this is an FAQ, but I've just come over to
> Filemaker. I have version 6.2 running under OS X.

> I have a boolean field, in which I want to enter data either by a check
> box or by simply typing "y" "yes" "n" or "no". But a boolean field is
> numeric, and a check box only seems to work with a value list. Entering
> a text value in the field causes an error, too.

> What I wanted to do was have a check box where "checked" related to
> "True" and "unchecked" gave "False".

> Is this possible, and if so, how?

> TIA,

> Dave
> --
> David O Smith
> Commercial & Fine Art Photographer
> "Using my pictures to enhance your image"


 
 
 

Boolean Field Problem

Post by David O Smi » Thu, 10 Jul 2003 19:25:01



> Define the field as a number field, format it with a checkbox using a 1/0
> value list, and only display the first ('1') box. Checkboxes-- indeed any
> kind of field formatting using a value list-- will accept all the main data
> types (save for containers).

Thanks, John.

I gather if I don't mark the checkbox the field will be empty, rather
than containing 0. Is there a way round this, or doesn't it matter?

Thanks again,

Dave

--
David O Smith
Commercial & Fine Art Photographer
"Using my pictures to enhance your image"

 
 
 

Boolean Field Problem

Post by eyebr.. » Thu, 10 Jul 2003 20:58:14




Quote:>I gather if I don't mark the checkbox the field will be empty, rather
>than containing 0. Is there a way round this, or doesn't it matter?

I may be wrong, but I don't think it matters.  All my checkbox fields run
off a value list that only contains one entry, the number one.  So checked
is one, unchecked is nothing.  I have yet to encounter any problems
traceable to the lack of a zero value.  But I could be fooling myself.

But I suppose it depends on what you do with the fields when they are
working.  Are they used in numeric calculations somewhere, for example?

Steve Brown

 
 
 

Boolean Field Problem

Post by John Weinshe » Thu, 10 Jul 2003 22:29:14


Define the field to auto-enter 0 as a calculation.

Whether it matters or not depends on what you do with the field values. If
you are building relationships from constants '1' and '0' to the field, then
you need the zero. If you are merely counting the 1's, then you do not.

--
John Weinshel
Datagrace
Vashon Island, WA
(206) 463-1634
Associate Member, Filemaker Solutions Alliance




> > Define the field as a number field, format it with a checkbox using a
1/0
> > value list, and only display the first ('1') box. Checkboxes-- indeed
any
> > kind of field formatting using a value list-- will accept all the main
data
> > types (save for containers).

> Thanks, John.

> I gather if I don't mark the checkbox the field will be empty, rather
> than containing 0. Is there a way round this, or doesn't it matter?

> Thanks again,

> Dave

> --
> David O Smith
> Commercial & Fine Art Photographer
> "Using my pictures to enhance your image"

 
 
 

Boolean Field Problem

Post by Howard Schlossber » Fri, 11 Jul 2003 00:01:51


All of my files include a valuelist called 'checkbox' that includes only
a '1'.  You don't need the zero unless you will be counting records
based on something being in that field.  It's either equal to one or its
not.  True or false.

I could be wrong on this, but it would also seem to be more efficient to
leave out the zeroes because only the fields with values get indexed.
If you have zeroes, than they must get indexed as well.  While the speed
benefit of not indexing the zeroes is probably so miniscule, it makes me
feel good to think that I have somehow beaten the system.



>>Define the field as a number field, format it with a checkbox using a 1/0
>>value list, and only display the first ('1') box. Checkboxes-- indeed any
>>kind of field formatting using a value list-- will accept all the main data
>>types (save for containers).

> Thanks, John.

> I gather if I don't mark the checkbox the field will be empty, rather
> than containing 0. Is there a way round this, or doesn't it matter?

> Thanks again,

> Dave

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg              (818) 883-2846
FM Pro Solutions       Los Angeles, California
Associate Member, FileMaker Solutions Alliance
 
 
 

Boolean Field Problem

Post by Hans Rijnbo » Fri, 11 Jul 2003 03:44:42




> >I gather if I don't mark the checkbox the field will be empty, rather
> >than containing 0. Is there a way round this, or doesn't it matter?

> I may be wrong, but I don't think it matters.  All my checkbox fields run
> off a value list that only contains one entry, the number one.  So checked
> is one, unchecked is nothing.

This is true, so you can do nothing that would depend on the value being
'false'. Like: if(value, result1, result2) or if (not value) do it;
If 'value' is indeterminate, then so is 'not value' and Filemaker has no
clue, whether this should mean yes or no. Often it just does nothing.
 
 
 

Boolean Field Problem

Post by Lynn all » Fri, 11 Jul 2003 04:10:06





> > >I gather if I don't mark the checkbox the field will be empty, rather
> > >than containing 0. Is there a way round this, or doesn't it matter?

> > I may be wrong, but I don't think it matters.  All my checkbox fields run
> > off a value list that only contains one entry, the number one.  So checked
> > is one, unchecked is nothing.

> This is true, so you can do nothing that would depend on the value being
> 'false'. Like: if(value, result1, result2) or if (not value) do it;
> If 'value' is indeterminate, then so is 'not value' and Filemaker has no
> clue, whether this should mean yes or no. Often it just does nothing.

Which is why using the test If(value) is not recommended. While it DOES
work in the vast majority of cases to test for a true result, in some
circumstances it fails.

If(value = 1) works all the time. If(value <> 1) or IF(value = 0) are
equally good tests for false. A null value will read out to zero using
these tests.  The behavior of boolean fields changed (I think it was
with FM 5.5 but I could be mistaken) so that the explicit tests are more
reliable across versions of FM.

I too use a value list with only a "1" value. No zero is needed, as I
structure most of my tests to test for true and let the Else take care
of false values.
--
Lynn Allen              Allen & Allen Semiotics
FSA Associate           Filemaker Consulting & Training

 
 
 

Boolean Field Problem

Post by LaRett » Fri, 11 Jul 2003 05:38:37


It doesn't matter whether you use 'y' or 'yes' or '1'.  FM
recognizes the following and automatically converts it in boolean in
numeric) fields:

Yes or Y or 1 or True or T
No or N or 0 or False or F

You can base your VL on any of these values.  The numeric field will
accept all of them.  And the boolean result will always be correct: 1
for Yes, Y, T or True or 1 ... and 0 for No, N, F or False or 0.

But it must be numeric.  Your Value List can be any of these. :)

See http://www.filemaker.com/support/techinfo.html Article
#101545.  As you can imagine, storing a single digit instead of 2-5
characters for the words can save space over thousands of records.

LaRetta

--
Posted via http://dbforums.com

 
 
 

Boolean Field Problem

Post by Howard Schlossber » Fri, 11 Jul 2003 06:53:55


I was going to mention this in my original post, but decided not to
since I figured what you didn't know wouldn't hurt you.  But now that
you know, and although what LaRetta says is true, I would HIGHLY and
STRONGLY recommend against using anything other than 1 or 0 (or blank)
in a number field if you want to have it evaluate properly across all
versions of FileMaker.

No other databases recognize Yes, Y, T or True as boolean operators and
neither should you.  Also, if you ever needed to sum up the number of
trues across all fields, only the '1' will give you correct results.


> You can base your VL on any of these values.  The numeric field will
> accept all of them.  And the boolean result will always be correct: 1
> for Yes, Y, T or True or 1 ... and 0 for No, N, F or False or 0.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg              (818) 883-2846
FM Pro Solutions       Los Angeles, California
Associate Member, FileMaker Solutions Alliance
 
 
 

1. MDAC 2.1 and DAO: Problem with Boolean fields.

I seem to have come across a very nasty bug in MDAC 2.1 when using DAO. If
you do an AddNew and set a boolean field to True, that field is not saved.
The problem only happens when you do an AddNew; editing an existing record
works properly. I have replicated the problem on multiple machines using
VB6. I'm curious if anyone else has run across this (or can point out some
really stupid flaw in my code <g>).

The following demonstrates the problem:
    Set db = ws.OpenDatabase("signup", dbDriverNoPrompt, False, "ODBC;")
    Set rs = db.OpenRecordset("tblTest", dbOpenDynamic, 0, dbOptimistic)
    rs.AddNew
    rs("TextField") = "Test"
    rs("BooleanField") = True
    rs.Update
    rs.Bookmark = rs.LastModified
    Debug.Print rs("TextField")
    Debug.Print rs("BooleanField")
    rs.Close

This should display:
    Test
    True
But instead displays:
    Test
    False

However the following works as expected:
    Set rs = db.OpenRecordset("tblTest", dbOpenDynamic, 0, dbOptimistic)
    rs.AddNew
    rs("TextField") = "Test"
    rs.Update
    rs.Bookmark = rs.LastModified
    rs.Edit
    rs("BooleanField") = True
    rs.Update
    Debug.Print rs("TextField")
    Debug.Print rs("BooleanField")
    rs.Close

Any comments?

Bill Grunnah
TekSolutions

2. top-n query, what is, how done?

3. boolean fields in DAO recordsets - problem

4. GPF in MSAJT200.DLL (Jet 2.5)

5. Setting boolean field from date field values...

6. JOB well executed...but not well working...

7. Add field with Boolean field type failed using ADOX

8. Looking for sybperl on Windows NT

9. Boolean Full-Text searches and Field Scope

10. Create view from the table with multiple boolean fields

11. Updating a boolean field with the same information

12. Boolean fields

13. Quick searching of boolean fields?