dbTalk Databases Forums  

checkbox value in scripts

comp.databases.filemaker comp.databases.filemaker


Discuss checkbox value in scripts in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
lawpoop@gmail.com
 
Posts: n/a

Default Re: checkbox value in scripts - 06-14-2007 , 03:10 PM






On Jun 14, 2:59 pm, Paul Bruneau <p... (AT) ethicalpaul (DOT) com> wrote:
Quote:
On Jun 14, 2:48 pm, lawp... (AT) gmail (DOT) com wrote:


This should be so simple, I can't understand why I need to bring in
someone else. I mean, this should just be a binary field. It's either
true or false, 1 or 0, red or green, chocolate or vanilla. If I can't
figure it out, I don't see why the original developer would be able
to.

heh
OK, so now I understand that checkboxes are not booleans.


Quote:
No. A checkbox uses a value list to determine the choices that are
available.
I think I'm starting to see. So each of those values are stored in the
field, separated by carriage returns?

Quote:
Definitely read the fine manual about checkboxes. Typically, a
checkbox lets you select one OR more than one selection. But it sounds
like in this case, the developer wanted to use a checkbox to only hold
a single value or nothing. This can be valid, but you are definitely
not "getting it" enough to fix the problem that you seem to have.
Yeah, I'm definitely not getting it.

I think you're right about what the developer intended for the
functionality of the checkbox. It works for the other instances where
he's used the checbox as such -- or at least, I haven't gotten the
other checkboxes to break like I have this one.

So how do you make a checkbox act as a binary or boolean value?



Reply With Quote
  #12  
Old   
lawpoop@gmail.com
 
Posts: n/a

Default Re: checkbox value in scripts - 06-14-2007 , 03:14 PM






On Jun 14, 3:38 pm, "Ursus" <ursus.k... (AT) wanadoo (DOT) nl> wrote:
Quote:
lawp... (AT) gmail (DOT) com> schreef in berichtnews:1181847334.259573.225100 (AT) d30g2000prg (DOT) googlegroups.com...




Without a proper look at your solution I don't think we might resolve this.
I am willing to offer some assistance. Just let me know if you need, want
this.
I think I am starting to understand now. Hopefully I can make some
progress with this new understanding





Reply With Quote
  #13  
Old   
lawpoop@gmail.com
 
Posts: n/a

Default Re: checkbox value in scripts - 06-14-2007 , 03:34 PM



OK, I think I may be starting to understand. If I set the value list
of the field that I'm using a checkbox for to have only a value of
"1", then the only values of that field, so long as I'm using the
checkbox, can be either 1 or blank?


Reply With Quote
  #14  
Old   
lawpoop@gmail.com
 
Posts: n/a

Default Re: checkbox value in scripts - 06-14-2007 , 03:56 PM



Now I understand what the problem was.

The original developer correctly made the check box to select values
from a value list of "1". So it was either blank or "1". However,
buttons and scripts to check or uncheck all the checkboxes. If you
clicked the button, and ran the script to uncheck each checkbox, it
set the value of the field to 0 rather thank blank. So then, after the
script had set the field value to zero, when I went to check the
checkbox, it added a 1 and a carriage return, giving me

1
0

in the box.

I modified the "Uncheck All" script to set the fields to "" instead of
0, and it seems to work now.


Reply With Quote
  #15  
Old   
Helpful Harry
 
Posts: n/a

Default Re: checkbox value in scripts - 06-14-2007 , 04:17 PM



In article <1181847334.259573.225100 (AT) d30g2000prg (DOT) googlegroups.com>,
lawpoop (AT) gmail (DOT) com wrote:

Quote:
On Jun 14, 9:49 am, Paul Bruneau <p... (AT) ethicalpaul (DOT) com> wrote:
On Jun 13, 4:11 pm, lawp... (AT) gmail (DOT) com wrote:

[ Checkbox field value ]
1
0

If the value of the checkbox field is "1" followed by a carriage
return, then a "0" as you seem to indicate, it would mean that both
the "1" checkbox and the "0" checkbox were checked, which is normal
checkbox behavior. Multiple checked items appear on their own lines
with checkboxes.

I think I'm beginning to understand. In Filemaker, a checkbox is not a
single check box, but actually two checkboxes?

So there can be four values of a field with a checkbox?

[ ] [ ] = blank
[X] [ ] = ? in a small field or 1 <cr> 0
[ ] [X] = ? in a small field or 0 <cr> 1
[X] [X] = 1
Nope.

A question mark simply means the field is too small on the layout to
display the data. It has nothing to do with what the data is, it's only
FileMaker telling you that you need to make the field bigger so that
you can see the real data. When you make the field bigger the "?" will
disappear.

A checkbox field is just a normal field set to work using cehckboxes.
The field only contains the data of the values that are turned on, in
the order they were turned on, each separate by a carriage return (as
you can see in the "edit box" version).
ie.

[ ] 1 [ ] 0 = blank

[X] 1 [ ] 0 = 1

