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
  #1  
Old   
lawpoop@gmail.com
 
Posts: n/a

Default checkbox value in scripts - 06-13-2007 , 03:11 PM






Hello all -

I'm having problems with a database project that I inherited. We have
a series of checkboxes that are used in if statements to print
different layouts.

The behavior of one particular checkbox is a problem. The script
originally checked " if field = 1 " and then ran the script or not. I
added an edit box to see the actual value of the checkbox field. It
varies between 1,0, blank, and '?'. The last value I found out by
doing a message window with the field's value, and it says:

[ Checkbox field value ]
1
0
--------------------------------

So how do I get this checkbox to have only values of 1 or 0 when I
check and uncheck it? I added a data validation to the field so that
it only allows values from a value of 1 and 0. It validates always,
and never allows overrides. However, the field still goes to blank
when I uncheck the checkbox.

Should I put an invisible button over it to control the value of the
field?


Reply With Quote
  #2  
Old   
Jens Teich
 
Posts: n/a

Default Re: checkbox value in scripts - 06-13-2007 , 04:11 PM






lawpoop (AT) gmail (DOT) com writes:
Quote:
So how do I get this checkbox to have only values of 1 or 0 when I
check and uncheck it? I added a data validation to the field so that
it only allows values from a value of 1 and 0. It validates always,
and never allows overrides. However, the field still goes to blank
when I uncheck the checkbox.
The value 1 in the checkbox is save whereas the other case 'not 1' is
unsafe.

You can fix this by introducing an additional calculation field

unchecked = if(checkbox <> 1 ; 1)

If you want to check both cases you can now ask
checkbox=1 or unchecked=1 both safely.

-jens


--
http://jensteich.de


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

Default Re: checkbox value in scripts - 06-13-2007 , 04:11 PM



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

Quote:
Hello all -

I'm having problems with a database project that I inherited. We have
a series of checkboxes that are used in if statements to print
different layouts.

The behavior of one particular checkbox is a problem. The script
originally checked " if field = 1 " and then ran the script or not. I
added an edit box to see the actual value of the checkbox field. It
varies between 1,0, blank, and '?'. The last value I found out by
doing a message window with the field's value, and it says:

[ Checkbox field value ]
1
0
--------------------------------

So how do I get this checkbox to have only values of 1 or 0 when I
check and uncheck it? I added a data validation to the field so that
it only allows values from a value of 1 and 0. It validates always,
and never allows overrides. However, the field still goes to blank
when I uncheck the checkbox.

Should I put an invisible button over it to control the value of the
field?
Checkboxes for each value are either On or Off. If you turn off all the
checkboxes in a field, then the field is empty.

Unless the "?" data is an actual "?" that has been typed into the field
(or set by a script), then the "?" symbol may mean the field isn't wide
enough to display the data. Try stretching the "edit box" version of
the field to be longer.

By the sound of it, when the "1" value was On the script would run and
when the "1" value was Off the script isn't run. The "0" value isn't
actually needed, but the original developer may simply have reused an
existing Value List for this second purpose. Such a system would work
fine until someone starts playing where they shouldn't - you should not
really play with a system you don't understand, whether it's the
computer's operating system or a FileMaker solution that works.

Normally a field used to define which layouts to print would be a
Global field, but since you say it contains various data it must be a
normal field (different data for each record).

I'm not quite sure what you're wanting to do or what you should do (if
anything). If the field is designed to be "1" or "empty" then you
shouldn't really be changing it to set it to "0", but the field
currently contains various values caused by someone playing at some
stage.

You should probably get the original person back to fix the problem
since they should know how it's meant to work.

It's impossible to know whether you should actually be playing with
those values at all, but if you want the field to be set to "1" for ALL
records (or all records in the current Found Set), then:

- Make a backup of the file and then re-open it in FileMaker

- Find the appropriate records (Show All or Find a particular set)

- In the "Edit Box" version of the field type a 1

- Choose Replace from the Records menu

- Make sure in the window that appears it says you are replacing
the contents of the appropriate field with "1" and then click
Replace

- All done.


You can use the same process to set the field to be "empty" for all
fields, by simply deleting any data in the "edit box" version of the
field. Or you can use the same process to set them all to "0".

By resetting the values you'll get rid of the strange "?" data ...
although it may well be there for a good reason elsewhere within the
system.


If after resetting the values (to "1" or "0") you really want to limit
the values to either "1" or "0", and not "empty", then you can change
the field's format options to use Radio Buttons rather than Check boxes
.... but the field sounds like it's meant to be "1" or "empty".



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


Reply With Quote
  #4  
Old   
Sargasso
 
Posts: n/a

Default Re: checkbox value in scripts - 06-14-2007 , 05:02 AM



lawpoop (AT) gmail (DOT) com wrote:
Quote:
Hello all -

I'm having problems with a database project that I inherited. We have
a series of checkboxes that are used in if statements to print
different layouts.

The behavior of one particular checkbox is a problem. The script
originally checked " if field = 1 " and then ran the script or not. I
added an edit box to see the actual value of the checkbox field. It
varies between 1,0, blank, and '?'. The last value I found out by
doing a message window with the field's value, and it says:

[ Checkbox field value ]
1
0
--------------------------------

So how do I get this checkbox to have only values of 1 or 0 when I
check and uncheck it? I added a data validation to the field so that
it only allows values from a value of 1 and 0. It validates always,
and never allows overrides. However, the field still goes to blank
when I uncheck the checkbox.

Should I put an invisible button over it to control the value of the
field?

Because filemaker allows for non-standard operations on checkboxes and
radiobuttons I always use functions to ensure the correct content of a field.

For single checkboxes I use ...

Case ( <fieldname> ; 1 )

good luck



Reply With Quote
  #5  
Old   
Paul Bruneau
 
Posts: n/a

Default Re: checkbox value in scripts - 06-14-2007 , 08:49 AM



On Jun 13, 4:11 pm, lawp... (AT) gmail (DOT) com wrote:

Quote:
[ 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.

The safe way to get the value of a checkbox that might possibly
contain multiple values is to use the Patterncount function to look
for your "1".



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

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



On Jun 13, 5:11 pm, Helpful Harry <helpful_ha... (AT) nom (DOT) de.plume.com>
wrote:
Quote:
In article <1181765467.420681.66... (AT) x35g2000prf (DOT) googlegroups.com>,



lawp... (AT) gmail (DOT) com wrote:
Hello all -

I'm having problems with a database project that I inherited. We have
a series of checkboxes that are used in if statements to print
different layouts.

The behavior of one particular checkbox is a problem. The script
originally checked " if field = 1 " and then ran the script or not. I
added an edit box to see the actual value of the checkbox field. It
varies between 1,0, blank, and '?'. The last value I found out by
doing a message window with the field's value, and it says:

[ Checkbox field value ]
1
0
--------------------------------

So how do I get this checkbox to have only values of 1 or 0 when I
check and uncheck it? I added a data validation to the field so that
it only allows values from a value of 1 and 0. It validates always,
and never allows overrides. However, the field still goes to blank
when I uncheck the checkbox.

Should I put an invisible button over it to control the value of the
field?

Checkboxes for each value are either On or Off. If you turn off all the
checkboxes in a field, then the field is empty.

Unless the "?" data is an actual "?" that has been typed into the field
(or set by a script), then the "?" symbol may mean the field isn't wide
enough to display the data. Try stretching the "edit box" version of
the field to be longer.

OK, I stretched out both the checkbox and the edit box for the field.
It turns out that the checkbox has actually two checkboxes, one on top
of the other. Same deal with the edit box -- one value on top of the
other. And they can hold the values 1,0, or blank. I can't figure out
what the pattern is between the checkbox being checked or not and the
value of the edit box being 1,0 or blank.

Is this a repeating field?

Quote:
By the sound of it, when the "1" value was On the script would run and
when the "1" value was Off the script isn't run. The "0" value isn't
actually needed, but the original developer may simply have reused an
existing Value List for this second purpose. Such a system would work
fine until someone starts playing where they shouldn't - you should not
really play with a system you don't understand, whether it's the
computer's operating system or a FileMaker solution that works.
The problem is it's a Filemaker solution that *doesn't* work, and it's
my job to fix it.

Quote:
Normally a field used to define which layouts to print would be a
Global field, but since you say it contains various data it must be a
normal field (different data for each record).
These checkboxes are Global, I just confirmed it.

Quote:
I'm not quite sure what you're wanting to do or what you should do (if
anything).
Well, here is what is supposed to happen. The user sees a layout like
this

[ ] Print First Section
[X] Print Second Section
[ ] Print Third Section

{print}

When they hit the print button, the script is only supposed to print
the sections that are checked. So in the example above, only the third
section should print.

My problem is, the actual layout has 11 of these checkboxes, all of
which work except for this one troublemaker.


Quote:
If the field is designed to be "1" or "empty" then you
shouldn't really be changing it to set it to "0", but the field
currently contains various values caused by someone playing at some
stage.
I don't really care what the values are as long as it is only one of
two values at a time, and I can find out exactly which value the
checkbox is set to.

Quote:
You should probably get the original person back to fix the problem
since they should know how it's meant to work.
The original developer has a full-time job and family commitments. The
checkbox functionality works for the other 10 checkboxes in this
layout, and works on the other databases.

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.

Quote:
It's impossible to know whether you should actually be playing with
those values at all, but if you want the field to be set to "1" for ALL
records (or all records in the current Found Set), then:
Yes, I should be 'playing' with them. It's my job to get it working.
It's not really that complicated (or, it *shouldn't* be), and the
original developer doesn't know anything that I don't know about it.

This field that the checkbox manipulates exists only to see wether or
not this particular section should print. It's not used anywhere else
in the database. It's not a complex thing, it's just a simple
checkbox.

Quote:
- Make a backup of the file and then re-open it in FileMaker

- Find the appropriate records (Show All or Find a particular set)
It's a global field.

Quote:
- In the "Edit Box" version of the field type a 1

- Choose Replace from the Records menu

- Make sure in the window that appears it says you are replacing
the contents of the appropriate field with "1" and then click
Replace

- All done.

You can use the same process to set the field to be "empty" for all
fields, by simply deleting any data in the "edit box" version of the
field. Or you can use the same process to set them all to "0".

By resetting the values you'll get rid of the strange "?" data ...
although it may well be there for a good reason elsewhere within the
system.
Nope, this field is only used to see if this particular section should
print. That's it's sole reason for existence.
Quote:
If after resetting the values (to "1" or "0") you really want to limit
the values to either "1" or "0", and not "empty", then you can change
the field's format options to use Radio Buttons rather than Check boxes
... but the field sounds like it's meant to be "1" or "empty".
So in Filemaker, a checkbox sets a field to "1" or empty, rather and
"1" and "0".

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



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

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



On Jun 14, 9:49 am, Paul Bruneau <p... (AT) ethicalpaul (DOT) com> wrote:
Quote:
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

Quote:
The safe way to get the value of a checkbox that might possibly
contain multiple values is to use the Patterncount function to look
for your "1".
I've been playing around with the checkboxes, and I can't seem to get
rid of the '1's in the edit field by unchecking the boxes. Are you
sure the Patterncount function will work in all situations?



Reply With Quote
  #8  
Old   
Paul Bruneau
 
Posts: n/a

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



On Jun 14, 2:48 pm, lawp... (AT) gmail (DOT) com wrote:

Quote:
OK, I stretched out both the checkbox and the edit box for the field.
It turns out that the checkbox has actually two checkboxes, one on top
of the other. Same deal with the edit box -- one value on top of the
other. And they can hold the values 1,0, or blank. I can't figure out
what the pattern is between the checkbox being checked or not and the
value of the edit box being 1,0 or blank.

Is this a repeating field?
No. You should read the manual about checkbox fields, or read my
earlier reply.

Quote:
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

Quote:
So in Filemaker, a checkbox sets a field to "1" or empty, rather and
"1" and "0".
No. A checkbox uses a value list to determine the choices that are
available.

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.



Reply With Quote
  #9  
Old   
Paul Bruneau
 
Posts: n/a

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



On Jun 14, 2:55 pm, lawp... (AT) gmail (DOT) com wrote:

Quote:
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
No No No

Quote:
The safe way to get the value of a checkbox that might possibly
contain multiple values is to use the Patterncount function to look
for your "1".

I've been playing around with the checkboxes, and I can't seem to get
rid of the '1's in the edit field by unchecking the boxes. Are you
sure the Patterncount function will work in all situations?
I am sure that you should read the manual about checkboxes, because
each of your assumptions that you've had so far has been off the mark.
Forget everything you think you know about checkboxes and their use in
fields and read the book.



Reply With Quote
  #10  
Old   
Ursus
 
Posts: n/a

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




<lawpoop (AT) gmail (DOT) com> schreef in bericht
news:1181847334.259573.225100 (AT) d30g2000prg (DOT) googlegroups.com...
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

No, no. A checkbox is nothing in itself. It functions only when connected to
a valuelist. This list may contain any number of values. When you create a
normal field you might attach a checkbox to it, determined by a value list.
The field will still remain a normal field. The check box is just a way to
allow the user to enter a number of predetermined values. See it as a
typewriter with the keys defined by the value list. A tap on the key will
enter (or remove) only one value.

So when you considder a valuelist that contains only 1.
The field will show one checkbox
You can leave the box empty (the field is empty)
or tick the box and the field will contain 1

When the valuelist contains 0 and 1
The field will show two boxes
check no box and the field is empty
check the first box and the field will contain 0
check the second and the field will contain 1
check both boxes and the field will contain 0 P 1 (the P is the pilcrow, the
sign for the return)

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.

Keep well, Ursus




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.