Hello I have a Boolean check box with 1 as checked and "" as unchecked I was wondering How to go about making it so when the box is checked it clears two other fields to be nothing ""?
Depending on how the fields are originally populated (or not), apply a script trigger to the check box for OnObjectModify (the script trigger type).
Depending on the behavior you want, this is a place to start and tinker to fit your needs. This can be done without the "Else If", using just "Else" because we can assume that the dialogue was dismissed by means of the second option if not the first, but I did it this way to help you see what was happening there.
If [ ( isEmpty YourTable::yourField ) ]
Show Custom Dialog ( Clear Stuff? ; "Are you sure you want to clear this stuff?" )
If [ Get ( LastMessageChoice) = 1 ]
Set Field [ YourTable::yourOtherField ; "" ]
Set Field [ YourTable::yourOtherOtherField ; "" ]
Else If [ Get ( LastMessageChoice) = 2 ]
Set Field [ YourTable::yourField ; True ] //or you can set it to 1. This line returns the check to the box if user cancels.
Exit Script [ Result : False ]
You can add other elements to take action ( e.g. Set Field) if the check box is not empty when modified ("not IsEmpty), etc.
I had received this follow-up question via email and replied by email, but it seems to have been lost in the ether:
pardon my ignorance, but where do i put this script? to make it work?
Select Scripts from the top menu bar; in the scripts window, click the “+” to create a new script; name it; and then begin to construct the script from the steps in my example.
I’ll repeat: the “Else If” statement is bulky and can be replaced with “Else”, as it was just intended to clarify.
Exit Script [Return: False}
Once you have the script written, close the scripts window; go to your layout and enter Layout mode; select your checkbox and right-click to set script triggers.
You’ll likely need to modify the example script steps to achieve your desired behavior.
I have yet another check box question... How do I go about creating a check box that starts off as checked for all new records and you then check it off if it does not apply to said new record?
This would be an auto enter of all the values upon record creation. Say you have a value list, named 'rgb' of:
And a field "color" with this auto-enter:
Then a new record will have all those values "checked".
Does that help?
Beverly has given you a great answer (as always) that provides for some extra functionality (using the multiple values idea), but at the very most basic level, if you simply want a yes/no checkbox filled on record creation which you could un-check if needed:
# On the field options (Manage...Database) for your checkbox field in question, set Auto-Enter... Data... enter a 1 in the field.
# Make sure you have a value list created such as "Boolean True" and enter 1 as the list value.
# Then on the inspector panel (layout mode) set the field type to checkbox set (of course) and assign the value list to your "Boolean True" value list. (Make the field small enough to show only the checkbox, not the 1 next to it, and place a label that properly describes its purpose.)
If you later decide that you don't want new records to be pre-checked, simply go to Manage... Database and remove the Auto-Enter... Data.
Retrieving data ...