Boolean Checkbox Efficiencies

On/Off checkboxes are wonderful things. While, in life, we often wish we had an on/off checkbox for certain people, it certainly is much easier within a database - and quicker to accomplish.

In fact, it's so easy, you can have an unlimited number of on/off checkboxes without ever having to write a single script. Yes, you heard it. No scripts.

"But wait?" you say, "I simply add my on/off checkbox to my layout. I didn't need any scripts in the first place." To answer, I say "Yes, but they probably aren't being stored as efficiently as they could be, and if they are, you're not following conventions which users are already use to, in particular, being able to to click the checkbox label as well as the checkbox."

So along comes this video about scriptless checkboxes and being able to select ranges of checkboxes within a list view. It presents the best options for checkbox storage, it allows you to limit the amount of database clutter and reduces the amount of time it takes to add them. Combine these all together and you wonder if you couldn't be doing it better than you are right now. Need to figure it all out? Watch this video and you'll soon know!

AttachmentSize
BooleanCheckboxEfficiencies.zip264.89 KB

Comments

slightly more elegant to use foo xor 1 rather than abs( foo ) -1 ?????

Thanks! Habits stick hard. That was the way I had learned to do it way back. I typically group xor in with "and" and "or" which, in my mind are comparison operators. Where xor is a bit flipper. I'll have to start using that one myself. Xor seems to be something that comes as an after thought for me. Yet there it is. :) Thanks again! Good suggestion.

-- Matt Petrowsky - ISO FileMaker Magazine Editor

Assuming the Check Box field is named CheckBox, why not have the buttonized text object just use Set Field instead of Set Field By Name, and have it use this as its Calculated Result:

If ( CheckBox = 1 ; "" ; 1 )

I really don't see why we need to bother with the more complicated use of Set Field By Name.

If switching a boolean value, why not use

not GetLayoutObjectAttribute( "field.userOption", "content" )

which seems simpler than Abs or xor?

When using the GetLayoutObjectAttribute() function there is an implication that you're doing something with the Layout.

This seems to be more of a personal preference in the area of "seeming" simpler.

When I see


SomeFieldValue xor True

I may not understand or have used xor, but I certainly understand the words True and False. I can also see that I'm dealing with the contents of a field as opposed to


$$someVar xor True

Where it's very clear I'm dealing with a variable. That's just my take on things.

-- Matt Petrowsky - ISO FileMaker Magazine Editor