Bit Based Checkboxes

FileMaker, for all it's ease-of-use, does things in a particular way to make things easy - on purpose. Checkboxes are a prime example. When searching for information within a database, people typically search based on what they understand. The word "Customer" or "Vendor" makes sense, because that's the term you use.

However, there are times when storing things in a more optimized fashion is desirable. This is especially the case when you wish to disassociate the value displayed with what is stored in the database.

Since FileMaker will store the string value "Customer" within a field, when you decide to split customers into "Prospects" and "Customers" you'll need to do some data manipulation to break things out. Unless, you've used ID values or some other type of abstraction from the value shown vs. what is stored.

In this video, I present how you can use Bit based math in order to store the values of a check box (or any other number of items within a logical group). This works especially well when you want to emulate the OS native check boxes in the current versions of FileMaker.

AttachmentSize
BitBasedCheckboxes.zip244.68 KB

Comments

Matt the bit you skipped over which should help people was the the result of your BitTest CF is going to be 2 to the power of 0 = 1 if it is false or 0 and as this equates to a 1 which is not even then you can use that as as test for whether it should be set or unset

Surely you need only a single CF too. In real binary addition there is only one test. Is the bit at this position on or off, is this current bit on or off -> if they are the same do nothing, if first is 0 and this is 1 then add it, else subtract it

I REALLY didn't get why you think you need to have 4 graphics containers though. Can you explain? Is it to render OS style checkboxes as you made it sound like it was needed because it was a platform issue wiht graphics.

If you use the other BitTest on Brian Dunning you can get to a single Toggle function:


Let (
[ _bitOnOff = BitTest ( value , bit ) ; _newValue = 2 ^ Int ( bit ) ] ;
Case ( bit = _bitOnOff ; value ; bit = true ; value + _newValue ; value - _newValue )
)