Brian Dunning's FileMaker Custom Functions

SwitchKey ( Process ; TheKey ; ValueToSet ; OptionalValue

Toggling, adding or deleting a key value

  Average rating: 4.3 (29 votes) Log in to vote

Ugo Di Luca   Ugo Di Luca - Show more from this author
DLSYSTEMS
http://www.dlsystems.fr

Share on Facebook Share on Twitter

  Sample input:
SwitchKey("Toggle";checkboxControl;1;0)

or
SwitchKey
("Add";CategoryField;"Theatre";"")
  Sample output:
Toggle the checkboxControl field from 1 to 0 and reverse.

Add "theatre" to the CategoryField if not already in the list, delete it if already inside)

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

The "Add" process is suitable for multiline keys/lists whereas the "Toggle" acts on single line key field.
The OptionalValue should be set to "" for the "Add" process.

Using this key as the definition of a SetField [ ] allows to cover both actions withing a single script command, not to mention that you may dynamically switch method through script Parameters.

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: