Toggle ( state )
Simple toggle function, if the value passed is 1 the result is 0 and vice-versa
Average rating: 4.6 (29 votes) Log in to vote
Ofir Gal - Show more from this author
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Simple switch toggle function, if the value passed is 1 the result is 0 and vice-versa. Doesn't use an if statement so should be faster. The only possible input and output values are 0 or 1.
Jan 14, 2010
|How does this work, Is "State" a new FileMaker command I am not aware of yet?|
Jan 14, 2010
|Another pretty common way would be to use "not", ie:
... kudos for working xor into a Filemaker Calc!!!
To answer Bob: State is just the author's parameter naming. It could also have been written like:
Toggle ( boolean ) = where "boolean" is a boolean number, 0/1.
|Ofir Gal, Gal Consultancy
Jan 15, 2010
|Jonathan - I like your way even better. I guess 'xor 1' and 'not' are the same thing if effect.
Sorry if me calling the parameter 'state' is confusing. Maybe I should change it to 'switch' instead?
|john R, birmingham UK
Jan 29, 2010
I use Abs ( state - 1 )
to do the same thing...
Presumably no real efficiency differences.
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.