[ ] 1 [X] 0 = 0

[X] 1 [X] 0 = 0 <cr> 1 or 1 <cr> 0
depending on what order the checkboxes were turned on.

When you turn off a checkbox, FileMaker removes that value from the
field's data (along with an extra carriage return if there is one).



The original developer appears to have used the checkbox field to allow
you to select layouts for printing. For this purpose you need to be
able to turn the appropriate field on and off - that means you can't
use a radio button format (since they can't be turned "off") and have
to use a checkbox format.

The original developer also shrunk the field so that all you see is the
checkbox for th "1" value, This means the only values you should be
able to get in that field is either "1" (checkbox on) or "empty"
(checkbox off).

This would work perfectly well until someone starts playing around.
Your problem is that you have somehow managed to also get a value of
"0" stuck in the field which is screwing up the If test. Obviously when
the field contains a "0" (without or without a "1", then a simple If
text of

If (CheckboxField = "1", ...

will never work since the field never contains just a "1".

What you need to do is use the "edit box" version of the field and
delete all the data from it so that it is completely empty (no carriage
rtuens or spaces). Then remove the "edit box" from the layout and reset
the checkbox field(s) to only display the single checkbox for the "1"
value. (The "1" itself should probably also be hidden since it's the
name of the layout next to the field that you need to see, not the
"1".)


Now when you turn on the checkbox the field will contain just a "1".
When you turn off the checkbox the field will be empty ... and assuming
you havent also been playing with the script, the original If test will
work properly.

And then stop playing. )


Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)


Reply With Quote
  #16  
Old   
FastWolf
 
Posts: n/a

Default Re: Re: checkbox value in scripts - 06-16-2007 , 04:12 AM



On Thu, 14 Jun 2007 20:34:36 -0000, lawpoop (AT) gmail (DOT) com wrote:

Quote:
OK, I think I may be starting to understand. If I set the value list
of the field that I'm using a checkbox for to have only a value of
"1", then the only values of that field, so long as I'm using the
checkbox, can be either 1 or blank?
Yeeesh! Dude, you're working way too hard on this. There really is a
very simple way to do what you're trying to do. You're skipping a
step that is crucial -- you're not making a place for FMP to evaluate
the checkbox. Here's the way I do it:

1) Create a field: checkbox, value list with only ONE value in it. It
doesn't matter what the value is, but whatever it is will appear on
your layout. We'll call it PRINT1_CBOX

2) Create a calculation field which evaluates the checkbox field:
calc, result is number. We'll call this PRINT1_CALC
PRINT1_CALC= IsEmpty ( PRINT1_CBOX )

3) Make your script decide what to print based on the value of
PRINT1_CALC, and NOT the value of PRINT1_CBOX.

Step 1 lets your user pick what he wants to print. Step 2 evaluates
that choice -- if the box is checked, the calc field is 0, if
unchecked, it's 1. Step 3 executes your script based on your user's
choice. Simple as that.

Hope this helps

--
FW



I like to put the field right on the layout for dev purposes, then
remove it when the solution tests out okay.


Reply With Quote
  #17  
Old   
Helpful Harry
 
Posts: n/a

Default Re: checkbox value in scripts - 06-16-2007 , 04:28 PM



In article <039773l9g0gsk0hca6emhnfd10bt7m48ol (AT) 4ax (DOT) com>, FastWolf
<wolfsofast (AT) NOSPAMcomcast (DOT) net> wrote:

Quote:
On Thu, 14 Jun 2007 20:34:36 -0000, lawpoop (AT) gmail (DOT) com wrote:

OK, I think I may be starting to understand. If I set the value list
of the field that I'm using a checkbox for to have only a value of
"1", then the only values of that field, so long as I'm using the
checkbox, can be either 1 or blank?

Yeeesh! Dude, you're working way too hard on this. There really is a
very simple way to do what you're trying to do. You're skipping a
step that is crucial -- you're not making a place for FMP to evaluate
the checkbox. Here's the way I do it:

1) Create a field: checkbox, value list with only ONE value in it. It
doesn't matter what the value is, but whatever it is will appear on
your layout. We'll call it PRINT1_CBOX

2) Create a calculation field which evaluates the checkbox field:
calc, result is number. We'll call this PRINT1_CALC
PRINT1_CALC= IsEmpty ( PRINT1_CBOX )

3) Make your script decide what to print based on the value of
PRINT1_CALC, and NOT the value of PRINT1_CBOX.

Step 1 lets your user pick what he wants to print. Step 2 evaluates
that choice -- if the box is checked, the calc field is 0, if
unchecked, it's 1. Step 3 executes your script based on your user's
choice. Simple as that.

Hope this helps
That's over complicating it. You don't need the extra Print1_Calc field
at all, and since in older versions of FileMaker you can't have Global
Calculation fields it would also be a waste of disk space having one in
every record.


Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)


Reply With Quote
  #18  
Old   
FastWolf
 
Posts: n/a

Default Re: Re: checkbox value in scripts - 06-16-2007 , 04:52 PM



On Sun, 17 Jun 2007 09:28:17 +1200, Helpful Harry
<helpful_harry (AT) nom (DOT) de.plume.com> wrote:

Quote:
In article <039773l9g0gsk0hca6emhnfd10bt7m48ol (AT) 4ax (DOT) com>, FastWolf
wolfsofast (AT) NOSPAMcomcast (DOT) net> wrote:

On Thu, 14 Jun 2007 20:34:36 -0000, lawpoop (AT) gmail (DOT) com wrote:

OK, I think I may be starting to understand. If I set the value list
of the field that I'm using a checkbox for to have only a value of
"1", then the only values of that field, so long as I'm using the
checkbox, can be either 1 or blank?

Yeeesh! Dude, you're working way too hard on this. There really is a
very simple way to do what you're trying to do. You're skipping a
step that is crucial -- you're not making a place for FMP to evaluate
the checkbox. Here's the way I do it:

1) Create a field: checkbox, value list with only ONE value in it. It
doesn't matter what the value is, but whatever it is will appear on
your layout. We'll call it PRINT1_CBOX

2) Create a calculation field which evaluates the checkbox field:
calc, result is number. We'll call this PRINT1_CALC
PRINT1_CALC= IsEmpty ( PRINT1_CBOX )

3) Make your script decide what to print based on the value of
PRINT1_CALC, and NOT the value of PRINT1_CBOX.

Step 1 lets your user pick what he wants to print. Step 2 evaluates
that choice -- if the box is checked, the calc field is 0, if
unchecked, it's 1. Step 3 executes your script based on your user's
choice. Simple as that.

Hope this helps

That's over complicating it. You don't need the extra Print1_Calc field
at all, and since in older versions of FileMaker you can't have Global
Calculation fields it would also be a waste of disk space having one in
every record.


Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)
The one thing this method does accomplish is, it allows the checkbox
field to be treated as a Boolean. I think that's what the OP was
aiming for.

I don't believe the OP stated which FMP version he's using. I have
little experience with versions prior to 7, so definitely I wouldn't
be the one to give advice on anything earlier than that. In future
I'll be sure to make that clear.

--
FW


Reply With Quote
  #19  
Old   
Helpful Harry
 
Posts: n/a

Default Re: checkbox value in scripts - 06-16-2007 , 10:06 PM



In article <0gm873hki8o9t8pi8cl9q5l1hfl3p60vsq (AT) 4ax (DOT) com>, FastWolf
<wolfsofast (AT) NOSPAMcomcast (DOT) net> wrote:

Quote:
On Sun, 17 Jun 2007 09:28:17 +1200, Helpful Harry
helpful_harry (AT) nom (DOT) de.plume.com> wrote:

In article <039773l9g0gsk0hca6emhnfd10bt7m48ol (AT) 4ax (DOT) com>, FastWolf
wolfsofast (AT) NOSPAMcomcast (DOT) net> wrote:

On Thu, 14 Jun 2007 20:34:36 -0000, lawpoop (AT) gmail (DOT) com wrote:

OK, I think I may be starting to understand. If I set the value list
of the field that I'm using a checkbox for to have only a value of
"1", then the only values of that field, so long as I'm using the
checkbox, can be either 1 or blank?

Yeeesh! Dude, you're working way too hard on this. There really is a
very simple way to do what you're trying to do. You're skipping a
step that is crucial -- you're not making a place for FMP to evaluate
the checkbox. Here's the way I do it:

1) Create a field: checkbox, value list with only ONE value in it. It
doesn't matter what the value is, but whatever it is will appear on
your layout. We'll call it PRINT1_CBOX

2) Create a calculation field which evaluates the checkbox field:
calc, result is number. We'll call this PRINT1_CALC
PRINT1_CALC= IsEmpty ( PRINT1_CBOX )

3) Make your script decide what to print based on the value of
PRINT1_CALC, and NOT the value of PRINT1_CBOX.

Step 1 lets your user pick what he wants to print. Step 2 evaluates
that choice -- if the box is checked, the calc field is 0, if
unchecked, it's 1. Step 3 executes your script based on your user's
choice. Simple as that.

Hope this helps

That's over complicating it. You don't need the extra Print1_Calc field
at all, and since in older versions of FileMaker you can't have Global
Calculation fields it would also be a waste of disk space having one in
every record.

The one thing this method does accomplish is, it allows the checkbox
field to be treated as a Boolean. I think that's what the OP was
aiming for.

I don't believe the OP stated which FMP version he's using. I have
little experience with versions prior to 7, so definitely I wouldn't
be the one to give advice on anything earlier than that. In future
I'll be sure to make that clear.
What the original person wanted and what the original developer did
were unfortunately two slightly different things. The original method
would work fine, but somehow the extra "0" got stuck in the field
causing a problem.

Either way you don't really need the extra Print1_Calc field clogging
up the works ... you simply test the Print1_Cbox field itself and you
still have a "boolean" field.


Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.