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
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.

Under construction. Email me your wish list for improvements.